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
xaosvilin
Novice


Joined: 08 Jun 2004
Posts: 36

PostPosted: Wed Oct 20, 2004 3:25 am   

Assigning direction to #var question.
 
Ok, was doing a bit of research and found a thread about auto fleeing. So i've copied the code, and understand it, i'll paste it here.

#VAR flee {south;east}
#TR {~<Health (%n)/%d} {#IF ((%1 < 700 AND (@lowhp = 0)) {#VAR lowhp 1;#EXEC @flee}} {} {prompt|nocr}

I wanted to change the variable to, #var flee {@direction}

And then set the direction based on this trigger.

#trigger fleecap {There are exits %w and %w.} {#var direction %1;#var direction %2}

Now i know this is going to be screwy.. so what I was wondering, how would I make it decide to go in one direction away from combat? for instance, I'm not sure if the first %w will be the direction I want to go away from combat?

Bah i hope this makes sense to someone.. thanks for the help in advance.
_________________
Reply with quote
xaosvilin
Novice


Joined: 08 Jun 2004
Posts: 36

PostPosted: Thu Oct 21, 2004 2:13 am   
 
Actually, after thinking about it, I could just use the #backup function a couple of times..
_________________
Reply with quote
ttsang
Newbie


Joined: 17 Oct 2004
Posts: 4
Location: Canada

PostPosted: Thu Oct 21, 2004 12:01 pm   
 
// I perfer use array. but i can show the basic one
PATTEN :
There are exits %1.

COMMAND :

// Variable Direction is the list of direction u current have
Direction=%trim(%replace( @Direction, "and", "|"))
Direction=%replace( @Direction, ",", "|")
Direction=%replace( @Direction, " ")

// Variable DirectionList reserve for escaping form combat later
DirectionList=""
#ADDKEY {DirectionList} {east} {west}
#ADDKEY {DirectionList} {south} {north}
#ADDKEY {DirectionList} {west} {east}
#ADDKEY {DirectionList} {north} {south}
#ADDKEY {DirectionList} {northeast} {southwest}
#ADDKEY {DirectionList} {northwest} {southeast}
#ADDKEY {DirectionList} {northup} {southdown}
#ADDKEY {DirectionList} {northdown} {southup}
#ADDKEY {DirectionList} {eastup} {westdown}
#ADDKEY {DirectionList} {eastdown} {westup}
#ADDKEY {DirectionList} {up} {down}

// Variable TrialDirection is the rnadom exit u will have
TrialDirection=@{Direction.%random( 1, %numitems( @Direction))}


When u detected u enter combat
#EXE %db( @DirectionList, @TrialDirection))
_________________
Timothy C. Tsang
Specialization in Actuarial Science
The University of Western Ontario
London, Ontario, Canada
ttsang5@uwo.ca
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