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


Joined: 05 Jan 2003
Posts: 45
Location: USA

PostPosted: Sun Jan 05, 2003 9:18 pm   

Script Question
 
heya, ive been using zmud for a couple years now, but never really got into script writing....i want to set up a bot :) Alls i need to know how to do is look at what monsters are in a room, capture the exits, kill the monster...and when its dead, go through one of the exits....so say a room looked like this:

This is the dead center of the Realm of Chaos. All around you lies
a bleak and desolate land tormented by the wrath of unknown forces.
You are standing at the edge of a raging vortex that seems to fall
into infinity. There are paths leading away from the vortex in
several directions. What you might find there is so changeable
that you aren't certain how to proceed. Some hard-won experience
is related on the plaque. But don't trust it. This is CHAOS!
There are five obvious exits: east, west, south, north, vortex
A mouse.
A small weasel.

When I enter this room, how would I capture the monster names? Then execute them into a scipt that would kill them, and when theyre dead, go through one of the exits, to repeat the process in the next room.

Also, if the next has no monsters in it, how would i just move on and skip the room?



I really appreciate the help....thanks




/ Malleus /
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: Mon Jan 06, 2003 9:57 pm   
 
the place to start is with a few triggers like these:

#tr {^There are %w obvious exits: (*)} {
exitstring = "%1"
exits = %replace(@exitstring, ", ", "|")
#var monsters ""
#t+ getmonsters
}
#class {getmonsters} {disable}
#tr {^(*)$} {
monstring = "%1"
monster = %replace(@monstring, ".", "")
monster = %word(@monster, %numwords(@monster))
#additem monsters @monster
kill @monster
}
#tr {(*) is DEAD} {
monstring = "%1"
monster = %replace(@monstring, ".", "")
monster = %word(@monster, %numwords(@monster))
#delitem monsters @monster
kill %item(@monsters, 1)
}
#class 0
#tr {the pattern for your prompt goes here} {
#if (%numitems(@monsters) = 0) {#send %item(@exits, %random(1, %numitems(@exit)))
#t- getmonsters}
}


Don't know if this will really work (haven't tested it), but you can see the idea, and it should give you a good starting place. This is pretty much the formula i used for a kill bot.
the main steps are these:
1) capture the available exits and put them in a string list
2) begin looking for monsters
3) add all monsters found to a string list
(tricky part here is that you only want the keyword for a monster, i've assumed its the last word in the line)
4) start killing monsters in the list
5) when a monster dies, remove it from the list
6) when the list is empty, move on to a different room
7) repeat
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