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


Joined: 13 Mar 2004
Posts: 2

PostPosted: Sat Mar 13, 2004 2:34 am   

trigger math variable problem
 
ok i fight in big groups and i dont have time to change eq
so when i kill something i want a trigger to check if the xp was more than what i need to get

this is what i have so far
#trigger You receive &xp of %2 experience points
score
that works fine

#trigger Exp needed: &%*tot Exp Total: %5
#MATH &res (@tot-@XP)
#If {@res < 0, lev, fig}

variables res tot and xp
aliases lev and fight
i cant get the res variable to get a value
what am i doing wrong?
Reply with quote
mr_jacks_1
Newbie


Joined: 13 Mar 2004
Posts: 2

PostPosted: Sat Mar 13, 2004 2:48 am   
 
ok i fixed it i took the math out and done a big if comand
%if(@tot>@xp,"fig",%if(@tot<@xp,"lev"))
it works perfectly
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Mar 13, 2004 3:38 am   
 
You were doing two things wrong. The first was using &res instead of res as the variable name in the #MATH command.

The second was attempting to use the syntax from the %if function with the #IF command. The #IF command would be more suitable but only if you use the correct syntax with it.

You also have some overly broad wildcards and are misusing the %1-%99 syntax. It's clear that all your wildcards in these two triggers are intended to match numbers, so either %d or %n would be a better choice than * (which is the default for &xp and %2) or %* (which you used with &tot). The best choice is probably %n.

%1-%99 are intended for use in the Value section of triggers, not the pattern section. They will work in the pattern, but should be in the correct order. Since your second trigger only saves two parameters in the pattern it shouldn't use %5. You don't use that value, so it doesn't actually even need to be in the pattern.

Another solution:
Pattern: You receive &%nxp of %n experience points
Value: score

Pattern: Exp needed: &%ntot
Value: #IF (@tot <= @xp) {lev} {fight}}
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