Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ VBscript
➜ Running script with trigger ??
|
Running script with trigger ??
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Fjodor
Sweden (13 posts) Bio
|
| Date
| Fri 11 Jul 2003 (UTC) Amended on Fri 11 Jul 2003 12:02 AM (UTC) by Fjodor
|
| Message
| Ok, I want to make a script that is a bit complex (atleast for me :P)
Dunno how to start so I just type what I want it to do.
I first want to make a database (or similar) with directions.
Then I want the script to check the room I'm in for a mob, if it's not in that room I want to move one step (from the DB) and then check again in that room for a mob and so on.
Now for the hard part, when I've found that mob and killed it I want to continue moveing through the database and check for next mob.
Anyone know if that is possible to make ?
Something like this :
Database
e, n, w, n, n, n, w, s, w, s, s, e, s, e
Script
Do While <world check for mob in room> = false
move one step from database
loop
Script2
if <world check for mob in room> = true
kill mob
trigger
Me dealt the killing blow to mob
run script again (and continue where I was in database)
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Fri 11 Jul 2003 07:59 AM (UTC) |
| Message
| OK, so you want to go from A to B where the route is:
A -> e, n, w, n, n, n, w, s, w, s, s, e, s, e -> B?
In each case you want to either kill the mob and move, or just move?
First, you certainly can't have a loop as you described, however I guess you would know that. What you need to do is make one move, and then wait for a trigger to tell you whether or not there is a mob there and then make the next move.
The tricky thing might be to make a trigger that matches on the absence of a mob. You might want to post a couple of example room descriptions, one with a mob and one without. Hopefully there is something there that will let us know whether or not there is a mob.
What I would do then is use something like Split (to split the direction list at the commas), and then store a current room number (eg. 1, 2, 3 and so on) in a variable. You would then send the first direction (e in this case) and exit the first script.
The trigger that matches on the presence or absence of the mob would then work out whether there is a mob or not. If not it adds one to the room number and sends the next direction.
If there *is* a mob it sends kill <mob>.
Then another trigger again detects when the fight is over, adds one to the room number, and you are off again. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Fjodor
Sweden (13 posts) Bio
|
| Date
| Reply #2 on Fri 11 Jul 2003 09:06 PM (UTC) Amended on Fri 11 Jul 2003 09:08 PM (UTC) by Fjodor
|
| Message
| Here is a few rooms I just cut and pasted (I allways run in brief mode and not verbose or it would spam the hell out of me :P)
--------
dark cave (e,w)
crevice (w,ne,se)
damp cavern (n,sw)
bedrock cavern (s,ne)
Huge bee (working).
damp cavern (e,w,sw)
bedrock cavern (e,w,ne)
dark crevice (w,e)
Giant honeybee.
damp cavern (w,e)
Worker bee (giant).
rock tunnel (w,e)
Worker bee (giant).
tunnel (w,e)
Honey bee (huge).
cave (w,e)
shadowed tunnel (w,e)
Honey bee (huge).
dark crevice (nw,e)
cavern (n,sw,se)
Worker bee (huge).
-------
That is 14 rooms and mobs in 7 of em.
So in those 7 rooms I want to stop and attack te mob (in this area it's only bee's) area is over 600 rooms big and I want to run though em ALL to check for mobs.
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Fri 11 Jul 2003 09:38 PM (UTC) |
| Message
| Can you paste what you actually see as you walk through a couple of rooms? Or is that it? Is there a prompt or anything?
Does the room come before the mob?
So far I see the mobs seem to have a period at the end of the line whilst the rooms don't, but apart from that they are very similar.
Say you walked into a room and saw this:
bedrock cavern (s,ne)
Huge bee (working).
Do you see anything else after, like:
>
I can't quite see, if not, how we can tell that there is no mob, unless it just waits a second. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Fjodor
Sweden (13 posts) Bio
|
| Date
| Reply #4 on Sat 12 Jul 2003 12:14 AM (UTC) Amended on Sat 12 Jul 2003 07:14 PM (UTC) by Fjodor
|
| Message
| Example room without a mob :
dark cave (e,w)
Example room with a mob :
dark cave (e,w)
Giant honeybee.
And I've checked all mobs end with a period.
So trigger for a mob in the room could look like this :
^(.*?)bee(.*?)\.$ (as there is only bee's in this area)
Now for the problems :
1) I want a database (or similar) to walk in every room in the area.
2) If there is a mob in a room I want to stop walking and attacking. (SOLVED)
3) When I kill a mob I get 'You made the killing blow to <mob name> so trigg on that is easy. BUT, now I want to continue moveing. (SOLVED)
4) A room can contain multiple mobs and I don't want to send "kill bee" several times but only once.
That is what I could come up with for now, I'll prolly come up with new problems when I start codeing :P (SOLVED)
I've edited this note now and made some codeing from on top of my head. Problem now is how do I write the "database" and how do I call from it ?
What I've come up with so far for this to work is :
---------------------------------------------------
Trigger :
^(.*?)bee(.*?)\.$
label triggerformob
script Checkmob
^(.*?)You dealt the killing blow to(.*?)$
label mobdead
send to world > kill bee
^(.*?)There is no bee here(.*?)$
label Ifthereismorethanonemobinroom
send to > trigger
trigger > Mobinroom > 0
script > WalkingScript
Alias :
startrunnig
label StartRun
script WalkingScript
script :
Sub Checkmob // This one is so I don't send multiple 'kill' to the room if there is more than 1 bee in there
If World.GetVariable ("Mobinroom") = 0 then
World.SetVariable ("Mobinroom") = 1
End Sub
Sub WalkingScript
If World.GetVariable ("Mobinroom") = 1 then
Attackmob
If World.GetVariable ("Mobinroom") = 0 then
Checkformob
End Sub
Sub Attackmob
World.SetVariable ("Mobinroom") = 2
World.Send "kill bee"
End Sub
Sub Checkformob
<call database for one movement>
WalkingScript
End Sub
---------------------------------------------------
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #5 on Sun 13 Jul 2003 04:48 AM (UTC) |
| Message
| There was a wilderness walker script a while back - try searching for that. Basically I think it worked out which way you could go - although I think in his case he had a definite destination in mind, whereas you just want to go to every room.
One idea is to store each room as a variable and store whether or not you visited it, and which exits you took.
I don't have time to code the entire thing, but it sounds interesting. The other approach would be to store the rooms and exits in a database - there is a plugin here that illustrates using databases. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
18,899 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top