State Machine ⚙️
You need to own this item to leave a rating.
State Machine is a set of scripts that allows you to save states from Script Library events, go through a set of logic gates, and respond to changes in a set of processed states.
Scripts included
- Input: a raw state that can be toggled with events.
- Result: Script to act upon state logic results.
- Quest State: Script to create a state based on a quest's state.
- Quest Objective State: Script to create a state based on a quest objective's state.
- Logic IF: Do 'IF/ELSE' logic on a parameter and save into new state.
- Logic AND: Do 'AND' logic on two parameters and save into new state.
- Logic OR: Do 'OR' logic on two parameters and save into new state.
- Logic XOR: Do 'XOR' logic on two parameters and save into new state. XOR stands for 'exclusive or', which means if either A or B are true, but not both.
- Logic NAND: Do 'NAND' logic on two parameters and save into new state. NAND stands for 'not and'; true for any case except both A and B as true.
- Logic NOR: Do 'NOR' logic on two parameters and save into new state. NOR stands for 'not or'; "neither".
- Logic XNOR: Do 'XNOR' logic on two parameters and save into new state. XNOR stands for 'not exclusive or'; both A and B as TRUE, or both as FALSE.
- Database: Save an input persistently with a database
At bare minimum, one Input and one Result scripts are needed to make this useful. Logic gates need two Inputs. One input and one result will be synonymous to the 'Toggle' script I have in my store.
This is especially useful if you have several Script Library events that depend on each other. With combination of the other Library scripts, many things are possible, such as:
- Open door, after 3 levers have been turned.
- Trigger end game message, after a series of goals have been reached in sequence
- Mutli step chat commands / dialog / prompts
- And much more
Changelog:
1.0.0 - initial release
1.1.0 - added quest states support
2.0.0 - Major refactor:
- Added script persistence support, if you want to save states forever then insert a database script, give it a name and some random numbers, and use the name inside the input script
- Bug fixes
- This version is not compatible with pervious version of state machine, so you will have to update all state machine scripts.
* I allow buyers to resell this script as part of their own products, but not as a standalone script