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
Goten4233
Newbie


Joined: 20 Mar 2003
Posts: 8

PostPosted: Tue Jul 01, 2003 10:13 am   

Trigger help
 
Okay I'm trying to make a simple track bot when someone flees
track takes too long and has a wait timer, so I wanna make it a scan one instead. the scan messages work like this

[North]
   Target
[South]
   Target

I know how to make the person im fighting my variable @target all I need to know is how to make a trigger that checks both lines to pinpoint a char with a direction, help please.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Jul 01, 2003 10:58 am   
 
#TR {^~[(%w)~]} {#VAR Scandir %1}
#COND {@target} {@Scandir} {Within|Param=1}
Reply with quote
Goten4233
Newbie


Joined: 20 Mar 2003
Posts: 8

PostPosted: Tue Jul 01, 2003 2:03 pm   
 
I'd appreciate if you could explain how these work cause It's confusing me
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Jul 01, 2003 5:05 pm   
 
The trigger fires when you receive a line that starts with [, then has a single alpha word, followed by ]. That's designed to match the pattern of your sample directions. It captures the value of the alpha word to the variable @Scandir, then advances to the next state given in the condition.

The condition fires when text matching the value of @target is received on the next line. It then sends the value of @Scandir (the last direction or other text captured by the trigger). The trigger is then reset to the first state ready to trigger on the next direction whether the condition matched or not.

It seems fairly obvious to me. Which part did you actually find confusing?

On the other hand, while it works fine in testing it might not work in practice. You may get some directions with no targets which could mean the trigger won't be reset when the next direction is received. You might also have other targets in the same direction as your @target, and if @target isn't the FIRST one it'll be missed. However your sample scan indicates that only directions with targets will be shown and your question assumed ("a trigger that checks both lines") that your @target would be on the next line.
Reply with quote
Goten4233
Newbie


Joined: 20 Mar 2003
Posts: 8

PostPosted: Tue Jul 01, 2003 8:51 pm   
 
I was just showing the parsing and how exactly it looks, there can be multiple
I know how to make the enemy @enemy the second battle starts, and I want it to search for that whether he's one line or 3 in that section, #cond wasnt in the function or command wizard so it confused me where I enter it...care to explain please, sorry for the trouble
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Jul 01, 2003 11:19 pm   
 
Are you using @enemy or @target as your variable name, what do you mean by multiple do you mean there can be multiple enemies and variable names you want to scan for or that there can be more than one line after a scan and will the enemy that just fled be on the first line or not and #COND is in the command wizard but anyway you don't even have to use the command wizard to look things up in help so you could have looked it up anyway...and aren't runon sentences fun to read?

Since you can't predict how many lines will follow a direction, I'd recommend against using #CONDITION. That's also why I prefer ACTUAL examples from the MUD to MADE-UP examples that usually don't show everything that's needed to write a decent script.
#TR {^~[(%w)~]} #VAR Scandir %1}
#TR scantracker {@target} {@Scandir}

To save you the trouble of asking, "scantracker" is an ID which will allow you to easily disable the trigger (#T- scantracker) when you aren't actually trying to track someone. That way, you'll still be able to use scan normally when you want to.
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