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
➜ Looking to write a "chase" script.
|
Looking to write a "chase" script.
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| English Lad
(4 posts) Bio
|
| Date
| Tue 29 Jan 2008 12:32 PM (UTC) Amended on Tue 29 Jan 2008 12:34 PM (UTC) by English Lad
|
| Message
| Hi all
First off massive props to Mr Gammon - I've mudded on and off for years, and only recent been pointed in the direction of MUSHclient, and its certainly enhanced my experience.
I've been playing around with the scripting options, mainly for simple things like disarm triggers and hunger/thirst triggers. My knowledge of scripting is therefore, pretty limited but I'm getting there.
The "chase" script i've been thinking off would work like this.
I'd use an alias ctarget *
to set a variable as chasetarget
This would be the person I'd like to go after.
I'd use an alias chaseaction *
which would set a variable for an action to do @ the target.
I'd then have an alias ct, which ideally would perform a few actions.
First off it would scan - returning what is in rooms nearby, if it saw the variable chasetarget in any of those rooms it would then send the appropriate movement commands to go to that room, followed by chaseaction @ chasetarget.
An example of the what the MUD returns for a scan would look like this.
Scan
You scan all around.
You scan north.
You scan east.
*** Range 2 (east) ***
(White Aura) BADGUY the Nastyperson is here, sitting astride a warhorse.
You scan south.
You scan west.
You scan up.
You scan down.
In this example I would want the script to enter east;east;chaseaction @ chasetarget (or whatever the syntax is).
One thing that would be fairly important also would be that the trigger to move to the target and attack it should only trigger when using the alias ct. I'd like to be able to use scan in normal situations without the trigger firing.
Might anybody have any tips on how to go about putting something like this together? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Wed 30 Jan 2008 04:09 AM (UTC) |
| Message
| I would start by looking at the FAQ: http://www.mushclient.com/faq , point 21.
That shows how you can make aliases that set variables, that would handle your ctarget and chaseaction aliases.
Then for the actual chase, the ct alias would need to do something like this:
- Send "scan" (in Lua you would literally do that)
- Enable the triggers that reacts to the scan results (you do this so that it doesn't happen all the time)
Finally you need a couple of triggers to handle the scan results. Something matching "You scan (north|south|east|west)" (and so on) could be used to remember the last direction.
Then if you get "*** Range 2 (east) ***" (or similar) you could remember the direction and count - this could be used to build up a speedwalk (eg. this could turn into 2E).
The last trigger would match the message about "X is sitting here" where X could be a variable in the trigger match (or simply test it in a script).
If that fires you now know the direction, the person, and the attack method, so you put that all together.
Last thing to do is disable these triggers so they don't fire when you don't want them to. If there is a line like "scan over" you could match that to disable the triggers, otherwise maybe a timer that fires a few seconds later could do it.
I think you will learn more if you try to write them yourself, if you are having problems post what you have achieved so far, and explain what is going wrong.
|
- 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.
13,352 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top