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


Joined: 07 Dec 2003
Posts: 7
Location: USA

PostPosted: Sun Dec 07, 2003 5:54 am   

Trigger Problems
 
I am trying to get a trigger work on the evaluation of mana < 25% of maxmana. I have tried all sort of setups, but have had no luck. I have read the online help and tutorials with no luck. Is there a better reference than the tutorials?

I have tried
@mana < @maxmana * .25 and that expands to mana value < max mana value abc 123 xyz .25
I tried #math (@maxmana * .25) with no luck and a host of others.
I am really confused.

Or is there a better way to trigger on this. I do not want to hard code a value as mana and hp change as I level up.

Suggestions?[V]
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Dec 07, 2003 6:52 am   
 
zMUD usually uses integer math. Any of these should work:
@mana * 4 < @maxmana
@mana < @maxmana/4
@maxmana/@mana < 4
@mana < (@maxmana * 25)/100
(@mana * 100)/25 < @maxmana
(@mana * 100) < (@maxmana * 25)
(@mana * 100)/@maxmana < 25

There are many other possible variations, of course.

These would all be used as the condition of an #IF command in the VALUE (commands) portion of the trigger, not in the pattern.
Reply with quote
drider1969
Newbie


Joined: 07 Dec 2003
Posts: 7
Location: USA

PostPosted: Sun Dec 07, 2003 6:59 pm   
 
How would I have it trigger on low mana. That is what I am seeking or at least trying to figure out.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Dec 07, 2003 7:34 pm   
 
That depends on the pattern. I'll assume the following mudprompt:
1000/1000hp 1000/1000ma 1000/1000mv
The numbers will change, of course. hp is hitpoints, ma is mana, and mv is moves. The first number in each pair represents the current amount, which might occasionally be negative. The second number represents the maximum which should always be positive. Thus, current mana is the third number and maximum mana is the fourth.

#TR {(%n)/(%d)hp (%n)/(%d)ma (%n)/(%d)mv} {#IF ((%3 * 4) < %4) {#SAY Low mana}} {} {prompt}
Reply with quote
drider1969
Newbie


Joined: 07 Dec 2003
Posts: 7
Location: USA

PostPosted: Sun Dec 07, 2003 7:47 pm   
 
Thanks Lightbulb Very Happy

I will look at this method. Currently I have hp, maxhp, mana, maxmana, move, and maxmove vars being captured automagically. What I tried to do maxmana as the trigger expression versus triggering on the command line. Which is the proper way or are both methods correct. Also, can I still use both methods together?

Thx
Drider
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Dec 08, 2003 4:19 pm   
 
Expression triggers are very tricky. Either method is correct, if done correctly, but you have a much better chance of doing it correctly with a standard (MUD output) trigger.
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