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 a series of commands repeatedly until something happens
|
Running a series of commands repeatedly until something happens
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Elvaago
Netherlands (10 posts) Bio
|
| Date
| Wed 11 Apr 2007 05:18 PM (UTC) |
| Message
| Hello all.
I play in a game that has a certain level that goes 19 times south, 19 times east, 19 times north and 19 times west and then all over again. I am hunting for a specific type of monster. What I would like is to be able to continuously keep on walking through the grid indefinitely, but when a certain monster shows up, I want to stop walking and send a beeping signal or something or other.
Is this very complicated? |
"We have such sights to show you..." | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Wed 11 Apr 2007 10:03 PM (UTC) |
| Message
| If you are just starting in scripting I would use Lua, instead of VBscript. :)
It isn't that complicated. I think in your case I would maintain in a script my current location (or at least, how far I had to go in a direction). For example, if I had gone 10 east, then I have 9 east to go. Then when I have 0 east to go, I switch to north with 19 to go, and so on.
Then for each location I would send a direction (eg. east) and wait for a trigger to fire, the trigger being based off something you expect to see when you reach a new room (eg. Exits: *).
When that trigger fires you are in your new room, and either the mob is there, in which case you fight it, or it isn't, in which case you go back to doing the next movement. It is hard to be more specific without seeing a sample of MUD output, but that is the general idea. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Elvaago
Netherlands (10 posts) Bio
|
| Date
| Reply #2 on Thu 12 Apr 2007 05:58 AM (UTC) |
| Message
| OK, I have quite a bit of experience in Visual Basic for Applications. Would this help at all with VBScripting?
And to be more specific, a generic room in this game would look like this:
You walk down the tunnel.
You can see exits to the: south west
1. Transparent stone
2. Springgun (Shock Tox) Dart weapon
3. Green stone
And when a monster arrives it looks like this:
You walk down the tunnel.
You can see exits to the: east west
1. Vibroaxe
2. Laser Mineral Composition Analyzer
A Deadhead emerges from the shadows!
So I need to walk 19 times south, 19 times east, 19 times north and 19 times west (and then repeat from the beginning) until I see the line 'A <specific monster> emerges from the shadows! (I don't want to actually fight it automatically, cause it can kill me quite easily. I need to be careful.)
Could you give me some pointers as to how to start? |
"We have such sights to show you..." | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Thu 12 Apr 2007 06:28 AM (UTC) Amended on Thu 12 Apr 2007 06:30 AM (UTC) by Nick Gammon
|
| Message
| Well, I would make a trigger matching on:
Match: You can see exits to the: *
That would catch the arrival in a new room. The trouble is the monster message appears after that. So you probably want to fire up a timer that goes off in about a second, that moves you to the next room.
Meanwhile if you get a message (this would be another trigger):
Match: A * emerges from the shadows!
Then you could decide, based on the mob name, whether to cancel the timer or let it fire and keep you moving.
You will have to try to work this out yourself a bit. Writing what sounds a lot like a bot script is not something I am really prepared to do.
If you have a specific query, you could post what you have tried, what you got from the MUD, and what went wrong.
See this post for how to copy any triggers etc. you might have written and put them into the forum:
http://www.gammon.com.au/forum/?id=4776
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Elvaago
Netherlands (10 posts) Bio
|
| Date
| Reply #4 on Thu 12 Apr 2007 05:32 PM (UTC) |
| Message
| print(currentdirection)
print(targetacquired)
if currentdirection=="south" and targetacquired~=1 then
Send ("south")
end
if currentdirection=="east" and targetacquired~=1 then
Send ("east")
end
if currentdirection=="west" and targetacquired~=1 then
Send ("west")
end
if currentdirection=="north" and targetacquired~=1 then
Send ("north")
end
This results in the following. I walk one more room than the one the monster is at:
You walk down the tunnel.
You can see exits to the: east west
west
0
You walk down the tunnel.
You can see exits to the: east south west
west
0
A Russell Rowan emerges from the shadows!
1
You walk down the tunnel.
You can see exits to the: east west
west
1 |
"We have such sights to show you..." | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #5 on Thu 12 Apr 2007 09:13 PM (UTC) |
| Message
| | As I said in the earlier post, when you get the Exits match, you don't know if the monster is there yet, so you really need to make a timer (say for half a second), and move, when the timer fires, if the monster has not shown up. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Elvaago
Netherlands (10 posts) Bio
|
| Date
| Reply #6 on Fri 13 Apr 2007 06:42 AM (UTC) |
| Message
| Thank you.
I put the moving around command on a 2 second timer and it works perfectly.
Now I'm turning it on and let's hope I'll find my monster soon. :-) |
"We have such sights to show you..." | | 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.
26,774 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top