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
Oblivion2914
Newbie


Joined: 01 Sep 2004
Posts: 1

PostPosted: Wed Sep 01, 2004 1:19 pm   

I could use some expert advice on this...
 
I have run into a problem, I was making a script and I want to use a range of numbers to idenntify a certain spell, what I have are as follows.

#TRIGGER {Completed mixture power is: [221-686]} {#say;#say %ansi( red, hi)With the current power you will create: Magic Bomb}
#TRIGGER {Completed mixture power is: [1-10]} {#say;#say %ansi( red, hi)With the current power you will create: Awaken}
#TRIGGER {Completed mixture power is: [11-20]} {#say;#say %ansi( red, hi)With the current power you will create: Cause Light}
#TRIGGER {Completed mixture power is: [21-30]} {#say;#say %ansi( red, hi)With the current power you will create: Detect Invisibility}
#TRIGGER {Completed mixture power is: [31-40]} {#say;#say %ansi( red, hi)With the current power you will create: Reveal}
#TRIGGER {Completed mixture power is: [41-50]} {#say;#say %ansi( red, hi)With the current power you will create: Cure Light}
#TRIGGER {Completed mixture power is: [51-60]} {#say;#say %ansi( red, hi)With the current power you will create: Refresh}
#TRIGGER {Completed mixture power is: [<0]} {#say;#say %ansi( red, hi)FATAL ERROR!}
#TRIGGER {Completed mixture power is: [71-85]} {#say;#say %ansi( red, hi)With the current power you will create: Sense Life}
#TRIGGER {Completed mixture power is: [106-115]} {#say;#say %ansi( red, hi)With the current power you will create: Cure Poison}
#TRIGGER {Completed mixture power is: [116-135]} {#say;#say %ansi( red, hi)With the current power you will create: Blindness}
#TRIGGER {Completed mixture power is: [136-145]} {#say;#say %ansi( red, hi)With the current power you will create: Death Grip}
#TRIGGER {Completed mixture power is: [146-155]} {#say;#say %ansi( red, hi)With the current power you will create: Fatigue}
#TRIGGER {Completed mixture power is: [156-170]} {#say;#say %ansi( red, hi)With the current power you will create: Cure Disease}
#TRIGGER {Completed mixture power is: [171-185]} {#say;#say %ansi( red, hi)With the current power you will create: Charm}
#TRIGGER {Completed mixture power is: [186-200]} {#say;#say %ansi( red, hi)With the current power you will create: Flame Wind}
#TRIGGER {Completed mixture power is: [201-220]} {#say;#say %ansi( red, hi)With the current power you will create: High Explosive}
#TRIGGER {Completed mixture power is: [>686]} {#say;#say %ansi( red, hi)FATAL ERROR!}

How would I make it so my triggers would recognize and number within those ranges? Then set off the appropriate trigger. Thanks.
Reply with quote
Morgoth
Beginner


Joined: 07 Apr 2004
Posts: 12
Location: Israel

PostPosted: Wed Sep 01, 2004 2:13 pm   
 
#TRIGGER {Completed mixture power is: ~[(%w)~]} {
#If (%w < 10) {{#say;#say %ansi( red, hi)With the current power you will create: Awaken};#If (%w > 10 AND %w < 21) {{#say;#say %ansi( red, hi)With the current power you will create: Cause Light}


And so forth. Hopefully that will work. It's kind of messy though, I'm sure someone else could come up with something with something better.
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Wed Sep 01, 2004 2:26 pm   
 
I'm not positive what you're trying to do. If you want to reference the explicit number given then this should work:

#TRIGGER {Completed mixture power is: ([146 - 155])} {#SAY;#SAY %ansi( red, hi)With the current power you will create: Fatigue;#SHOW %1}

%1 will hold the value of the number.


I don't like a bunch of triggers active all the time so I'd rewrite this I think...

#VAR effect {} {}
#TRIGGER {Completed mixture power is: (%d)} {#IF (0 < %1 AND %1 < 11) {effect="Awaken"} {};#IF (10 < %1 AND %1 < 21) {effect="Cause Light"} {};~;Continue with ranges here.;#IF (0 > %1 OR %1 > 686) {effect="FATAL ERROR!} {};#SAY;#SAY %ansi( red, hi)With the current power you will create @effect with power %1}

If neither of these are what you want, please clarify what the problem is.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Sep 01, 2004 11:32 pm   
 
The range wildcard, [range] doesn't allow you to specify numeric ranges that are more than one digit. Thus, [221-686] doesn't mean match any number between 221 and 686 inclusive. It means match any string containing only the characters 2, 2, 1-6, 8, and 6. 1-6 is a range containing all the numbers from 1 to 6, so this matches any string containing only the characters 1, 2, 3, 4, 5, 6, and 8.

You'll have to use %d or %n, then do comparisons with #IF or something similar.
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
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