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
Crymson4
Novice


Joined: 20 Nov 2001
Posts: 35
Location: USA

PostPosted: Tue Nov 20, 2001 12:41 am   

Multiple Instances of the same variable?
 
I'm trying to keep my current gold amount stored in memory at all times.

The current trigger I have set up is

<%1G
to which the command is
#VAR CurGold %1

My problem is that instead of updating @CurGold with the new amount, it just creates another CurGold variable. Any ideas on why, or how to rectify it?

Thanks,

-Crymson
Reply with quote
decantor
Apprentice


Joined: 14 Nov 2001
Posts: 100

PostPosted: Tue Nov 20, 2001 3:21 am   
 
#TRIGGER {<(%d)G} {#VAR CurGold %1}

I would also consider using a different character besides "<" to lead into the trigger, as zmud might parse it on you.

Whenever you are triggering off something, whether it is a number, word, letter or whatever and want to assign it to another part of the function, always use the umm.. 'lettered character'(%d for numbers,
%w for words, etc.), and then refer back to them in the command portion of the action with the 'numbered character' (%1, %2, etc.). This way zmud won't wig out on you nearly as much.

I'm also sorry that that sounds far more confusing than it actually is.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Nov 22, 2001 12:05 pm   
 
A perfect example for this problem is presented in the trigger patters page of the help. #TRIGGER {You have &%d{Gold}gp} Also on the same page you will see something about using the quote character to match special pattern characters. < qualifies as a special character generally and just to be safe should be prefaced with the quote character. So you want your trigger pattern to be: ~<&%d{CurGold}G
You may also want this pattern to detect only at the start or end of line. Just a few options for ya.
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