Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Nabisco
Newbie


Joined: 14 Feb 2003
Posts: 6
Location: Australia

PostPosted: Mon Dec 08, 2003 10:36 am   

better way to do something done with nested if ?
 
currently on a few buttons ive got this stupidly long nested if thingy, and was wondering if theres a better way to do it
ive got § as my var char and ¤ as command
this is what ive got as the caption for a button, as the var increases, itll change from say L#M : tyro (3) to L#M : novice (11) etc, and well zmud kind of dies when i edit the class script of the class ive got the buttons stored in so i figure its probably a tad too long :d
L#M : %if( §languagemagic>1699, AGAAWEL, %if( §languagemagic>1399, Legendary, %if( §languagemagic>1199, Virtuoso, %if( §languagemagic>1039, 2nd to None, %if( §languagemagic>919, High Master, %if( §languagemagic>824, OOTVB, %if( §languagemagic>739, Adept, %if( §languagemagic>659, OOTB, %if( §languagemagic>584, Master, %if( §languagemagic>514, Superb, %if( §languagemagic>449, Expert, %if( §languagemagic>389, Excellent, %if( §languagemagic>334, Very Good, %if( §languagemagic>284, Adroit, %if( §languagemagic>239, Good, %if( §languagemagic>199, Proficient, %if( §languagemagic>164, Fair, %if( §languagemagic>134, Able, %if( §languagemagic>109, Above Average, %if( §languagemagic>89, Average, %if( §languagemagic>69, Below Average, %if( §languagemagic>49, Not Very Good, %if( §languagemagic>29, Poor, %if( §languagemagic>17, Beginner, %if( §languagemagic>9, Novice, %if( §languagemagic>3, Tyro, Unskilled)))))))))))))))))))))))))) (§languagemagic)
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Dec 08, 2003 4:06 pm   
 
1. Don't edit the CLASS script. If you want to edit a button, edit the BUTTON. I realize that's a little inconvenient since the Caption field is a single-line box. The solution is to right-click, Select All, Copy and paste it into the Editor (not the settings editor), do your editing, then Paste the edited version back into the Caption field.

2. If you think the caption is too long, do the calculation elsewhere (in the trigger which captures the value, for instance) and put the result in another variable, and use the new variable in your caption.
Caption: L#M : §lmcaption
#VAR lmcaption {%if( §languagemagic>1699, AGAAWEL, %if( §languagemagic>1399, Legendary, %if( §languagemagic>1199, Virtuoso, %if( §languagemagic>1039, 2nd to None, %if( §languagemagic>919, High Master, %if( §languagemagic>824, OOTVB, %if( §languagemagic>739, Adept, %if( §languagemagic>659, OOTB, %if( §languagemagic>584, Master, %if( §languagemagic>514, Superb, %if( §languagemagic>449, Expert, %if( §languagemagic>389, Excellent, %if( §languagemagic>334, Very Good, %if( §languagemagic>284, Adroit, %if( §languagemagic>239, Good, %if( §languagemagic>199, Proficient, %if( §languagemagic>164, Fair, %if( §languagemagic>134, Able, %if( §languagemagic>109, Above Average, %if( §languagemagic>89, Average, %if( §languagemagic>69, Below Average, %if( §languagemagic>49, Not Very Good, %if( §languagemagic>29, Poor, %if( §languagemagic>17, Beginner, %if( §languagemagic>9, Novice, %if( §languagemagic>3, Tyro, Unskilled)))))))))))))))))))))))))) (§languagemagic)}
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net