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


Joined: 04 Jan 2009
Posts: 20

PostPosted: Mon Feb 16, 2015 10:14 pm   

[ALIAS] Multiple #IF in an alias? [Solved]
 
Hey.

I could need some help to create an alias if possible. I have a current alias I want to extend in order to have it more elegant and slim. The current alias contains this:


Code:
#if (%2 = "1" or %2 = "2" or %2 = "3" or %2 = "4") {
  shoot %1 at @{e%2}
} {
  shoot %1 at %2
}
lb



%1 is meant for the direction, ie. north, northeast, east, etc.. so I have to type 'sh north 1'


The thing I'd like to do now is to save me typing the whole direction every time, meaning I'd like to type 'ne' instead of 'northeast', letting me type 'sh n 1' instead of the above.
The only thing I currently can think of to solve this is another 'set' of #IF for every direction. Does either of you know a more elegant method? The '#IF I have in mind would look like this:

Code:
#if (%1 = "n") {
 shoot north at %2
} {
 shoot %1 at %2
}

More #if ...



I'd be thankful if either of you could help me solve this!


- miischi


Last edited by miischi on Tue Feb 17, 2015 5:45 am; edited 1 time in total
Reply with quote
shalimar
GURU


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

PostPosted: Tue Feb 17, 2015 5:23 am   
 
%reversedir(%reversedir(%1), 1)
that will give you the 'long' form of the direction
_________________
Discord: Shalimarwildcat
Reply with quote
miischi
Beginner


Joined: 04 Jan 2009
Posts: 20

PostPosted: Tue Feb 17, 2015 5:38 am   
 
So in the end I won't need to set up another set of #IF but just replace the %1 in my alias with it, the final looking like this?

Code:
#if (%2 = "1" or %2 = "2" or %2 = "3" or %2 = "4") {
  shoot %reversedir(%reversedir(%1), 1) at @{e%2}
} {
  shoot %reversedir(%reversedir(%1), 1) at %2
}
lb


That's making things really simple, thanks a lot!
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