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
mAdM0nK
Beginner


Joined: 17 Apr 2001
Posts: 14
Location: USA

PostPosted: Wed Nov 21, 2001 6:22 am   

empty a variable?
 
im trying to convert an mm script over to zmud, and there is an /empty command that i cant find a zmud equivalent for. anyone know the command that clears anything a variable is set to? i dont want to delete the variable just make it so its not set to anything?

Also im having problems with the #math command. Im trying to set up a trigger that will increase a variable by one, but the variable wont even set to a number.

Ive been messing with this for far too long tonight too. Here is what ive got so far.
http://www.ugc.net/bsrep2.txt
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Wed Nov 21, 2001 7:33 am   
 
The options for clearing a variable are:

#VAR blah %null
or
#VAR blah ""
or
blah = ""

To add just one (or more) to a number already in a variable just use the #ADD function:
#ADD blah 1

Or to use #MATH as in your case:
#MATH blah (@blah + 1)

Acaila
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Nov 21, 2001 10:08 pm   
 
Another way to clear a variable:
#VAR blah {}

LightBulb
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Nov 22, 2001 10:59 am   
 
And yet another way to add to a variable:
blah=%eval(@blah+1)

As for the trigger you may wis to review the trigger patterns to make sure you are capturing the information you want.
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Thu Nov 22, 2001 11:37 am   
 
I think the reason why you're having trouble adding to variables is because you are using the following alias:

#ALIAS bsclear {
#var @BsLine {};#var @TargPercent {};#var @TargCond {};#var @BsAttempts {0};#var @EBsAttempts {0};#var @BsHits {0};#var @EBsHits {0};#var @BsTwists {0};#var @EBsTwists {0};#var @TwistText {};#var @JustBsed {};#var @JustBsedMe {};#var @AmIDead {0};#var @EBsDam {0};#var @DamAve {0};#var @PercentDam {0};#var @PercentDamAve {0};#var @IAmDead {};#var @FootFall {0};#var @mult {};#var @EFshield {0};#var @EFsmessage {};#var @BSText {}}

When you do #VAR @.... {0} , then zMUD sees whatever is in that variable as a variable itself, and turn that to 0.

To clarify:
Suppose we have the following:
#VARIABLE Test {1}
#ALIAS {#VAR @Test 2}

When you call the alias, it will set the value of Test (namely 1) to 2. Seeing as there is no variable called 1, zMUD probably either creates it, or doesn't do anything.

If instead you had an alias:
#ALIAS {#VAR Test 2}

The result would be to correctly set the variable Test to 2.

So in short, I think removing all those "@" would fix your problem.

Also, I noticed #CHATALL and #EMOTEALL in your code. I don't think these are valid functions.

Acaila
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