StateMachine - a new way to write dialogues

sdoibanfwae

Potential Patron
Joined
Jul 24, 2016

Check the example for how to use it. The dialog uses a trigger to load the config JSON txt file. Use The JSON Validator to verify that your JSON is correctly formatted.

You load the JSON txt file with [SMLOADCONFIG_StateMachine1] where StateMachine1 is the filename (.txt is appended automatically).

Define your variables with cutoffs (and sometimes you'll want a min and max). Special variables are vigour, depth, speed, and hispleasure. These variables are pulled from other sources. You can modify the value of hispleasure, but you cannot modify the values for the other special variables. Any other variables (like herpleasure or streak) you will have to change the value of yourself by using effects in your states.

Once your variables are defined, you can use the cutoff names as requirements in your states. Only 1 state will be active at a time, if the requirements are met for multiple states then only the best match will be selected.

When a state is triggered, the state machine calls a line of dialog with the name of the state. So if you have a state like

Code:
        "rough": {
            "requirements": {
                "depth": ["verydeep", "hilt"],
                "speed": ["fast", "veryfast"],
                "herpleasure": ["none", "low", "high"]
            },
            "chances": 2,
            "actions": ["[ARMS_HIS_LEGS][SETVAR_da.breathPercentage_0]"],
            "effects": {
                "herpleasure": 6,
                "hispleasure": 5,
                "streak": 5
            }
        }
Then, let's say the state changes from moving to rough, state machine will call dialog lines for rough, now_rough, and moving_to_rough. It will also continue to call the rough dialog (but not now_rough or moving_to_rough) while the state is maintained, and the chances property controls how often it gets called repeatedly.

Actions is an array of strings, each string is a line of dialog to execute when the state gets triggered (and retriggered, depending on the chances). Only 1 action is played each time the state is triggered, but an action can have as much dialog text in it as you want.

Effects is a list of variables to add to. If you want to subtract, then use a negative number.

Variables get "pseudo-states", look at the example at like depth_hilt, depth_verydeep, speed_veryfast, and speed_fast. All variables get lines of dialog called for them, but putting them inside the states list allows you to add properties, actions, and effects for them. Still it's better to use real states instead of pseudo-states, because you can only be in one state at a time, but pseudo-states can overlap and be triggered very often.

States (and pseudo-states from variables) also output variables you can use in the dialog. sm_statename_duration is how long the state has been active (this does not get wiped until the state is activated again). sm_statename_times is how many times the state has been entered. sm_statename_totaltime is how many seconds the state has been active in total.

The interrupt property is still an experimental value, it kind of works but use it very sparingly. Interruptable doesn't work yet so currently everything is interruptable.
 
Last edited:
  • Like
Reactions: ZRI

sdoibanfwae

Potential Patron
Joined
Jul 24, 2016
Okay, I'm gonna have to experiment with this. I assume it works with dialogueactions?
Yea, I think it might require dialogueactions, this is my Mods.txt file in $INIT$

Code:
;;;;sby_default/loadingscreenV1/loadingscreenV1.swf
sby_default/TemplateExtensionV5_sby/TemplateExtensionV5_sby.swf
;
Default/FinishesCounter.swf
Default/VigourCounter.swf
Default/PleasureCounter.swf
Default/BreathCounter.swf
Default/HeldBreathCounter.swf
Default/CumInMouthCounter.swf
Default/clearAllShortcut.swf
;
DialogueActions/SDTDialogueActionsv4.09dev10.swf
MoreTriggers v2.2/MoreTriggersv2.2.mod
;
sby_default/clearlastdataV1/clearlastdataV1.swf
sby_default/hairlayerpatchV1/hairlayerpatchV1.swf
sby_default/dialogpatchV4/dialogpatchV4.swf
sby_default/vanillaarmpatchV2/vanillaarmpatchV2.swf
sby_default/leglayermoveV1/leglayermoveV1.swf
;
sby_default/autocloseeyeV3/autocloseeyeV3.swf
sby_default/autoclosemouthV5/autoclosemouthV5.swf
sby_default/breastfirmnessV3/breastfirmnessV3.swf
sby_default/charcodefilesavingV1/charcodefilesavingV1.swf
;sby_default/cumRGBV2/cumRGBV2.swf
sby_default/moremoodsV3/moremoodsV3.swf
sby_default/throatcumbulgeV3/throatcumbulgeV3.swf
;sby_default/superbellyV7_1/superbellyV7_1.swf
sby_default/penisrangeV6/penisrangeV6.swf
sby_default/himnotletgoV1/himnotletgoV1.swf
sby_default/allalphaslidersV7/allalphaslidersV7.swf
sby_default/deepthroatactionsV5/deepthroatactionsV5.swf
sby_default/swallowguzzleV1/swallowguzzleV1.swf
sby_default/ignoreherclothingpenisV2/ignoreherclothingpenisV2.swf
sby_default/regulaterandomV4/regulaterandomV4.swf
;
sby_default/animtoolsV25/source/animtoolsV25.swf
sby_default/moreclothingV7/moreclothingV7.swf
;;;;sby_default/loadingscreenV1/loadingscreenV1.swf

HuniePopAudioTriggersV1_11/HuniePopAudioTriggersv1.11.mod
statemachine/statemachine.swf
 
Top Bottom