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


Joined: 05 Dec 2002
Posts: 4
Location: USA

PostPosted: Tue Dec 09, 2003 2:50 pm   

Autotrack
 
I was trying to figure out a way to make my a three sniff autotrack trigger. I was going to use a list and have it add a direction everytime, and then count the number of each and if there's atleast two sniffs that are the same go that direction. I have done this by using an alias and comparing results of two seperate variables, but not one. Basic example:
track target
You sense a trail west from here!
You sense a trail east from here!
You sense a trail south from here!
-Failed safetrack, cycles again until it gets two like sniffs.
You sense a trail west from here!
You sense a trail west from here!
You sense a trail west from here!
-Successful, west then cycles again.

Oh, yes, I did search the forums for something like this before, but I figured someone could probably help me faster then I could find something that would be useful.
Stephen, Chuck
Reply with quote
megamog75
Enchanter


Joined: 20 Nov 2002
Posts: 627
Location: USA

PostPosted: Tue Dec 09, 2003 4:30 pm   
 
Sound slike your on the right track, Making two lists and comparing them would be good
_______________________________________________________________
-Failed safetrack, cycles again until it gets two like sniffs.
________________________________________________________________
Is it me or did you for get to tell us how you sniff, I will use 'sniff'


However if you just wanted to go the way you smell twice in a row then it would be something like this.

#trigger {You sense a trail (%w) from here!} {#if @smelldir="" {smelldir=%1} {#if @smelldir=%1 {%1;smelldir=""} {smelldir=%1;sniff}}}

Wich only works if you get two identical directions one after another
east
east

but what if you got
east
west
east

then you would need a list to comare to or possibly a countlist might do just fine, like so:

#TRIGGER {You sense a trail (%w) from here!} {#if %numitems(@SmellDir)=2 {#var SmellDir %additem(%1,@SmellDir);#VAR SmellDirFind %countlist(@SmellDir);#LOOPDB @SmellDirFind {#var SmellDirFound %additem(%val %key,@SmellDirFound)};#var SmellDirFound %replace(@SmellDirFound," ","|");#if %item(@SmellDirFound,1)>1 {%item(@SmellDirFound,2);SmellDirFound="";SmellDirFind="";Smelldir=""} {SmellDirFound="";SmellDirFind="";Smelldir="";sniff}} {#var SmellDir %additem(%1,@SmellDir);sniff}}
Reply with quote
Chuckiesrealm
Newbie


Joined: 05 Dec 2002
Posts: 4
Location: USA

PostPosted: Tue Dec 09, 2003 6:59 pm   
 
Found what I needed.. I was going to go with yours but I figured I'd play around with it a bit more and see if I could get it to work. It's a bit sloppy, but I haven't found any problems with it.:

#ALIAS strack {
#IF (%1) {#VAR target %1} {#VAR target %1~.%2}
#t+ strack
#VAR sniffs {}
track @target
track @target
track @target
}

#CLASS {track|strack}
#TRIGGER {^You sense a trail ({north|east|south|west|up|down}) from here~!} {
#VAR sniffs {%additem( %1 , @sniffs)}
#IF %numitems( @sniffs)=3 {#IF (%item( @sniffs, 1))=(%item( @sniffs, 2))or(%item( @sniffs, 3)) {
#EXEC %item( @sniffs, 1)
strack @target
} {#IF (%item( @sniffs, 2))=(%item( @sniffs, 3)) {
#EXEC %item( @sniffs, 2)
strack @target
}}}
#IF (%numitems( @sniffs)=3)and(%item( @sniffs, 1))<>(%item( @sniffs, 2))or(%item( @sniffs, 3))and(%item( @sniffs, 2))<>(%item( @sniffs, 3)) {strack @target}
}
#TRIGGER {^You're already in the same room!!$} {
#VAR track {0}
#t- strack
}
#CLASS 0
//I can't remember why on god's green earth I wrote the strack alias with the #VAR but it works so I leave it alone // Thanks for your help mega : )
Reply with quote
megamog75
Enchanter


Joined: 20 Nov 2002
Posts: 627
Location: USA

PostPosted: Fri Dec 12, 2003 5:37 am   
 
Yes, That is very good,.
Looks alot like mine but I see you tweeked it to fit your piticuler needs.

Congrats, It seems that some people never understand that when you leave an example on this forum that it is just an example and not really made for them.
exspecially when it's complicated.

Seems like your on your way to great things.
Reply with quote
Snookumz
Beginner


Joined: 19 Nov 2003
Posts: 13

PostPosted: Fri Dec 12, 2003 9:40 am   
 
#ALIAS trackto {#var trackmob %1;#t+ trackto;#show autotracking;track @trackmob}

#TRIGGER {You sense a trail (%w) from here...} {%1;track @trackmob} {trackto}

#TRIGGER {You're already in the same room!} {#t- trackto} {trackfound}
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