-
Notifications
You must be signed in to change notification settings - Fork 1
Creating Custom Options
Custom options are one of the features of this Psych Engine fork. They can be used to apply some settings that could change the gameplay or the game's visual looks. Here's how to configure them:
In order to create an option, you will need to make an options folder inside of your mod. After doing so, create a text file including some data your option needs to have. You can call it however you want, it's not name dependent. Inside of the text file, you will have to include the next information:
- Option Name
- Option Description
- Option Variable (the name your option will be stored as)
- Option Type
- (optional) Default Value (if your option doesn't include one, the game will automatically pick one for you)
For starters, Default Value can variate for each option (eg. Bools have true or false, Strings have a string value, Numbers have a number value).
(each information must go in order)
Options can have various types. Here's a list of currently supported option types:
- Booleans (
boolin syntax, it can be either True or False) - Strings (
stringin syntax, it can contain multiple options) - Number Options:
- Integers (
integerin syntax, numbers without decimals) - Floats (
floatin syntax, numbers with decimals, always ends with .0) - Percentage values (
percentin syntax, can variate from 0% to 100%)
- Integers (
Each of these mentioned option types (except Booleans) have additional values.
Now into detail for each of these option types:
-
all values- should be separated with a comma (eg.Red,Green,Blue,Yellow). Putting a space in between values would break the option.
-
Minimum value- the minimum number that the option can change to -
Maximum value- the maximum number that the option can change to -
Change value- the value option can change by. For example,0.2would change the option by 1/5 of a number. -
Scroll speed- the speed option changes at.
That's basically everything you need to know about additional values.
In order to access the values, you need to initialize the options save file first. You can do that by writing initSaveData('options', 'psychenginemods/MyMod');
In order to access an option, you have to write getDataFromSave('options', *Option Variable Name)
Option Variable Name - The variable name we have mentioned before.
In order to save an option, you have to write setDataFromSave('options', *Option Variable Name, *New Option Value)
Option Variable Name - The variable name we have mentioned before.
New Option Value - The value you want it to change to.
function onCreatePost()
initSaveData('options', 'psychenginemods/MyMod');
debugPrint(getDataFromSave('options', 'easyMode'))
end