how to make this menu (or whatever it is | i dont know sorry

sasha2cool
10 Dec 2015, 18:08
i played a game with this menu thing in the beginning. it is were you could choose one of the choices.
like this:
Q: are you a boy or a girl

Choices:

1. girl
2. boy

then a script will run on the one you choose..

the game was i forget mlp something

(Quest]

The Pixie
10 Dec 2015, 18:21
Select the "game" object from the pane on the left, and go to the Script tab. Look for the Start script at the top, and click the "Code view" icon, the seventh along. Paste this in:
options = Split("girl;boy", ";")
ShowMenu ("Q: are you a boy or a girl?", options, false) {
if (result = "girl") {
msg ("You are a girl.")
}
else {
msg ("You are a boy.")
}
}

The first line creates a list of options. The second uses that list withthe ShowMenu function (the false means that he player has to answer the question before moving on).

A problem is that your first room description will appear after the question is asked, but before getting an answer. A way around that is to start the player in a special blank room just for creation the character, and to move him or her to the proper start room later.

I hope this is clear; say if not.

HegemonKhan
10 Dec 2015, 18:35
you can do it yourself manually (not good if you got a lot of choices), or you can use a List Attribute and the 'show menu' Script~Function, and the 'DisplayList' Script~Function to number order the choices for you.

yourself:

add new script -> output -> 'Print a message' Script -> (see below, repeat as needed)

print [MESSAGE] Q: Are you a boy or girl?
print [MESSAGE] (leave this blank, for an empty line)
print [MESSAGE] Choices:
print [MESSAGE] (leave this blank, for an empty line)
print [MESSAGE] 1. girl
print [MESSAGE] 2. boy

add new script -> output -> 'get input' Script

-> then -> add new script -> scripts -> 'if' Script -> (see below)

if [EXPRESSION] result = 1

-> then -> add new script -> variables -> 'set a variable or attribute' Script -> (see below)

set variable player.sex = [EXPRESSION] "girl" // this is to store~save your sex, so that you can use it throughout your game for determining what decisions~actions~events~responses happen

else -> add new script -> variables -> 'set a variable or attribute' Script -> (see below)

set variable player.sex = [EXPRESSION] "boy" // this is to store~save your sex, so that you can use it throughout your game for determining what decisions~actions~events~responses happen

add new script -> (example only ~ choose whatever script~s you want) -> output -> 'print a message' Script -> (see below)

Print [EXPRESSION] "You're a " + player.sex + "."
// if chose 'girl', outputs: You're a girl.
// if chose 'boy', outputs: You're a boy.

-----------

I can show you the 'DisplayList' method, but it's a bit more advanced, as you got to work with List Attributes.

----------

and here's a good guide (by Pixie I believe) on what we're doing:

http://docs.textadventures.co.uk/quest/ ... ation.html (character creation guide)
^^^^^^^^^^^^^^
http://docs.textadventures.co.uk/quest/guides/ (lots of guides, this is where the character creation guide is found)

and here's some of the relevant commands~scripts~etc for you to use (though they involve coding ~ you can do the same in the GUI~Editor though, but I don't know how to):

http://docs.textadventures.co.uk/quest/scripts/msg.html
http://docs.textadventures.co.uk/quest/ ... _menu.html
http://docs.textadventures.co.uk/quest/ ... split.html
http://docs.textadventures.co.uk/quest/ ... input.html
http://docs.textadventures.co.uk/quest/scripts/if.html
http://docs.textadventures.co.uk/quest/ ... witch.html
http://docs.textadventures.co.uk/quest/ ... lists.html
http://docs.textadventures.co.uk/quest/ ... ylist.html ~~~ DisplayList (your_list, true or 1 ~ same thing ~ one of them works)

sasha2cool
10 Dec 2015, 20:43
The Pixie wrote:Select the "game" object from the pane on the left, and go to the Script tab. Look for the Start script at the top, and click the "Code view" icon, the seventh along. Paste this in:
options = Split("girl;boy", ";")
ShowMenu ("Q: are you a boy or a girl?", options, false) {
if (result = "girl") {
msg ("You are a girl.")
}
else {
msg ("You are a boy.")
}
}

The first line creates a list of options. The second uses that list withthe ShowMenu function (the false means that he player has to answer the question before moving on).

A problem is that your first room description will appear after the question is asked, but before getting an answer. A way around that is to start the player in a special blank room just for creation the character, and to move him or her to the proper start room later.

I hope this is clear; say if not.

thanks