Reporting a bug from in-game via email (an example)

<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="BugReport">
    <gameid>05dd0048-ff80-44d4-843f-47aa85399d14</gameid>
    <version>1.0</version>
    <firstpublished>2018</firstpublished>
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <description type="string"></description>
    <beforeenter type="script">
      ReportBug
    </beforeenter>
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
  </object>
  <command name="report_bug_cmd">
    <pattern>bug;report bug;contact</pattern>
    <script>
      ReportBug
    </script>
  </command>
  <function name="ReportBug"><![CDATA[
    msg ("<div id='creation' style='display:none;width:950px;padding:24px;margin-right:auto;margin-left:auto;margin-top:20px;'><br/>First name:<br/>  <input class='bug-input'  type=\"text\" name=\"firstname\" id=\"firstname\" value='Anonymous'><br><br/>Last name:<br/>  <input class='bug-input'  type=\"text\" name=\"lastname\" id=\"lastname\" value='Adventurer'><br/><br/>Game Name:<br/><input  class='bug-input' type=\"text\" name=\"gamename\" id=\"gamename\"  value='{game.gamename}'><br/>Game ID:<br/><input class='bug-input'  type=\"text\" name=\"gameid\"  id=\"gameid\" value='{game.gameid}'><br/>Version:<br/><input  class='bug-input' type=\"text\" name=\"gameversion\"  id=\"gameversion\" value='{game.version}'><br/><br/>Bug:<br/><input class='bug-input'  type=\"text\" name=\"bug\" id=\"bug\"  value='The game messed up when...'><br/><br/>Race: <select name='race'><option value=\"Human\">Human</option><option value=\"Orc\">Orc</option><option value=\"Dwarf\">Dwarf</option><option value=\"Elf\">Elf</option></select><br/><br/>Gender: <select name='sex'><option value=\"decline\">Select your gender</option><option value=\"male\">Male</option><option value=\"female\">Female</option><option value=\"decline\">Decline to state</option></select><br/><br/><br/><center><hr/><button onclick='submitStats();'>SUBMIT</button><br/><br/><button onclick='exitBugReport();'>CANCEL</button></center><br/><br/></div>")
    JS.eval ("submitStats = function(){  var name = $('#firstname').val() + ' ' + $('#lastname').val();  var gameinfo = $('#gamename').val() + ' ' + $('#gameid').attr('value') + ' ' +  $('#gameversion').val();  var issue = encodeURI($('#bug').val());  var linksrc = 'mailto:[email protected]?subject='+gameinfo+' BUG REPORT&body=FROM '+name+'%0A%0AISSUE '+issue;  goUrl(linksrc);exitBugReport();};exitBugReport = function(){$('#gameBorder').show();  $('#creation').remove();};$('.bug-input').css('width','80%');$('#creation').insertBefore($('#dialog'));  $('#gameBorder').hide();  $('#creation').show();")
  ]]></function>
</asl>

(It calls the ReportBug() function as soon as the game starts, just for testing.)


Can you link this to your transcript thing, so a beta tester can send a transcript to the author? Testers can add comments to a transcript by typing something * before a command by the way.


>Can you link this to your transcript thing, so a beta tester can send a transcript to the author?

That's a great idea!

