Hi,
Is there a way to access (or retrieve) story variables with JavaScript? For instance, I’d like to use the trim() function on user input in order to ensure that no extra spaces are added after the input string? Is there a way to do this?
Thanks,
Tim
Comments
Sugacube's History API documentation explains how to access its variables, it is basically
state.active.variables.variable_name_without_the_dollar_sign
eg. if you have a variable named $money then you would access it via:
I am not aware of a simple way to access Harlowe variables via Javscript, maybe someone else like Leon would have a better answer.
Thanks for the SugarCube info!
I forgot about this hack found by @csalzman to set a variable using a combination of a hook, a live macro and some javascript.