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


Joined: 05 Jan 2017
Posts: 4

PostPosted: Thu Jan 05, 2017 10:09 pm   

Newbie Alias/Variable question, coming from Zmud
 
In Zmud I had a very very basic alias, that I cannot for the life of me replicate in CMud

#ALIAS k {#VAR target %1;kill @target;speed up}

In Zmud, I could type k rabbit, and it would send the following
kill rabbit
speed up

I could then type k all by itself, and it would repeat the above
kill rabbit
speed up

however in CMUD it overwrites the variable with a null value if I re-send the command without a parameter.
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Fri Jan 06, 2017 2:48 am   
 
You could just check if %1 is not null before overwriting your variable:
Code:
#alias k {#IF (%1 != %null) {#VAR target %1};kill @target;speed up}
Reply with quote
SomeGuy
Newbie


Joined: 05 Jan 2017
Posts: 4

PostPosted: Fri Jan 06, 2017 2:00 pm   
 
Daern wrote:
You could just check if %1 is not null before overwriting your variable:
Code:
#alias k {#IF (%1 != %null) {#VAR target %1};kill @target;speed up}


That's exactly what I would like to do, but when trying to use your code it errors on having an Extra Brace.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Fri Jan 06, 2017 3:27 pm   
 
No brace issue in his code....
Did you enter it on the command line, or try to insert it into your preexisting alias?
_________________
Discord: Shalimarwildcat
Reply with quote
SomeGuy
Newbie


Joined: 05 Jan 2017
Posts: 4

PostPosted: Fri Jan 06, 2017 3:39 pm   
 
shalimar wrote:
No brace issue in his code....
Did you enter it on the command line, or try to insert it into your preexisting alias?


I pasted it to the command line, and got this error screen.

Reply with quote
SomeGuy
Newbie


Joined: 05 Jan 2017
Posts: 4

PostPosted: Fri Jan 06, 2017 3:43 pm   
 
Ok, I resolved it this way.

#ALIAS k {#IF (%1 != %null) {#VAR target %1;kill %1;speed up};{kill @target;speed up}}

I tested and it's working now.

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