-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Textual event script writing and compiling #140
Comments
I also had this in my mind. My idea would be using a Javascript engine that is used as a macro-language to emit event code. The Editor executes it to generate the event commands. Semantic (reserved variable prefixes):
Example: for (let i = 0; i < 3; ++i) {
$V(i, '=', i*2);
}
$C("---");
for (let i = 1; i < 3; ++i) {
$V(i, '+', $V[i]);
$C("+++");
let val = 100;
$V(5, '=', 100 + _db.monsters[2].attack); // OK. DB is Constant expression
$V(5, '=', $game.party.actor[1].level); // OK. Fetches party actor 1 level at runtime This is evaluated while typing. Functions prefixed with $ appear in event code.
Errors: $V(5, '=', 100 + $game.party.actor[1].level); // Error $game is not constant
let val = $V[3] // Error $V is not a constant |
I hacked now together some basic javascript for this and bound it to C++ via QuickJS. Highly experimental. With the following "event code" which is valid Javascript
Generated event code: I generate the following event which shows a Sinus curve: (sorry for the flicker) simplescreenrecorder-2021-02-02_21.29.58.mp4 |
Clicking around boxes for event code is nice for newbies, but it's horribly slow if you know what you're doing.
I would really want some kind of way to type event script on the keyboard.
This is a somewhat big project. We would need to define the text syntax for each command, and write a parser / compiler for it. It would also be nice if game projects could leave the event script files as text and compile them into lcf binary for shipping.
No other scripting language really fits, so this would likely end up being a custom scripting language of sorts. Essentially something declarative which just executes commands.
So all of this might end up being part of liblcf.
The text was updated successfully, but these errors were encountered: