Using the 'popup' command?

I came across a popup text command in the help menu (see below), but so far I have not found a way to use this command.
First I tried to use it in the 'GameBook' description section as it would be useful for text to pop-up when I click on word links, but so luck so far. Maybe this is for the 'Text adventure' part of Quest, if so then I can't see a way of fitting this into the script.
I'm using Version 5.8 of Quest and it says this command is for Quest 5.7, so if this has not been removed for version 5.8 then this command should be working.

{popup:text:long text} Displays a link, with the first text (which cannot have text processor directives nested in it). When the player clicks on the link, a pop-up will be displayed, containing the long text. The pop-up will disappear when the long text is clicked on. This can be used with the img command to have an image pop-up.


What happens when you try it?

Does it just display the text? Does it display the text-processor directive as you wrote it? Does it display nothing at all?

Can you show an example of how you used it?
Are you using it in a msg command, or in the "text" section of a gamebook page? (both should work, but it might help to track down the problem).


Hi mrangel.

This is what I type in the description of the GameBook

{popup Test:Some more text}

and the is what is displayed as text when I run the program.


in the description of the GameBook

The description of a gamebook is not displayed during the game; it's metadata.

I assume you mean in the text of a page which is the "Text" ot "Text and Script" types.

{popup Test:Some more text}

The help text says you should put {popup:text:long text}.


I used the command with Text and Script types and typed in the description
{popup:text:long text}
But it does not get accepted as a script command. Quest sees it as just text so it displays {popup:text:long text} as part of the text.


Can you copy and paste the exact text you're using it in? Maybe there's some detail we're missing.

You've provided two different examples of what you put in your text; one is correct, the other isn't.

Or can you share a game that's giving you this problem, so that someone else can see it?

But it does not get accepted as a script command.

It isn't a script command. It's a text processor command.


When I try to use {popup:text:long text} in a gamebokk I get the message

Error running script: Error compiling expression 'JSSafe(s1) + GetRandomInt(0, 999999999)': FunctionCallElement: Could find not function 'JSSafe(String)'


Ah, that's more useful.

If you include the error message, it's so much easier to come up with a fix.

Create a function named JSSafe with type "string" and a single parameter s.
The script should be:

    s = Replace(s, "\"", "")
    s = Replace(s, "\'", "")
    s = Replace(s, " ", "")
    s = Replace(s, ".", "")
    s = Replace(s, ",", "")
    s = Replace(s, "!", "")
    s = Replace(s, "?", "")
    s = Replace(s, "-", "")
    s = Replace(s, "/", "")
    s = Replace(s, "(", "")
    s = Replace(s, ")", "")
    s = Replace(s, "$", "")
    s = Replace(s, "%", "")
    s = Replace(s, "&", "")
    s = Replace(s, "*", "")
    s = Replace(s, "@", "")
    return (s)

(Though this is a bizarre piece of code in any case; it's inefficient, and doesn't really give any benefits)


Thanks mrangel.

I don't know a lot about functions but hope to experiment with them.

How would I call the function JSSafe, is this done from a script or from a command in the description window.


How would I call the function JSSafe

You don't.
It's called internally whenever the text processor sees {popup:. If the function JSSafe doesn't exist (because it's only available in text adventures by default), the text processor fails to generate the popup.

If you create that function, everything else should start working again.

(I still think that there's no reason for the popup script to use JSSafe… it would be better if that function didn't exist at all. But as long as ProcessTextCommand_Popup uses it, copying JSSafe over from the text adventure library is the easiest way to make it work.)


From what I understand.
I click on Functions on the left of the screen (shown in a tree format)
I then click on the + symbol and I'm asked for the name of the function
I type in JSScript
Do you mean set the return type to string?
I'm not certain what to do after that as I can't see anywhere to type in the script "s = Replace("s", """, "") etc


Yes, the name should be JSSafe, return type string.
There's a list to add parameters to; there should be a single one called s.

There should be a place within the function to add a script; I'd suggest clicking the code view button so you can just paste in the correct code.


Thanks mrangel.
I finally got it working.

Does having to enter the extra function code mean that there is an error in Quest?
Maybe in the next version the function code will be part of the Quest program.


Does having to enter the extra function code mean that there is an error in Quest?
Maybe in the next version the function code will be part of the Quest program.

I think so.

We've come across this a few times; functions that used to be text-adventure-only have been copied across to GamebookCore, but someone's missed copying another function that they rely on internally.

Usually these things get fixed once they're discovered.


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

Support

Forums