Making menus

jaydee
23 Sept 2015, 16:13
Ok still new to all this but gradually learning more:

Ok what do i need to do if i want to set up a menu at the opening of the game with options that can be selected, so for example :skip intro, Play intro etc...

what do I need to add in order to make it work?

lightwriter
23 Sept 2015, 20:08
A newbie way of doing this is is like this:

Ask (player.name + ", Would you be so kind to listen to my tale?") {
if (result = true) {
//code the intro if player wants to hear intro
}
else {
//code if player doesn't want to listen to intro
}

NOTE: player.name is just a reference to the character's name, it can be player.alias or doesn't have to be there at all?
You can have this instead:

Ask ("Do you want to hear the prologue?") {
if (result = true) {
//code the intro if player wants to hear intro
}
else {
//code if player doesn't want to listen to intro
}

HegemonKhan
23 Sept 2015, 22:04

jaydee
24 Sept 2015, 04:43
Ok thats a bit of help but i cant find much documentation on making a list for the question to reference to, I'm still a new user to this and coding, admittedly, is not my strongest point, if I wanted to create a multiple choice menu using the GUI and the games set options how would I set it up? Sorry I'm being a bit dense at the moment =P

The Pixie
24 Sept 2015, 07:19
Go to the Script tab of the game object; the bit at the top is the start Script. Click the seventh button, "code view", and paste this in:
list = Split("Skip intro;Play intro", ";")
show menu("Options", list, false) {
if (result = "Play intro") {
msg("In the beginning...")
}
}

You can then click the "Code view" button again to go back to normal view. Click Play and away you go.

This gives a pop-up menu. If you prefer an in-line menu, change "show menu" to "ShowMenu". Unfortunately, there is an issue with ShowMenu that means the room description will appear when the question is asked, rather than after the player has made a selection. Probably the best way to get around that is to have the player start in a blank room, and move her to the first room as part of this process.
list = Split("Skip intro;Play intro", ";")
ShowMenu("Options", list, false) {
if (result = "Play intro") {
msg("In the beginning...")
}
player.parent = start_room
}

If you want more options, add them like this:
list = Split("Skip intro;Play intro;Credits", ";")
ShowMenu("Options", list, false) {
if (result = "Play intro") {
msg("In the beginning...")
}
if (result = "Credits") {
msg("A big thanks to The Pixie!")
}
player.parent = start_room
}