Hi all,
I would like to define variables such that they won't be get saved each time in States object, like a constant, because I have lots of javascript object that they dont change throughout my twine project but they are defined with $ prefix. My twine project started to have lags because of huge collection of objects that's (I suppose- ) cloned each time when I proceed to a new passage.
But they must be accessible globally, within the twine system like how I normally access a variable;
// in some mysterious passage
<<for each _item in constant_object_collection_somehow_global>>
<<print _item[_i].name>>
Comments
Put something like this into your JavaScript:
The you can call it later using for example:
Mate that's tits! was exatcly was i was looking for! I tried to do sort of similiar thing, binding variable to a sugar object with but that gave me an error LOL. Thank you, also could you let me know where's this reference from? Because I 've read all documentation about sugar and twine, seems like I've missing some documentation?!
(also how to mark this thread as ANSWERED?)
@greyelf talks about in in more detail here.