- Platform: Twine / Google Sheets
- Developers: Only Me
Are you looking for a google sheet script that allows you to save and load data into cells on a google sheet for use in a Twine game? Found this page? The work completed here was for a client and is not 100% publicly available. I am happy to release this code to people who need it on request, use on the contact page or email firstname.lastname@example.org and will get back to you ASAP.
Version 1 – March 2020
This was a client project, the client was working on a twine ‘proof of concept’ for a simple story game that would ask the user to enter a word which would be saved into a google sheet when entered, or enter a default value when no word was entered. The client was using a pre-exsisting script that was a little out-dated. The script still worked when sending the data, but the loading of the data was not working. My job was simple, make a functional loading system for the game.
I did later remark on missing features that would allow for all user cases, such as multiple users that entered the same word showing up more than once on the display. However the client was not fussed about having these as the POC only needed to show the game saving and loading what was entered.
This project certainly was a challenge, but also a nice change of pace. Having to learn new code languages on the fly and get results quickly was fun and I’d happily do it again.
Version 2 – June 2020
A few months after the initial solution was completed, I was contacted again to see if some changes could be made in order to allow the game to load words for a different columns as needed. This needed a rather large rework as the script would need to save to a defined column on the google sheet and then be able to read a column based on a parameter passed through the get method.
I went about getting the ability to send data sorted first. Fortunately this was a simple process, only needing to pass through and read a parameter to tell the script which header to place under. The rest was already there and nothing else needed altering.
I then had to do the same for the return method which was a lot harder. This was not helped much by the lack of tools to debug the code, as google sheet script kind of assumes it meant to only run on its own platform. Because of this I spent most of my time trying to figure out what was and was not working. I eventually figured out that some of the methods I was using from my last iteration were not running or working as intended. Because of this I decided to remake them and, at the same time, improve the script so it would do extra checks to remove blank entries and duplicates as well as displaying an output even if the sheet did not have enough entries to show.
The final product this time around was far better than the previous version and worked perfectly for the client, who was delighted with the extra work done to it. The code for this version is available on request, note you may be charged a small fee to licence the work.