Popup Command Erorr Mesage [SOLVED]
Inquisitor Kane
13 Mar 2022, 11:35Hello,
I want to use popups as a glossary entries, to explain meaning of the word that has been used and may not make sense to the player. I used the {popup:text:long text} command but it always shows this error message when running the game:
Error running script: Error compiling expression 'JSSafe(s1) + GetRandomInt(0, 999999999)': FunctionCallElement: Could find not function 'JSSafe(String)'
I have found one old thread regarding this, (https://textadventures.co.uk/forum/quest/topic/vjhlospayegd530pdbkknw/collapsibles-in-gamebook-mode) but it makes no sense to me.
Anyone can help, please?
mrangel
13 Mar 2022, 12:03I assume you're using gamebook mode? There's a function in the Text Adventure library which is needed for popups.
There's a bunch of discussion in that thread about other questionable design choices in the way popup
works; but you don't need to worry about that. Just follow the first instruction and it should work fine.
Create a function with the name JSSafe
, parameter s
, and type string
.
For its script, in code view put:
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)
Inquisitor Kane
13 Mar 2022, 12:20I do use Gamebook mode, but there is no Text Adventure Library button, no option to create function, etc. All this makes no sense to me.
Or is this function available only for text adventures?
mrangel
13 Mar 2022, 13:00I do use Gamebook mode, but there is no Text Adventure Library button
No, there won't be. The text adventure library is all the stuff that comes built in when you create a text adventure.
That's why you need to add the function manually.
no option to create function
Click on "Functions" in the sidebar.
Then click "Add".

If it's not there, you might have it disabled. I'm not sure if that can happen; but someone can probably tell you how to get it back.
Inquisitor Kane
13 Mar 2022, 13:59Alright, it took me couple of minutes, but I have found it!
I had to get out of Simple mode to get the Functions and stuff being shown and properly working.
My Quest looks differently though, but close enough to follow the instructions.
Thank you very much for the help! :)