new functions

Pertex
Hi Alex,
with 5.1 "new" functions like ask, wait or show menu are coming. The old ask and ShowMenu functions are deprecated, what about WaitForKeyPress? Must /should I replace these functions?

Alex
You don't have to replace the functions, unless you want your game to be converted into an app at some point. (The reason I had to deprecate the old functions and introduce new ones was that in Javascript you can't have threads - meaning that asking a question, waiting for a keypress or showing a menu can't pause a script while waiting for user input.)

WaitForKeyPress is also deprecated (just updated the wiki to mention this) - you should use the "wait" script command instead.

Pertex
So you can't/shouldn't do something like this?


for (x,0,2) {
ask (StringDictionaryItem (game.test, tostring(x) ) ) {
msg(result)
}
}


By the way, such a function kills Q5

Alex
You shouldn't do that because the "ask" script command will not suspend the thread. The script keeps running after the "ask" command, so your loop will trigger three "ask" commands simultaneously.

Looks like I will need to raise an exception if asking more than one question at a time - that will at least stop Quest from crashing.

Pertex
But is the GetInput function ok then?

Alex
You're right - that will need to be deprecated too, as it also pauses the thread.

But at the moment it's not deprecated as it doesn't have a replacement! (I didn't need to implement one for the Bump app)

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

Support

Forums