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
mudman
Beginner


Joined: 23 Jun 2002
Posts: 13

PostPosted: Sun Jul 07, 2002 10:35 pm   

Flee Script Problem
 
I've been trying to create a flee script that triggers on "You flee from combat!". It will be used to re-adjust your position on the map to your actual position. This is how it's supposed to work:

1. I flee..."You flee from combat!" is displayed.
2. A list of all the PKers in the MUD are put into a stringlist variable (this could have been done right when I entered the MUD using the "who pk" command). Incase I did not have the PKer that attacked me in the list, the "who pk" command is triggered when I flee.
3. A trigger is made with those names. Like this: #TRIGGER {({@PKList})}
4. It will scan all the directions sequentially. Such as NORTH first, SOUTH second, EAST third, WEST fourth, UP fifth, and DOWN last.
5. If the trigger of the PKers is set off at while scanning EAST, for example, WEST, UP, and DOWN will not be scanned.
6. Your location will then be re-adjusted to the direction OPPOSITE to that of what you scanned.

When I type "who pk" this is how the PKers look ->
[ Drow ] <PK> Sercavantie the Knight of Brimstone

The following is how I'm am currently trying to attempt this:

#VAR TheDirection
#VAR MoveDirection

#TRIGGER {] <PK> &%wPK} {#ADDITEM PKList @PK}
#TRIGGER {You flee from combat!} {who pk;#TRIGGER {({@PKList})} {MoveDirection=@TheDirection};TheDirection=south;scan north;TheDirection=west;scan east;TheDirection=north;scan south;TheDirection=east;scan west;TheDirection=down;scan up;TheDirection=up;scan down;#MOVE @MoveDirection}

The problem is obvious. My position will always be moved UP. This is because up will ALWAYS be set to TheDirection. What I need to figure out what to do is ignore the rest after it is triggered, then everything would be great. Any help would be great. Thanks.
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Sun Jul 07, 2002 11:20 pm   
 
Your concept won't overly work if the pk'er moves on you.

I'd recommend you rely on more solid evidence of your movement such as the room
you were in and the room you are in now. That or ignore what is going on vis a vis
the map and pk / flee from the individual. Can you take the time hit to figure out
your position vs. figuring out where you fleed from and going after him/her again?

Finished script forum examples:
Hernan's
Eiekal's
vrsoft's

and flee script discussions at (found with search all forums on "flee script")
using map example
backstab flee example



Ton Diening
Providing untested answers that tend to be
more complicated than others.
Reply with quote
mudman
Beginner


Joined: 23 Jun 2002
Posts: 13

PostPosted: Mon Jul 08, 2002 12:08 am   
 
I have no problem with them moving into my room because since my character is an elf, the attacker has no idea which way I flee. They have to scan all directions, then they have to process it (always the slowest part for me ;P). Anyway, this is simple...I hate complicated scripts that take a while to process. This one is fast. Oh and by the way...I know of all these "Other" scripts that seem to do everything except rid the world of disease. Please just help me with MY problem. Thanks.
Reply with quote
iljhar
GURU


Joined: 10 Oct 2000
Posts: 1116
Location: USA

PostPosted: Mon Jul 08, 2002 6:58 am   
 
It sounds like you're using the mapper, since you mentioned re-adjusting your position, so why wouldn't any of the script examples TonDiening gave work?

In any case, to make this work how you want it, then try this, have a few variables:

#var forwarddirs {north|south|east|west|up|down}
#var backdirs {south|north|west|east|down|up}
#var counter 1
#var found 0

Then have 2 aliases:

#alias reset {#var counter 0;#var found 0}
#alias scandir {scan %item(@forwarddirs, @counter);#if (@counter<7) {#alarm +1 {#if (@found=0) {#add counter 1;scandir} {reset}}} {#say Lost the target!;reset}}

Then umm...2 triggers:

#trigger {You flee from combat!} {#var counter 1;who pk;scandir}
#trigger {({@PKList})} {#var found 1;%item(@backdirs, @counter)}


If there's output when you scan, then you can get rid of the alarm and put in a temporary trigger. Something like this:

#trigger {You start to scan:} {#temp {YourPromptGoesHere} {#if (@found=0) {#add counter 1;scandir}

And change the scandir alias to this:

#alias scandir {#if (@counter<7) {scan %item(@forwarddirs, @counter)} {#say Lost the target!;reset}}

All untested, use at your own risk.

Iljhar
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