choice presents choices to the user on screen.
-`
+
choice ch1|ch2|ch3...
-`
+
Each choice is separated by a '|' (pipe) character. The result of the choice is stored into a variable named 'selected', which can be queried with if.
Optionally, I implement an extension of this form:
-`
+
choice ch1|ch2|... >var
-`
+
Instead of storing to selected, 'var' will be used instead.
CLEARTEXT
fi simply ends an if statement.
-`fi`
+ fi
Note that I am a bit smarter than vnds here. `if` and `fi` CAN be embedded. So this is valid:
-`
+
if selected == 2
if previous >= 5
text 'You win!'
text 'You lose!'
fi
fi
-`
+
The behavior of VNDS would be to `'if previous <= 5'` on failure of `selected == 2`. This is really not proper: vnds just conditional jumps. Frankly, a jumpeq would be far more effective. I keep an if-count instead of an in-if bool value, so there's proper control flow.
setvar and gsetvar are used to set variables. gsetvar specifically sets the 'global' state, that is, common to all saves. In my implementation - that is moot. Thus, gsetvar just calls setvar.
-`
- [g]setvar var mod value
-`
+ setvar var mod value
+ gsetvar var mod value
mod can be one of the following:
One more thing that was not all over the place in vnds, but typically at the beginning.
-`
+
setvar ~ ~
-`
+
Which means reset all vars. This ignores globals - e.g. prefixed with a lowercase `g`.
As well, my extension provides the ability to set a variable to another variable.
-`
+
[g]setvar var op var2
-`
+
Again, this only works in extensions mode.
sound plays a sound, and optionally a number of times.
-`
+
sound file [times]
-`
+
`times` is implicitly 1 if not specified. Pass -1 for infinity.
You can do
-`
+
sound ~
-`
+
To stop all playing sounds.
text is the meaty huge function. It outputs text, as you probably expect.
-`
+
text This is text dee doo...
-`
+
There are a bunch of variants with special meaning. I don't know why, but there are:
The console should now prompt you with this;
-`
+
[scr command] $
-`
+
You can enter any command above; Some won't work right. choice probably won't work properly, because mouse is disabled.
Saves are actually a script generated by the save function. So, for example, this is a save:
-`
+
setvar selected = 2
music bgm03.ogg
bgload qmrtb.jpg
jump fate01-00.scr 261
-`
+
It restores any variables needed, loads the current music and bg, and jumps to the location we were previously at in the script.