Is there any way to log player choices?

I'm curious to catalogue the choices made by players in my games.

Is there any way to do this other than "so please email this log output back to me?"


If you're creating a transcript during the game (for example, by storing the important choices in a variable), you could save that to a server you have access to.

One way of doing this could be to upload the string to a simple web service like file.io - but you'd still need some way for the player to send in the file ID so you could access it again.
I think it should be possible to set up a form using Google Forms (so that the results are saved to a spreadsheet on your Google Drive), and have the game post to it in the background. This is probably easier than building an entire service from scratch, but it's still a significant amount of work.

Not sure if anyone has come up with any other ideas yet.


Is there a way for the "run javascript" link to access information about the game's variables? Also, can you execute functions from the same javascript "scope" in more than one "execute javascript" command?

I'm thinking you could transfer the variables to javascript, then have that send it somewhere (websockets or whatever.)
In fact, perhaps you could print the variables on the screen, have the javascript read it, hide the variables quickly, then call the javascript again and dispatch the information?


Is there a way for the "run javascript" link to access information about the game's variables?

Yes. The most logical way to do it (so that any odd characters in the string are escaped properly) is to create a javascript function.

You can then do JS.function_name(parameters) in Quest. The parameters can be string, int, double, stringlist, objectlist, or stringdictionary; and will be automatically converted to the equivalent javascript types.

A lot of people on here just use JS.eval, passing to it a javascript string with Quest variables in it. This can be unreliable, and is quite a lot of effort to make sure the values are escaped

Also, can you execute functions from the same javascript "scope" in more than one "execute javascript" command?

When you run javascript, you will normally be passing a string to eval, which means the code's local scope is private to itself. There's nothing to stop you using global JS variables; but I'd suggest it might be better to use jQuery.ready to enclose your function definitions.

For example, the JS code:

$(function () {
  var some_variable;

  setValueA = function(a) {
    some_variable = a;
  };

  showValueA = function () {
    addText ("<p>Some_variable is currently "+some_variable + "</p>");
  };
});

You could compress that to a single line of minified javascript; including something like:

JS.eval("$(function(){var n;setValueA=function(e){n=e},showValueA=function(){addText('<p>Some_variable is currently '+n+'</p>')}});")

in your UI Initialisation script. And then in your Quest code you can do:
JS.setValueA (game.someattribute)
and
JS.showValueA()

Your JS functions have a variable shared between them, because they were created inside the same scope.

Does that make sense? I'm not so good at explaining.


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

Support

Forums