|
ilyarin Beginner
Joined: 29 Aug 2008 Posts: 10
|
Posted: Fri Aug 29, 2008 9:56 pm
[2.36] %yesno. Unexpected results. |
Okay, I've been getting some weird results off of using %yesno in some recent scripts.
This is what I'm doing:
Code: |
#echo %yesno("Do you like cheese?","I love it.","I hate it.","I'm indifferent.")
|
It brings up the following:
Code: |
Do you like cheese?
[ Yes ] [ No ] [ I'm indifferent. ]
|
and then prints, if I click for example 'No', "I hate it."
AFAIK, it should display the customised messages in the boxes and then return the numbers 1, 2, and 3 appropriately.
---
Also, if I use it in an #IF statement, for example:
Code: |
#if (%yesno("What do you like more, BLUE or RED?","BLUE","RED")) {
#echo I like blue more.
} {
#echo I like red more.
}
|
Then it still shows only the Yes/No boxes, uncustomised, but it also will go into the true(I like blue more) part of the #IF statement no matter if I click on BLUE or RED. |
|
|
|
Toxic Adept
Joined: 27 May 2008 Posts: 299
|
Posted: Fri Aug 29, 2008 10:02 pm |
Thats because for the last one even when you click on no, its returning "RED" which is eval'd to true, hence you get I like blue more.
As far as %yesno working in that way... Ive never seen it work different to my knowledge.
To do what you want, use this syntax
#echo %yesno("Do you like cheese?","I love it.:","I hate it.:","I'm indifferent.:")
That returns 1, 0 and 2 respectivly |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Aug 29, 2008 10:08 pm |
Toxic is correct, you need to put the ":" colon after the name of the button to make that the label instead of the return value. It's actually documented in the #YESNO page of the help system.
|
|
|
|
ilyarin Beginner
Joined: 29 Aug 2008 Posts: 10
|
Posted: Fri Aug 29, 2008 10:17 pm |
Oops! Thanks! :)
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|