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


Joined: 02 Nov 2006
Posts: 4

PostPosted: Thu Nov 02, 2006 7:37 pm   

**PLEASE** Help with a trigger/script
 
Hi, I have been using zMUD for many years, but I never got around to setting up a decent script/trigger.

The MUD I play on (Bad Trip) has random tokens placed in areas. If you are a Dwarf (which I am), tokens appear as "Something shiny." if you perform a "scan". With farsight, the location can be up to 3 rooms away (Nearby (east, west, south, north, up, down), Not Far (east, west, south, north, up, down), and Far Off (east, west, south, north, up, down).

What I am looking to do is have a trigger than will explore the MUD, while scanning, and if "Something shiny." pops up on scan, I want the trigger to go to that room and pick up the token (get token). If there is anyone who can help me out at all, or at least get me started, I would VERY much appreciate it. Many people have scripts, so without one, I don't stand a chance of getting any tokens. Thanks to everyone or anyone than can help me!!
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Thu Nov 02, 2006 8:16 pm   
 
Well to be able to give any significant help we'd need to see a sample of the output. Ideally I'd like to see the output of a farsight command when something is not found, when it is near, not far and far off. Also we'd need to know what information, if any, is provided to let you know what direction to go in.

Note: If the direction information is absent, the algorithm becomes significantly more complex.


But here's a quick guess.

#TRIGGER {^Something Shiny (%w *)$} {#IF (%1 == "Nearby") { Goto Nearby Room} { %1 == "Not Far") { Goto Room Not Far away} { %1 == "Far Off") { Goto Far Off Room} } }

Ok, the #TRIGGER command matches on a particular pattern of text or expression value and performs an action. the '^' matches the beginning of a line, the '$' matches the end. Look at Pattern Matching for more info on these. The parentheses capture the value of a particular portion of our trigger pattern which we can access using %1. The #IF command is an if-then-else construct that allows take to perform a command based on the value of the expression.[/b]
_________________
Asati di tempari!
Reply with quote
outkast
Newbie


Joined: 02 Nov 2006
Posts: 4

PostPosted: Thu Nov 02, 2006 8:39 pm   
 
Thank you for responding so quickly. When you have "farsight" cast, and do a scan, nothing appears if there is nothing around.
For example: If I scan, and nothing is around, it's just as if I hit "Enter" on the screen. You do NOT see "Far off, nearby, etc etc"

And as far as exits go, I have "autoexit" enabled, so when I go into a room, I always see exits available.
For example:
Along the Eastern Road
You are on the eastern road between Midgaard and the eastern lands. The
road leads west from here to Midgaard and east towards a heavily guarded
checkpoint. A dirt path wanders off to the south, and a quaint old tavern
is nearby to the north.

[Exits: north east south west]

Above is a copy/paste of what I see when I enter a room.
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Fri Nov 03, 2006 9:28 am   
 
Yes and what is the mud output when you scan and there is something around?
_________________
Taz :)
Reply with quote
outkast
Newbie


Joined: 02 Nov 2006
Posts: 4

PostPosted: Fri Nov 03, 2006 4:25 pm   
 
Ok, I had some help, and definitely made some progress. Here is what I have so far, now, the problem is that when "Something Shiny" is found (which is a token), the trigger sees it, but it doesn't go and get the token. Any ideas?

#CLASS {Scan}
#ALIAS scanner {
#T+ scan|spotter
#TEMP "scangetter" {%d} {
#IF (@tokenfound) {
#LOOP @roomdist {@roomdir}
get token
} {next}
#T- scan|spotter
} "" {prompt}
scan
}
#ALIAS next {#IF (@spice) {eat spice} {#SAY Go buy more spice!}}
#TRIGGER {^ - Something Shiny$} {
token=1
#SAY Token Found
}
#TRIGGER {^Some unknown magic holds you here.$} {
#T- scangetter
#SAY Go somewhere else to look for tokens!
cast portal hassan
#TEMP {A shimmering ~(gateway~) appears.} {
enter gate
scanner
}
}
#TRIGGER {^You buy Spice of the black, aquatic centipede for %d silver.$} {#ADD spice 1}
#TRIGGER {^You eat Spice of the black, aquatic centipede.$} {
#ADD spice -1
scanner
}
#TRIGGER {^You get * token.$} {scanner}
#CLASS 0
#CLASS {Scan|Spotter}
#TRIGGER {^Nearby (%w):$} {
roomdist=1
roomdir=%1
}
#TRIGGER {^Not Far (%w):$} {
roomdist=2
roomdir=%1
}
#TRIGGER {^Far off (%w):$} {
roomdist=3
roomdir=%1
}
#TRIGGER {^Right Here:$} {
roomdist=0
roomdir=0
}
#CLASS 0


Also, here is what I see when I scan and something DOES show up:
scan
Right Here:
- a horse
Nearby North:
- the wandering prophet
- Elvira
- Something Shiny
Nearby East:
- the wandering prophet
Not Far East:
- the vulture
- the wandering prophet
- the sultan's guard
- the sultan's guard
- the sultan's guard
- the sultan's guard
- the sultan's guard
Not Far West:
- a tourist
- the wandering prophet
Far off West:
- The Royal Guard

And as far as distances, Right Here = Right Here, Nearby = 1 move away, Not Far = 2 moves away, Far Off = 3 moves away. Please let me know if you see any flaws or have any ideas. Thanks everyone, you can Yahoo me if you'd like, whatever is best.
Reply with quote
outkast
Newbie


Joined: 02 Nov 2006
Posts: 4

PostPosted: Fri Nov 03, 2006 4:39 pm   
 
I'm sorry, I bet you kinda need an overview as to what I am actually doing.

If you eat a spice, it teleports you to a random area. After you eat the spice, you scan and look for "Something Shiny". If "Something Shiny" shows up on SCAN, it's supposed to go retrieve the token(s) (Something Shiny). If "Something Shiny" does NOT show up on SCAN, it's supposed to start over with eating the spice. Now some areas you cannot teleport, and you will get a message saying:

You eat Spice of the black, aquatic centipede.
Some unknown magic holds you here.

If this message comes up, it's supposed to "cast 'portal' hassan", enter the gate, then start the eating of the spice again.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Tue Nov 07, 2006 7:36 am   
 
Ok.. the root of the problem is is that you're not doing anything when the token is found. Add the following trigger and you will be able to move to it.

#TRIGGER (@token==1) {

#CLASS Scan|spotter 0

#LOOP @roomdist {@roomdir}
get token

}

You can get rid of the #TEMP scangetter trigger. Alternatively you can do this....

#TRIGGER {^ - Something Shiny$} {
token=1
#SAY Token Found

#CLASS Scan|spotter 0

#LOOP @roomdist {@roomdir}
get token
}

For this code to work, it assumes that you move roomdist and roomdir out of the Scan|Spotter and into the Scan class so that variables are still available with you disable the spotter class. The codes untested but it should give you the general idea.
_________________
Asati di tempari!
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