Is there some list of Squiffy functions somewhere?
Kilyle
09 Oct 2015, 07:47I've wrapped my head around "get" and "set" JQuery stuff, but now I want to increment a Squiffy variable (so that hitting my little side controls increases the variable as well as hitting Squiffy story passages). So I ended up getting it and then setting it. Is there a way to do that in one line using Squiffy functions like inc and dec, but from JavaScript?
...also, which variable is the turn count stored in? And is it possible to set that to zero or something, or would that screw things up? Does it change based on section?
...also, which variable is the turn count stored in? And is it possible to set that to zero or something, or would that screw things up? Does it change based on section?
cliffale
24 Mar 2016, 11:13I'd like to know this too.
Alex
24 Mar 2016, 13:00Take a look at the JavaScript file here: https://github.com/textadventures/squif ... emplate.js
It defines all the Squiffy functions that are available. There aren't very many. There's no JS equivalent of inc and dec but it wouldn't be too hard to add those (happy to accept a pull request for this if somebody else wants to do it!)
It defines all the Squiffy functions that are available. There aren't very many. There's no JS equivalent of inc and dec but it wouldn't be too hard to add those (happy to accept a pull request for this if somebody else wants to do it!)
lir
29 Mar 2016, 20:28You can create your own functions easily, just add a master section and a script at the top. For example to have a JS increment function:
As for finding out which function are available, I recommend debugging in Chrome, and then seeing what is available in the squiffy object.
[[]]:
squiffy.inc = function(attr) {
squiffy.set(attr, (squiffy.get(attr) || 0) + 1);
};
As for finding out which function are available, I recommend debugging in Chrome, and then seeing what is available in the squiffy object.