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


Joined: 25 Jan 2002
Posts: 6

PostPosted: Wed Jan 30, 2002 10:40 am   

Adding variables
 
HI!!
Can someone explain me how to add two variables??
I want to do something like this:

#TR {You kill a troll.} {#VAR killedtrolls (@killedtrolls + 1)}
But instead of adding the variable turns to something like this:
killedtrolls
((((1+1)+1)+1)+1)

Can someone help me? Thanks.


Xosen
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed Jan 30, 2002 12:07 pm   
 
For your instance, you can use

#TR {You kill a troll.} {#ADD killedtrolls 1}

The other way would be to

#TR {You kill a troll.} {#VAR killedtrolls [@killedtrolls + 1]}

[] expand the number for you. Same with <>

Help files, search for expand "fill <@container>"




TonDiening
Uses 6.16
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Jan 30, 2002 5:20 pm   
 
Use #MATH instead of #VAR. This should even add up your old kills if you haven't changed the variable.
#TR {You kill a troll.} {#MATH killedtrolls (@killedtrolls + 1)}


LightBulb
All scripts untested unless otherwise noted
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