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


Joined: 11 May 2002
Posts: 2

PostPosted: Sat Jun 01, 2002 12:27 pm   

delete all variables
 
is there any way to clear out/delete all variables when connecting? some trigger i can set or anything?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Jun 01, 2002 2:05 pm   
 
You can put VAR commands in the atconnect alias. This alias is automatically executed on connection attempts. You will have to put one for each variable that you need to reset.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Jun 01, 2002 2:20 pm   
 
You can clear out variables by giving them a null default value. This would also need to be done for each variable you want reset. You can do this is in the settings editor by leaving the "Default" box blank and checking the box "Use Default value". It can also be done from the command line by using {} for the default value.
#VAR varname {value} {default-value}
#VAR test {this variable clears itself} {}

The default values are used when loading the character, so if you lose your connection and then reconnect (without closing the character) the variables won't reset. However, they can be forced to reset at any time with the #RESET command. If you want them to reset every time you reconnect you can just put the #RESET command in your atconnect alias.

LightBulb
Vague questions get vague answers
Reply with quote
razo
Newbie


Joined: 11 May 2002
Posts: 2

PostPosted: Sun Jun 02, 2002 12:44 pm   
 
ahh.. #RESET does what I need. The problem now is the way I have my trigger set up. It's a simple shake your hand type trigger with a counter to be sure ppl don't spam it.
I'm sure there's a better way to do this, but I'm just a newbie with triggers.
it looks like this:
Patter: (%w) shakes your hand.
Command: #IF (%alias(%1) >= 4) {#ADD %1 1} {shake %1; #ADD %1 1}

This creates a variable with the name of the person shaking my hand, and each subsequent time they shake it, it adds 1 to the variable, when the variable hits 4, it shuts off for that particular user. It's a dynamic thing, and to set the default value for each new person setting it off would be quite tedious. So is there some way I can have a global default value for my variables or anything without having to go through each variable and setting the default manually?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Jun 02, 2002 3:15 pm   
 
Yes, there is a way to do this. First you should get rid of all the variables from every previous run.

Next change your trigger thusly:
#IF (!%defined(%1)) {#VAR %1 {0} {0}};#IF (@{%1}>= 4) {#VAR %1 {%eval(@{%1}+1)} {0}} {shake %1;#VAR %1 {%eval(@{%1}+1)} {0}}

You can put the add's back after it has fixed all the variables, or if you did delete them then just add the first line.
Reply with quote
Evangelist
Adept


Joined: 10 Oct 2000
Posts: 224
Location: USA

PostPosted: Sun Jul 14, 2002 2:32 am   
 
when I need to get rid of a variable I use #UNVAR varname

Evangelist
www.phidar.com
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