How do popups work?
J_J
09 Mar 2018, 09:07I tried searching the forum for this, but I think I must be phrasing it wrong. I'm curious if there is a way to nest popup links within popups using the {popup:word::BLABLA} coding. I can get it to halfway work (in that if you click on the popup within the popup the next time you click the original popup word it brings up the second message (?). I'm also curious if it is possible to use the {popup:word:BLABLA} but then add custom functions to it, like buttons or tabs? Is it possible to run a timer from a popup, or use a script in a popup? Or do I need to do something a bit more complicated? If there are already forum posts about this I'd love links. Thanks!
J_J
14 Mar 2018, 09:18Sorry to bump this. But I'm still really struggling with using popups in more complex ways then just {popup:word:bla}.

K.V.
14 Mar 2018, 14:49I think they are only designed for simple use.
I did play around with it a bit, and nesting popups within popups behave surprisingly:
{popup:one:{popup:two:{popup: three:four}}}
Clicking one outputs: two
Click two and the popup disappears.
Clicking one outputs: three.
Click three and the popup disappears.
Clicking one outputs: two
Click two and the popup disappears.
Clicking one outputs: four.
Click four and the popup disappears.
Rinse and repeat.
J_J
14 Mar 2018, 23:45Is there another way to do popups in quest? Is it possible to have a separate menu popup that functions like the normal game?
For instance a menu with buttons, and if you click a button it sets a flag within the game. Or a popup menu that makes you type something into it.

K.V.
15 Mar 2018, 00:34For the menu:
In code view, enter something like this:
show menu ("Pick one", Split("option 1;option 2;option 3",";"), false) {
msg ("You chose "+result+".")
player.option_thing = result
MovePlayer (Page3)
}
Change the options and the script that runs to whatever you like.
Be sure to NOT use the "Show a menu" from the "Add new script" options in the GUI, as that menu will not work.
To get input:
The easiest thing to do would be using get input
and showing the command bar.
...but, for a simple sort of popup, you could create a function and use Javascript:
JS.eval ("var myData = prompt('What is your nickname?');ASLEvent('JsSetName',myData);")
Example function (in full code view):
<function name="JsSetName" parameters="data">
player.aka_js = data
msg ("Hello, {player.aka_js}!")
</function>
A short example game:
<!--Saved by Quest 5.7.6606.27193-->
<asl version="550">
<include ref="GamebookCore.aslx" />
<game name="Popups">
<gameid>9844ae97-9f07-4691-8219-21209eacac48</gameid>
<version>1.0</version>
<firstpublished>2018</firstpublished>
</game>
<object name="Page1">
<inherit name="script" />
<description type="string"></description>
<options type="stringdictionary">
<item>
<key>Page2</key>
<value>This link goes to page 2</value>
</item>
</options>
<script type="script">
msg ("Please enter your name.")
JS.uiShow ("#txtCommandDiv")
get input {
player.aka = result
JS.uiHide ("#txtCommandDiv")
msg ("Hello, {player.aka}!")
MovePlayer (Page2)
}
</script>
<object name="player">
<inherit name="defaultplayer" />
</object>
</object>
<object name="Page2">
<inherit name="script" />
<description type="string"></description>
<script type="script">
show menu ("Choose your thing:", Split("strong;smart;sneaky",";"), false) {
player.skill = result
MovePlayer (Page3)
}
</script>
<options type="stringdictionary">
<item>
<key>Page3</key>
<value>Continue</value>
</item>
</options>
</object>
<object name="Page3">
<inherit name="script" />
<description><![CDATA[<br/>Welcome to the game!]]></description>
<script type="script">
JS.eval ("var myData = prompt('What is your nickname?');ASLEvent('JsSetName',myData);")
</script>
</object>
<object name="Page4">
<description><![CDATA[<br/>Welcome to the game!]]></description>
</object>
<function name="JsSetName" parameters="data">
player.aka_js = data
msg ("Hello, {player.aka_js}!")
MovePlayer (Page4)
</function>
</asl>
J_J
15 Mar 2018, 10:57Thank you!

K.V.
25 Mar 2018, 21:43More Popup Fun
You can use HTML dialog elements to do pretty much whatever you please.
Example:
s = "<dialog open>I am the first <span onclick=\"$('#dialog-two').show();\" style='color:blue;cursor:pointer'>popup</span></dialog>"
s = s + "<br/><dialog style='display:none' id='dialog-two' open>I am the second <span onclick=\"$('#dialog-three').show();\" style='color:blue;cursor:pointer'>popup</span>.</dialog>"
s = s + "<br/><dialog onclick=\"$('#my-link').show();$('dialog').remove();\" style='display:none' id='dialog-three' open>I am the final popup.<br/><br/>Click me to continue</dialog>"
s = s + "<a style='display:none;' id='my-link' style='font-family:Georgia, serif;color:Blue;font-size:12pt;' class='cmdlink commandlink' data-elementid='' data-command='Page2'>This link goes to page 2</a>"
msg (s)
J_J
26 Mar 2018, 10:28This is amazing K.V. Thank you!
Is the last menu that popups from the page2 link also html?