iiYO Community

Full Version: Prompt
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello! I was trying to use the prompt command according to the documentation:
<prompt title="Name?" message="What is your name?" var="player_name" />
But when I tried trying to put  a 100-word paragraph in the message attribute, the game wouldn't run for some reason. And it seems breaks <br> don't work either...

Lastly, is it possible to have text under the input box?
Hi adriitakumi,

the UI message box commands like prompt are only designed to work with plain text messages, not HTML.

If you want it to work like that, you will have to implement it yourself, as an extension or something. You can write HTML in you lines, so you could add input fields to your lines as well, but you will have to write some JavaScript for them to actually do something.
Thank you for the fast reply Smile

 Is it possible to have a scroll bar inside the prompt box? If ever the message becomes too long....

How do I use the ifvar function? What I want to do is like this:
var string = "hello"
var input = (get user input)

if (input != string){
    //go to this scene
}else {
    //go to this scene
Am I making sense? I only know the basics of the basics Sad
Thanks in advance!
You can set your textbox to the following in the CSS to get a scrollbar if the content is too long:

overflow: auto

I don't really understand your second question:

ifvar is not a function, it's just an attribute in your story. You have to specify the name of a variable using a 'var' attribute on the prompt command. Whatever the user types gets written into that variable. You don't need JS for that part. Just use the prompt command and put conditional gotos after that which check for the variable set by the prompt command:

. prompt title "Password?", message "What's the secret password to open the door?", var choice
. goto scene door_opened, ifvar choice, ifvalue secrit
. goto scene entry_denied, ifvar choice, ifnot secrit