|
miischi Beginner
Joined: 04 Jan 2009 Posts: 20
|
Posted: Sat Mar 28, 2015 7:27 am
[Alias] Alias including parameters |
Hey!
Yes, it's me again. Sadly I'm not a scripting genius.. In my MUD I have a spell / miracle I'd like to alias, looking like this:
Code: |
Usage: pchannel <miracle> <args> with <priest> |
My problem is that the <args> is not always needed and if used, it may consist of a varying number of words, here's a few examples:
Code: |
pchannel cure with friend
pchannel cure friend2 with friend
pchannel cure large human with friend
pchannel cure green-eyed upnosed male elf with friend |
Is there any way to solve this so that I am able to type something like this?
Code: |
pchan cure (args) friend |
Thanks a lot in advance!
- miischi |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Sat Mar 28, 2015 9:32 am |
#ALIAS pchan {
#IF (%numwords(%params)=1) {pchannel cure with %params} {
$friend=%word(%params, %numwords(%params))
$friend2=%expandlist(%delitem(%numwords(%params), %replace(%params, " ", "|")))
pchannel cure $friend2 with $friend
}}
Untested, but I think that should work. |
|
_________________ Discord: Shalimarwildcat |
|
|
|
miischi Beginner
Joined: 04 Jan 2009 Posts: 20
|
Posted: Sat Mar 28, 2015 10:32 pm |
Thanks for the fast reply! Turns out whenever you write these things to a forum and think you provided all needed information, you didn't.
Besides it was late and apparently I couldn't think of this stuff earlier, my apologies.
And having found a solution for my alias myself right now, I feel so stupid to have bothered you with this.
The missing information was: My MUD limits me in a way, so I can only channel stuff to people I established a mental link to, meaning targetting
others besides the linked one is impossible without relinking to someone else.
--> Since I'm already using a variable based targetting system I just created aliases + triggers that would put the one I'm linked to and the <args> part in variables, leaving
me with a super easy alias..
Code: |
#if (%2 = "t") {
pchannel %1 @ctarget with @fcon
} {
pchannel %0 with @fcon
} |
Probably could be more elegant but works for now :)
Thanks for your time and effort! |
|
|
|
|
|
|
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
|
|