You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functionASLEvent(event,parameter){if(!canSendCommand)returnfalse;canSendCommand=false;// using setTimeout here to work around a double-submission race condition which seems to only affect Firefox,// even though we use "return false" to suppress submission of the form with the Enter key.window.setTimeout(function(){$("#fldUIMsg").val("event "+event+";"+parameter);$("#cmdSubmit").click();},100);returntrue;}
Notice that first line of code: if (!canSendCommand) return false;
While scripts are running in response to a command, canSendCommand will be false.
Now, you might be thinking what I was thinking the first time I looked at this: afterSendCommand must set canSendCommand to true; right? Nope.
We have two versions of afterSendCommand online. One in the web player, and one for the mobile player. The web player's does nothing at all. It is only there so the function will be defined.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
ASLEvent
works differently in the desktop player than it does online.In the desktop player, we can call
ASLEvent
from a script which is run due to a command. This is not the case online.To test this, here it is online: https://play.textadventures.co.uk/Play.aspx?id=editor/858f774e-b183-4583-b564-b7c8727f89ed%2fASLEvent+Tester+42.aslx
And here is the game's code to test it in the desktop player:
ASLEvent Tester 42.aslx
That command will work as expected every time in the desktop player, but never once online.
Desktop
Online
This is because the WebPlayer app has a different script.
WebPlayer/player.js#L169-L179
Notice that first line of code:
if (!canSendCommand) return false;
While scripts are running in response to a command,
canSendCommand
will befalse
.WebPlayer/player.js#L152-L167
Now, you might be thinking what I was thinking the first time I looked at this:
afterSendCommand
must setcanSendCommand
totrue
; right? Nope.We have two versions of
afterSendCommand
online. One in the web player, and one for the mobile player. The web player's does nothing at all. It is only there so the function will be defined.WebPlayer/playerweb.js#L23-L24
The mobile player simply uses it to select the "game" tab after sending a command.1
WebPlayer/Mobileplayermobile.js#L205-L207
The
pageLoad
function is what setscanSendCommand
totrue
after each turn. Each time we send a command online (typing or clicking),pageLoad
runs.WebPlayer/player.js#L11-L14
So, we can get around this by altering our script in our command to this:
Now, it will work online.
https://play.textadventures.co.uk/Play.aspx?id=editor/ebe1cc97-6b4c-468f-bb62-7831707e4b27%2fASLEvent+Tester+42.1.aslx
For completion, here is the
ASLEvent
script for the desktop player:Player/desktopplayer.js#L18-L20
Footnotes
The mobile player has HTML elements that neither of the other platforms have. ↩
Beta Was this translation helpful? Give feedback.
All reactions