Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
fhqwhgad
Novice


Joined: 07 Feb 2005
Posts: 38

PostPosted: Sat Dec 22, 2007 3:01 pm   

variables and how to add them together
 
Hi,
When building, i am getting alittle sick of "south dig 1234;south". Instead i would like to combine it in a simple south command. However, i would like it to automaticly add 1 to the number everytime i use the command.
I tried setting up a variable called room, and then putting this in my alias:
@room = @room +1;
#send south dig @room;
#send south;

it didn't work though. It keeps giving me an error on the @room line. I've tried reading the various variable helps, but i can't seem to figure it out. I need the variable to be readable from other aliases aswell (north, east, west, etc) so a local variable wont work either (i guess).
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Sat Dec 22, 2007 3:49 pm   
 
You need to assign the variable correctly. zMUD was lazy about allowing
@var = value
when it should be
var = value

CMUD is more strict

The following should work
Code:
#ALIAS dig {room = @room +1;%-1 dig @room;%-1}


Then you can 'dig south' and it'll dig and move you south
You could also dig east, west, north, up, down, wherever and it'll work
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
fhqwhgad
Novice


Joined: 07 Feb 2005
Posts: 38

PostPosted: Sat Dec 22, 2007 6:02 pm   
 
Guinn wrote:
You need to assign the variable correctly. zMUD was lazy about allowing
@var = value
when it should be
var = value

CMUD is more strict

The following should work
Code:
#ALIAS dig {room = @room +1;%-1 dig @room;%-1}


Then you can 'dig south' and it'll dig and move you south
You could also dig east, west, north, up, down, wherever and it'll work

Thank you, this works like a charm.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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