|
miischi Beginner
Joined: 04 Jan 2009 Posts: 20
|
Posted: 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 |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4689 Location: Pensacola, FL, USA
|
Posted: Tue Feb 17, 2015 5:23 am |
%reversedir(%reversedir(%1), 1)
that will give you the 'long' form of the direction |
|
_________________ Discord: Shalimarwildcat |
|
|
|
miischi Beginner
Joined: 04 Jan 2009 Posts: 20
|
Posted: 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! |
|
|
|
|
|