Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

[Twine 1.4.2 / SugarCube 2.14.0] Sending a String to a Google Form Automatically

So I have a bug reporting feature in my game that creates and provides a string to the player that they can plug into a Google form to report bugs. On my end, I built a little tool into my game, as a debug feature, that unpacks the string and reassigns its values to story variables and such and essentially recreates the situation they were in when they encountered the bug down to pretty much every last variable. So far, through some admittedly rather limited testing, it's worked very well.

My question is whether I can automate that process a bit on the user's side and essentially have the string show up in the form ready to go when the Bug Report passage is called up. I'm using the embedded iframe I got from the form to show it in the game, and the whole passage it appears in is handled by SugarCube's built-in Dialog API. Not sure if any of this matters, but here's the code, for reference:
<<button "Report Bug">>
Dialog.setup("Bug Report");"bugr").processText());;

<<display "bugcodegen">>\ /%this passage creates the bug code string from story variables%/
If you have encountered a bug, please create a report using the form below<<if !$webversion>> (requires internet connection)<<endif>>.

Here is your bug report code:  

<span id="bugcode"> <<print $bugcode>> </span>

<iframe src=""; width="760" height="500" frameborder="0" marginheight="0" marginwidth="0">Loading...</iframe>

So the user has to copy and paste the code into the form in the iframe. Is there any way to have it appear in there by default? My limited understanding of how web security works leads me to believe that it isn't possible, since the variable I created in Twine and the Google form are different web sites, but I figured I'd ask anyway.

I'm open to any other possible suggestions to make the process a bit more user-friendly as well.

Best Answer

  • Answer ✓
    Unless Google offers a postMessage API for their forms—they might, I don't know—it is unlikely that you'll be able to affect the form programmatically due to cross-origin issues.
Sign In or Register to comment.