When adding JS functions to a game using JS.eval()...

K.V.
06 Mar 2018, 05:24

Let's say I am making a game in the web editor.

I want to include a JS function. I have this:

JS.eval("myFunction = function(text){alert(text);};")


Will that function:

A. still exist in a saved game if I put it in the start script?

B. need to be in game.inituserinterface, so it is loaded when starting up a saved game?


The answer: B

http://docs.textadventures.co.uk/quest/functions/corelibrary/inituserinterface.html

http://docs.textadventures.co.uk/quest/advanced_game_scripts.html


Happy gaming!


Forgewright
08 Mar 2018, 22:15

I have often wondered about this KV. I assumed it would need to be in game.inituserinterface . Thanks for the confirmation!