Ajjwidjdneidjenw Posted October 12, 2012 Posted October 12, 2012 (edited) Just wondering it was possible to do something like this, instead of defining cases indifidually. I am currently unable to test, hence I'm asking. switch(select( "Start from Beggining ["+.lifecost[0]+"]:"+ ((.unlock && @lives > .lifecost[1])?"Start from flag 1 ["+.lifecost[1]+"]:":":")+ ((.unlock > 1 && @lives > .lifecost[2])?"Start from flag 2 ["+.lifecost[2]+"]:":":")+ ((.unlock > 2 && @lives > .lifecost[3])?"Start from flag 3 ["+.lifecost[3]+"]:":":")+ "Quit") ) for(set .@i,1; .@i < 5, set .@i, .@i+1) { case .@i: set @lives,@lives-.lifecost[(.@i-1)]; atcommand "@alive "+strcharinfo(0); dispbottom "You have "+@lives+" Lives left"; warp "hellfire",.hellwarp[.@i],.Hellwarp[.@i+1]; break; edit: There we go. Edited October 12, 2012 by garet999 1 Quote
AnnieRuru Posted October 12, 2012 Posted October 12, 2012 cannot script error on npc/zzz.txt line xxxx parse_syntax: 'case' label not integer and correct way to do this .... switch..case not even needed whenever the script parse *select, *prompt or *menu and the player selected the option will return @menu variable ... can read further on *menu inside script_commands.txt select "start from beginning ... ", ( condition 1 )? " <statement 1 >" : "" , ( condition 2 )? " <statement 2 >" : "" , ( condition 3 )? " <statement 3 >" : "" , set @lives, @lives - lifecost[ @menu ]; .... warp "hellfire", .hellwarpx[ @menu ], .hellwarpy[ @menu ]; ... select "1", "", "3"; will show up only 2 options , but select the "3" will still return @menu = 3 leaving the option as "" will not show up in the selection, but the variable still retains the counter of options correctly 1 Quote
Ajjwidjdneidjenw Posted October 12, 2012 Author Posted October 12, 2012 (edited) Interesting; I didn't know select returned an @menu variable. I really should read the manual lmao. found it 'This function is a handy replacement for 'menu' for some specific cases where you don't want a complex label structure - like, for example, asking simple yes- no questions. It will return the number of menu option picked, starting with 1. Like 'menu', it will also set the variable @menu to contain the option the user picked.' Edited October 12, 2012 by garet999 Quote
Question
Ajjwidjdneidjenw
Just wondering it was possible to do something like this, instead of defining cases indifidually. I am currently unable to test, hence I'm asking.
edit:
There we go.
Edited by garet9992 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.