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


Joined: 24 Feb 2003
Posts: 5
Location: USA

PostPosted: Thu Feb 27, 2003 8:01 am   

Need help creating a function
 
In my stats monitoring, I want to keep track of when my maximums change. So I wind up with tons of statements like:

#TRIGGER {HP:....} {... #IF (@oldmaxhp != @maxhp) { #ECHO Your MaxHP just changed from @oldmaxhp to @maxhp}}

I'd like to reduce these to one function so I can say something like:
@checkValueChange(@oldmaxhp,@maxhp,"MaxHP")

and @checkValueChange would be defined something like this:
#FUNC checkValueChange { #IF (%1 != %2) { #ECHO Your %3 changed from %1 to %2 }}

But trying something like that directly just winds up sending strings to the mud that are an expansion of my function rather than actually executing my function. I played around with various combinations of #EXEC and #EVAL and couldn't get that to do what I am trying to do either.

This seems so basic, so I think I am just missing a big Zmud concept. If anyone can enlighten me, I'd be extremely grateful.

Thanks,
-Valodin
Reply with quote
wilh
Wanderer


Joined: 08 Feb 2001
Posts: 89
Location: USA

PostPosted: Thu Feb 27, 2003 8:53 am   
 
What you're looking to do is not the role of a function in zMUD. Functions in zScript are more like Pascal functions than C functions if you're a programmer.. Functions return values. Since you just want to execute some code, an alias is more appropriate here. Just change your function to be an alias, and you should be good to go.

Wil

Wil Hunt
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