Hey,
Someone commented a while back that people have been making fairly complicated story style dialogues, and suggested that being able to store your own variables would make that a lot easier. I've added a test system for this to the latest release (1.18.1b), but I wanted to get some feedback here before making it more visible in the game, because it's mostly for more advanced writers, and it does need manual text editing at the moment.
Dialogue lines already have some optional settings (things like mood), stored as a JSON string at the end of each line, so the new system uses "set" and "check" objects inside of that. There's some information about JSON here, but it's basically a list of names and values written with commas in between:
Those go inside {} braces to make groups named "set" and "check", which look like:
and those go inside another group which is what gets saved as the settings for each line, so all together it looks like this:
You can try out writing JSON manually here. The main thing to remember is that the names always need to be in "", but the values can be "strings", plain numbers, or true / false.
Add a "set" object to store values, and add a "check" object to limit the line to only play when the checks are correct. You can also insert things that you've stored into lines by writing *name*.
Setting values just saves the new value over the top of whatever is already there (or makes a new value), and checking will only allow a line to play if the "check" value matches what you've stored previously.
When you're working with numbers though, you can change values by writing + or - a number in "", like:
and you can check for numbers being greater or less by writing >, >=, <, or <= in "", like:
Finally, you can set up your variables when a dialogue script is loaded by writing:
If you don't add initial_settings, number checks will assume the value starts at 0, and otherwise assume the value is false.
With this, you can do things like set a "chapter" name, and check lines so that they only play in the correct chapter:
If you go into the dialogue editor, there's a new "Log" button which will show you if your custom settings are loading correctly, and list the checks being made for each line when the game tries to find one to play.
Any feedback on the system or how it works would be great. Hopefully it's not impossible to get working.
*edit* Actually, you'll have to grab the download again if you got it before I edited the post, otherwise it will be impossible to get working. I left a debug reset in, but that should be fixed now.
Someone commented a while back that people have been making fairly complicated story style dialogues, and suggested that being able to store your own variables would make that a lot easier. I've added a test system for this to the latest release (1.18.1b), but I wanted to get some feedback here before making it more visible in the game, because it's mostly for more advanced writers, and it does need manual text editing at the moment.
Dialogue lines already have some optional settings (things like mood), stored as a JSON string at the end of each line, so the new system uses "set" and "check" objects inside of that. There's some information about JSON here, but it's basically a list of names and values written with commas in between:
Code:
"name":"value", "anotherName":"value", "aNumber":5
Those go inside {} braces to make groups named "set" and "check", which look like:
Code:
"set":{"name":"value"}
Code:
intro:"This is the normal dialogue line."{"set":{"count":1}, "check":{"aDifferentCount":5}}
You can try out writing JSON manually here. The main thing to remember is that the names always need to be in "", but the values can be "strings", plain numbers, or true / false.
Add a "set" object to store values, and add a "check" object to limit the line to only play when the checks are correct. You can also insert things that you've stored into lines by writing *name*.
Setting values just saves the new value over the top of whatever is already there (or makes a new value), and checking will only allow a line to play if the "check" value matches what you've stored previously.
When you're working with numbers though, you can change values by writing + or - a number in "", like:
Code:
"set":{"count":"+1"}
Code:
"check":{"count":">=2"}
Finally, you can set up your variables when a dialogue script is loaded by writing:
Code:
initial_settings:{"count":0}
If you don't add initial_settings, number checks will assume the value starts at 0, and otherwise assume the value is false.
With this, you can do things like set a "chapter" name, and check lines so that they only play in the correct chapter:
Code:
initial_settings:{"chapter":"introduction"}
general:"Hello."{"check":{"chapter":"introduction"}, "set":{"chapter":"afterwards"} }
general:"Goodbye."{"check":{"chapter":"afterwards"}}
If you go into the dialogue editor, there's a new "Log" button which will show you if your custom settings are loading correctly, and list the checks being made for each line when the game tries to find one to play.
Any feedback on the system or how it works would be great. Hopefully it's not impossible to get working.
*edit* Actually, you'll have to grab the download again if you got it before I edited the post, otherwise it will be impossible to get working. I left a debug reset in, but that should be fixed now.