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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Liath
Novice


Joined: 25 Aug 2009
Posts: 38

PostPosted: Sat Sep 05, 2009 6:20 pm   

Alias help for spell-casting
 
Hey there,

I play on Aardwolf MUD, which uses a single-quote character (') to group separate words into one entity; such as a spell Gaias Revenge being cast as "cast 'Gaias Revenge' target" or "cast 'gaias revenge' 'a big bad mob' ".
It has been a couple years since I've used zMUD, and I'm getting back into it but I'm having issues with my cast alias:
Code:

Alias
Name: c
Value:
#VARIABLE temp {%1 %2 %3 %4 %5 %6 %7 %8}
#VARIABLE temp {%trim( @temp)}
#IF (%match( @temp, "'(*)' (%a)", lastspell, sptarget)) {#NOOP
  #ECHO 1} {#IF (%match( @temp, "'(*)'", lastspell)) {#VARIABLE sptarget {}
    #ECHO 2} {#IF (%match( @temp, "(%a) (%a)$", lastspell, sptarget)) {#NOOP
      #ECHO 3} {#IF (%match( @temp, "(%a)", lastspell)) {#VARIABLE sptarget {}
        #ECHO 4}}}}
#VARIABLE lastspell {%trim( @lastspell)}
#VARIABLE sptarget {%trim( @sptarget)}
cast ~'@lastspell~' @sptarget


The #ECHO commands are how I'm debugging the alias to see which pattern is firing. I'm pretty sure there is a much more elegant way to do this, but so far this is what I have come up with. Now the issue with it is this:

command:

c 'gaias revenge' self
c 'gaias revenge'
c gaias self
c gaias

output:

1
cast 'gaias revenge' self
2
cast 'gaias revenge'
2
cast 'gaias self'
2
cast 'gaias'

So, I dunno if my pattern-matching is all out-of-whack, or what, but it seems that the 2nd pattern is matching things I'm not wanting it to match. I've probably done something stupid and don't have my braces matching correctly or something, but I've read the script 800 times and I don't see anything wrong.
If anyone knows of a better way to accomplish what I'm trying to do, or knows why that pattern isn't matching, I'd love to find out!

Thanks!

p.s.: Without the %trim() there, the alias outputs 'gaias ' on #3 command. (there are multiple spaces after "gaias". Since the web doesn't 'do' multiple spaces, its not showing up)


Last edited by Liath on Sun Sep 06, 2009 3:00 am; edited 1 time in total
Reply with quote
Liath
Novice


Joined: 25 Aug 2009
Posts: 38

PostPosted: Sun Sep 06, 2009 2:58 am   Well, got it resolved using a different method
 
Wel, I got the issue resolved using 6 different oninput triggers... but I was hoping to use just the one alias.... plus, I still see no errors in the logic of what I was tryign to do there, so if anyone could explain to me why it isn't working, I'd really like to hear why!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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