[SOLVED] 3 option menu help

CheshireTiger
31 Dec 2019, 19:36I have the start of the menu done.
Player talks to npc - npc dialouge -
Show menu with caption "Whould you like tk learn a new skill from Dalia?"
The options I want are: Check, Learn, and Later.
How do i set these up? I know about 2 option split, but what do i do if its more the 2 choices?

Io
31 Dec 2019, 20:02There's a few ways to do this.
One is to make a String List and fill the options in, and then have the Show Menu call from that. Useful if you want a flexible menu that might change:
ExampleList=NewStringList()
list add (ExampleList, "Check")
list add (ExampleList, "Learn")
list add (ExampleList, "Later")
ShowMenu ("<br/>Would you like to learn a new skill from Dalia?", ExampleList, false) {
switch (result) {
case ("Check") {
//Check stuff
}
case ("Learn") {
//Learn stuff
}
case ("Later") {
//Later stuff
}
}
}
The other way is to use Split. Split takes a string, and 'splits' it into a String List at a certain cue.
If you have, say, "WhataDamnWorld" as a string, and you split with cue "a", then you get a string list:
What
D
mnWorld
``
So what you can do is have the ShowMenu take the menu:
Split("Check-Learn-Later", "-")
This is more useful for static menus where you don't expect them to change.

CheshireTiger
31 Dec 2019, 21:53@ lo
Any chance i can see that not-codeview?
Sorry but that format is never not confusing and i worry about making 1 mistype that breaks the whole thing...
mrangel
31 Dec 2019, 22:18You said you know about using Split for 2 options. It's just the same for 3.
You can use the expression Split ("Check;Learn;Later")
to give a menu 3 options. And then you do it the same way you would with 2.
If you're using if
to handle the results you'll need to add an else if
clause for the second option. If you're using switch
and case
, you just add another case.
Any chance i can see that not-codeview?
It's not so easy to show script on here without using codeview, because the GUI isn't easy to copy and paste. But if you open a script in code view, you can paste in the code someone's given you here and then leave code view to see what it looks like in the GUI. If you're worried about messing up your code, then just create a new object and paste the code into one of its scripts. Once you've seen what it looks like in the GUI, you will know how to create it, and you can delete that object again.

CheshireTiger
31 Dec 2019, 23:43@lo oh. Ok. i usually just screenshot and anonymous imgur post