Skip to content
This repository has been archived by the owner on Aug 1, 2020. It is now read-only.

Config values #6

Open
bates64 opened this issue Feb 9, 2020 · 3 comments
Open

Config values #6

bates64 opened this issue Feb 9, 2020 · 3 comments
Labels
feature Corresponds to 'feat' commit type

Comments

@bates64
Copy link
Owner

bates64 commented Feb 9, 2020

Continuing discussion from #5...

alex

I think I understand
I was thinking that a simpler Call GotoMap ( {Map:package/area/map:entry} ) would be fine
oh wait
I see where you're going with this
without some kind of exit/entry manifest maps defined in dependencies don't know how to connect to yours
that's.... a difficult problem
we could solve it your way, or we could make a more generic configuration system for dependencies e.g.

name = "M"
version = "1.0.0"

[dependencies.A]
version = "1"
config = { east_exit: "B/awesome_area/b:Entry0" }

[dependencies.B]
version = "1"
config = { west_exit: "A/cool_area/4:Entry2" }

packages can define what config they take via:

name = "A"
version = "1.0.0"

[config]
east_exit = "map_entry"
% A/src/area/cool_area/4/4.mscr

#new:Script $Script_Exit_East
  Call GotoMap ( {Config:east_exit} ) # expands into {Map:B/awesome_area/b:Entry0}
  Return
  End

or we could just do simple string replacements like GotoMap ( {Map:{Config:east_exit}} ) and not bother with types - this should be fine right?
might be worth making the config system more nuanced in the future which brings into question the {Config:x} syntax, e.g. if I want conditional compilation
Star Rod uses {...} already for its expressions, too; could move away from that?

Add @x syntax, which expands to config values defined by dependent packages in their starpkg.toml. These would expand before reference expressions to allow for Call GotoMap {Map:@east_exit} and the like.

Example starpkg.toml:

name = "foo"
version = "1.0.0"

[dependencies]
bar = { version = "1", config = { east_exit = "foo/cool_map" } }

Usecases:

  • configurable enemy health, damage, etc
  • joining maps from different packages together
  • more

Out-of-scope for this issue is C-style conditional compilation (#if etc), but it should definitely be added in the future.

@bates64 bates64 added the feature Corresponds to 'feat' commit type label Feb 9, 2020
@bates64
Copy link
Owner Author

bates64 commented Feb 9, 2020

We also need to consider the myriad of TOML files within the src directory, like src/actor/<name>/<name>.toml or those proposed for battle/area exports - how would config values work for these, if at all?

I'm currently thinking that in places where IDs are accepted (e.g. actor.toml files take text IDs), we also support @foo syntax.

@bates64
Copy link
Owner Author

bates64 commented Feb 9, 2020

Since config values just provide basic string replacement like in C, it's also worth considering contexts where @x needs to be delimited somehow, e.g. @xfoo - this is ambiguous, did the user mean @xfoo or @x + "foo"? Therefore we should also support a @{x} syntax which allows juxaposition in this manner.

Alternatively, we place the delimiter at the end as in x!, i.e.

#new:Script $Script_Exit_East
    Call GotoMap ( east_exit! 0 )
    Return
    End
name = "enemy_name!"
tattle = "enemy_tattle!"

Bang-syntax makes things like x!foo described above possible.

@bates64
Copy link
Owner Author

bates64 commented Feb 10, 2020

Next steps:

  • Use "Type:name" syntax in all files (including actor/<name>.toml and friends) - breaking
  • Add "Config:name" and {Config:name} for config values

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Corresponds to 'feat' commit type
Projects
None yet
Development

No branches or pull requests

1 participant