I’ve recently created a game using Twine 2.3.8, SugarCube 2.31.1. Basically, it is a ‘treasure hunt’ type of a game, i.e. the winner is the one who finishes the game the fastest. I have tested it out with a couple of friends and they suggested adding an online leaderboard to track scores.
I did the same for a code to add the online leaderboard and stumbled upon this website - http://www.ohiofi.com/blog/how-to-use-google-drive-to-store-high-scores-for-twine-games/
It basically converts the twine variables into a Google form input, and saves it as a form response on a Google Sheet. Even though it was written for an older version of Twine, I managed to replicate everything except for one block of code.
/Places the variables (given as parameters) into the Google Forms
text input field./
handler: function (place, macroName, params, parser)
/Enter the ID of the first Google Forms text input field here./
a = place.querySelector("#entry_111111111");
a.value = eval(Wikifier.parse(params));
/Enter the ID of the second Google Forms text input field here./
b = place.querySelector("#entry_222222222");
b.value = eval(Wikifier.parse(params));
From my understanding, the #entry_11111… is a unique Google Form input variable (ID) that is generated for every textbox input in the form.
googleForms>>: a is not defined”.
I think this is because the syntax used in the code is not suited for Twine 2.x or Sugarcube 2.x.
Either way, I checked out the Sucarcube Macro API from the official website but couldn’t seem to make any sense of it. The code above is suited for 2 variables, my game has 4 that need to be captured and stored ($player_name, $hour, $min, $sec) but I’ve tried the code with 2 variables for starters ($player_name, $hour).
Any help in translating the above code to one that will work with Twine 2.3.8, SugarCube 2.31.1 will be really helpful. Thanks in advance!
PS - There is a demo available at the link sent above but it is coded in Twine 1, I suppose.