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
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Mon Feb 28, 2005 1:08 pm   

Aliases in reverse (sort of), and target variables
 
Two part question...

I have a list of mobs to attack, mobList.
Whenever I see any of these mobs I'd like to put them into a target variable. This I've done, using
#TRIGGER {({@mobList})} {target = %1}

What I now want to be able to do it 'attack t', which would attack the target. The only problem is that I wouldn't just have a single 'attack' command, it might be punch, kick, bite, grab, headbutt, whatever.

So question is, is it possible to have an alias that effectively does
#ALIAS "%-1 t" {%-1 @target}


Second part,
Once I've killed the target I will look and see what is left in the room. I might then see:

zombie, giant spider, corpse of skeleton

Assume that zombie, giant spider and skeleton are items in @mobList then 'target' will first take the value 'zombie', then 'giant spider', then 'skeleton' as it matches them one after the other.

Problem then is if I attack @target then I'll be trying to attack a corpse.

So the question is how to have it recognise any item in @mobList unless it's prefixed by 'corpse of'.

Thanks in advance to any that can help.

Guinn
Reply with quote
megamog75
Enchanter


Joined: 20 Nov 2002
Posts: 627
Location: USA

PostPosted: Mon Feb 28, 2005 4:40 pm   
 
#trigger {^({ might do the trick if it'a at the begginning of a line
or
#trigger {(%w) (%w) ({@moblist})} { #if (%1 %2)=(corpse of) {#noop} {what ever}}

the alias uses the first word, but you could just set up different aliases like so:
#alias pu-t {punch @target}
or an "ONINPUT" trigger like this would do it:
#ONINPUT {^(%w) t$} {%1 @target}
or make buttons like I do that automaticaly do what you want by hitting the button

hope this helps
_________________
megamog75 Smile
I will do this.Nothing in my life matters except this.No moment in my life exists except this moment.I am born in this moment, and if I fail, I will die in this moment. Raistlin Majere
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Wed Mar 02, 2005 7:41 pm   
 
The problem with an #oninput trigger is that if I do
#ONINPUT {^(%w) t$} {#IF (@target != %null) {%1 @target} {#NOOP}}

then if @target is null then the trigger does nothing, but zmud still sends '%1 t' to the mud, which means I often end up attacking the first thing with a 't' in the name
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Wed Mar 02, 2005 10:21 pm   
 
Well the #oninput help file is lovely :P

#ONINPUT {^(%w) t$} {#GAG;#IF (@target != %null) {%1 @target} {#NOOP}}
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Thu Mar 03, 2005 12:31 pm   
 
<blush>
Sorry, assumed gag was only for mud output, not player input.
Point taken though, will read more carefully next time around.

Any ideas on the second part? Having a match unless the preceding words are 'corpse of'

Thanks
Guinn
Reply with quote
tyh
Beginner


Joined: 01 Feb 2004
Posts: 24
Location: United Kingdom

PostPosted: Thu Mar 03, 2005 2:45 pm   
 
wish I had a button that did whatever i wanted if i pressed it
_________________
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Thu Mar 03, 2005 3:49 pm   
 
Quote:
Any ideas on the second part? Having a match unless the preceding words are 'corpse of'?

Code:
#REGEX {(?<!corpse of )(@moblist)} {target = %1}


the (?<!corpse of ) construct is "a zero-width negative lookbehind assertion" with makes it so that (@moblist) wont
match if preceded by 'corpse of '.

http://www.perl.com/doc/manual/html/pod/perlre.html
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Thu Mar 03, 2005 4:20 pm   
 
Dharkael, many thanks, that works a treat.

Tyh, not so sure if it was an attempt at being helpful, funny or sarcastic, but if I ever find that magic button you're after I'll let you know. Til then you just keep up the good work kid, you're an ass...et to the forums.

Or alternatively, I wish I could make a button that would make your mother consider late term abortion. Take your pick.

Guinn. Forever helpful
Reply with quote
megamog75
Enchanter


Joined: 20 Nov 2002
Posts: 627
Location: USA

PostPosted: Fri Mar 04, 2005 3:27 pm   
 
Hey now, that is not what these forums are for, you might be able to do that on other forums but Zugg soft is for learning and the development of better game play.

Not to mention that you could get you topic locked, delete, and be banned from the site, and I even heard a rumor that you Zmud license could be revoked. so please remind yourself that squabbling is for chickens, and post only if you have something to contribute.

On that note hope you got everything cleared up with your question.
_________________
megamog75 Smile
I will do this.Nothing in my life matters except this.No moment in my life exists except this moment.I am born in this moment, and if I fail, I will die in this moment. Raistlin Majere
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Fri Mar 04, 2005 3:44 pm   
 
<sheepish>Bah, just a bit of harmless banter - simply replying to one unhelpful comment with another.</sheepish>
But yes, enough of that
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