Squiffy arrays

Hey, here's a cute trick I started using in my "Pathfinder" game. This creates arrays using javascript functions, but they are in squiffy variables and can last across the duration of your game.


    squiffy.setArray=function(id, value){

    squiffy.story.go("initialize array");

[[initialize array]]:

    var loopCnt;
    //showing how a JS loop can work the array, inserting loop+5 values
    for (loopCnt=1; loopCnt<=3; loopCnt++){
        squiffy.setArray(loopCnt, loopCnt+5)
Values loaded by loop

[[Fetch them back]]

[[Fetch them back]]:


Values should be 5+id, or 6,7,8...


If you have questions, let me know. Basically, the functions allow easy access off a poor-man's array index. You can load values in and pull them out fairly easily. And, if you don't want to bother (for single fetches, say, you can always just pull them out directly using the squiffy name (i.e. {array1})).

I use this for the various "Pathfinder" minigames to allow easier access to 2D and 3D maps. You might find a use for it. Enjoy!

Log in to post a reply.