I guess it depends on how lengthy the transcript is. (I believe there's a maximum character count when using a data: URL, and I think a mailto: URL counts as a data: URL.)

I was thinking of making the error script automatically add its output to the log, then adding the text from the log to the body of the message. The transcript would be much better, though!

Hrmm... I'll have to see if there's a way to add a file attachment in the URL. If it's possible, I shall post new code here.


>Testers can add comments to a transcript by typing * before a command by the way.

My next step is to display a message the first time someone does that: "You can enter BUG to contact the author at any time during play." (I was considering having Quest add those commands to the log, as well. Just to log all the notes which are entered.)


I can't find a way to include an attachment, and the character limit for the URL is 2083.

If I had a server, I could make it upload the transcript to said server, then include that URL in the body of the email, but I have no server.


can you use a public file sharing service? or even a google drive?


You might be able to open an iframe with Google Forms, and post from there.
Not sure, but I think the Forms system checks to prevent you posting directly from a form on an external site.

I've got enough spare bandwidth to set up something on my webserver (maybe even allow it to post to a bugtracker wiki; the mediawiki API is pretty straightforward); but that's best left until after server migration, if I can ever find time to set it up.

I think any web app designed for tracking software bugs (are there decent free ones?) is likely to have an API so that an app can submit reports to them.


I know nothing about file-sharing.

Using Google Drive or a Gist would assume the player had an account.

Of course, using mailto: assumes the player has set that feature up in their browser. (It took me 3 hours to find out I had to click that little icon in the browser's address field to enable that feature in Chrome. That was very frustrating. I remember it clearly.)


I went to check out some free file-sharing sites, and the first one popped up a warning that I had viruses!

So, I called the number and gave them my credit card number, bank account information, social security number, my mom's email address, and my Amazon log-in information, and they said they'd fix my computer. (Not really. I just powered down, started back up in Safe Mode, cleared all my temp files, and I seem to be sailing smoothly now.)

Summation: I don't think I like free file-sharing sites.


Hey K.V., you are welcome to post your examples under "Libraries and Code Samples". It is easier to find them there later on


Hello, Pertex!

I appreciate that, and that's what I used to do. ...but I've found that I make a lot of changes after testing things out. (Plus, someone usually makes a suggestion which improves something somehow.)

My current method is posting my rough draft here, then posting the final version in "Libraries and Code Samples".


The thing that makes me worry about this is the fact that I never use a few features (like the map or room pictures).

I also never use ask or show menu, and I think those two scripts use the "dialog" element, which is the element I'm inserting my element before. (I don't think these would effect anything, as long as I wasn't getting input from the player when switching to this screen.)


I'm always either under-thinking or over-thinking things, I guess...


Perhaps it's not a final version, but it's always an interessting piece of code. I like to see what people can do in Quest and I often get new ideas by studying their code


Using Google Drive or a Gist would assume the player had an account.

That's why I was thinking about Google Forms; you can make a spreadsheet on Google Drive that people can add rows to by filling in a form. Can be set to one submission per person, or free submission. Not sure how hard it would be to fill in a form using JS, or even to use $.ajax() to submit data to the backend directly. Might need experimentation.


Pertex,

Good point. I'll put these in Libraries and Code Samples from now on.


MrAngel,

On the desktop, I can bring in most things from a different server, but trying to interact with anything with JS throws a cross-domain error. (I was playing with iframes a few weeks ago.) There may be a workaround...

Online, I've never been able to do jack squat with anything that didn't have a URL starting with "play2", even just loading it into an iframe.

...but there are many things of which I am unaware. I'm left Dagobah before my training was complete.

In fact, I think I forgot ever visig Dagobah...

Anyways, I'm trying out suggestions.


Just been playing around with Google Apps Script.

In a spreadsheet on google sheets, you can go to Tools -> Script Editor.
Apps Script is a lot like javascript, except it runs on Google's servers.

If you create a doPost(request) function, then within Quest's JS you can use $.post("(your google sheets URL)/exec", somestring); to call it. Within the sheet's doPost function, you can get at that string using request.postData.contents, and split up the data to insert into your spreadsheet.

… I really need to get back to work. My new book has sold 1 copy so far, and I've only got a week before I said the next one would be out …


Google Apps Script

That sounds cool.

I shall check it out.


In other news, my Kindle Unlimited subscription is currently non-existent. (I've been stuck with what my local library has to offer (which isn't really so bad) for about a month.)

... but I have sent the link to your writings to a few fellow-readers.


Update - RE: Posting to Google Apps

I ended up getting a spreadsheet set up on Google Docs, but I got cross-domain errors whenever I tried to interact with the spreadsheet from outside of its page.

I did get some pretty neat, non-Quest-related stuff going on in the spreadsheet, though. (Thanks for bringing that stuff to my attention, mrangel. It's neat!)


I think using Google Forms is a better approach. (Thanks for bringing Google apps to my attention, mrangel!)

Go here to create a form:
https://docs.google.com/forms/u/0/

Add this command to your game (using the link from your form in place of mine):

  <command name="report_bug_cmd">
    <pattern>bug;report bug;submit bug;submit feedback;feedback;send feedback;contact</pattern>
    <script><![CDATA[
      if (not OnlineCheck()) {
        Ask ("Would you like to copy the game's current output to your clipboard before opening the page?") {
          if (result) {
            JS.eval ("SelectText('divOutput');document.execCommand('copy');")
          }
          SetTimeout (2) {
            JS.goUrl ("https://docs.google.com/forms/d/e/1FAIpQLScgzxVjCsGLHkp-pbGr6QVdRhC1zmZOct4EanNvn8ZPSQKvFQ/viewform?usp=pp_url&entry.2019478726=Adventurer&entry.2042109071&entry.1664626461=NO")
          }
        }
      }
      else {
        JS.goUrl ("https://docs.google.com/forms/d/e/1FAIpQLScgzxVjCsGLHkp-pbGr6QVdRhC1zmZOct4EanNvn8ZPSQKvFQ/viewform?usp=pp_url&entry.2019478726=Adventurer&entry.2042109071&entry.1664626461=NO")
      }
    ]]></script>
  </command>

Add this to "User Interface Initialisation":

JS.eval ("SelectText = function(element) {var doc = document, text = doc.getElementById(element), range, selection;if (doc.body.createTextRange) {range = document.body.createTextRange(); range.moveToElementText(text);  range.select();} else if (window.getSelection) { selection = window.getSelection();range = document.createRange();range.selectNodeContents(text); selection.removeAllRanges();selection.addRange(range);}	};")

Add this function in full code view:

<function name="OnlineCheck" type="boolean"><![CDATA[
  s = " " + 0.1
  return (Instr(s, ",") > 0)
]]></function>

The option to select and copy the text to the clipboard does not currently work online, so it won't even ask unless playing in the desktop version.

Be sure to enable emails when someone posts something:
image


I just added this to this game, if you'd like to see it in action:
http://textadventures.co.uk/games/view/8yjd4mgqheeans5_dw_bpq/easter-eggs


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums