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
➜ Tips and tricks
➜ New to Scripts, need a little help.
New to Scripts, need a little help.
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Trunks_Zero
(13 posts) Bio
|
Date
| Sun 16 Feb 2003 05:17 PM (UTC) |
Message
| Ok, well, I've used MUSHclient for a while, but I've never bothered to get into the scripts, 'cause I don't know much about code... Anyways, here's my problem.
Is there anyway that I could make a script/trigger for the following:
Every 30 seconds, its to gtell "Tick in 5 seconds."
But, to avoid complications due to lag and whatnot, I also what it to reset the timer on every:
(Advice: These show ticks, every 35 seconds. )
So it would go something like this:
You tell the group 'Tick in 5 seconds.'
--5 seconds--
(Advice: Mud Advice here )
--Timer reset--
--30 seconds--
You tell the group 'Tick in 5 seconds.'
--etc...-- | Top |
|
Posted by
| Shadowfyr
USA (1,791 posts) Bio
|
Date
| Reply #1 on Sun 16 Feb 2003 08:09 PM (UTC) |
Message
| Hmm.. Complicated, but..
One timer, a trigger and a script>
<timers>
<timer enabled="y" name="TickWarn" second="30" >
<send>grouptell Tick in 5 seconds</send>
</timer>
</timers>
<triggers>
<trigger
enabled="y"
match="(Advice: These show ticks, every 35 seconds. )"
name="ResetTicks"
script="ResetIt"
sequence="100"
>
</trigger>
</triggers>
sub ResetIt (name, output, wilds)
world.resettimer "TickWarn"
end sub
Note however that using a timer set to 35 seconds to call ResetIt instead of using the advice bit to syncronize (except for the first time) would work better, since the client won't be what lags. ;) | Top |
|
Posted by
| Trunks_Zero
(13 posts) Bio
|
Date
| Reply #2 on Sun 16 Feb 2003 09:34 PM (UTC) |
Message
| Ok, i see what you mean, but as I said, I've never toyed with scripts. Where does all this go? | Top |
|
Posted by
| Shadowfyr
USA (1,791 posts) Bio
|
Date
| Reply #3 on Sun 16 Feb 2003 10:03 PM (UTC) |
Message
| The part with the <timers> and <triggers> can both be copied directly into the respective editors for them. They are in the same format that mushclient used for cutting and pasting to and from those editors. ;)
The sub has to go into a script file. Basically just use something like notepad, copy the sub part into there and save it into c:\program files\mushclient\scripts as something like "MyScript.vbs". The "" are important if using MS notepad here instead of mushclient's, since MS notepad will try to save it as MyScript.vbs.txt if you don't force it to use the name you want with quotes. One you have that file saved you go into the mushclient settings for scripting, enable scripting, set the script name to the file you created and set the script type to VBScript. There is also a setting for 'Recompile when script changes:' that is useful to set to 'Always' in order to make later editing easier, otherwise changes made to the script would require you to manually reload the script each time using the 'reload script' button.
You can ignore most everything else here. Most are special named subs that perform tasks, 'if' you add them, depending on certain events like actually connecting to the mud. One setting though to consider is 'Choose Editor'. Normally scripts are edited in mushclients notepad, but if you ever make a large script (over 32k) it won't edit properly. I use one called WScite (don't remember the link right now, but google can find it) instead, which is free. There are some other decent ones around that make editing easier, though as with everything the ones that cost money are better. | Top |
|
Posted by
| Trunks_Zero
(13 posts) Bio
|
Date
| Reply #4 on Mon 17 Feb 2003 10:38 PM (UTC) Amended on Mon 17 Feb 2003 10:41 PM (UTC) by Trunks_Zero
|
Message
| Ok, sweet. I think I got it working.
Now... I hate to be such a newbie, but if you don't mind, could you help me with one other thing? :>
Here's the string it would show first off:
You can momentarily see in all directions..
And then after that, it shows a list of names of everyone in the area you are currently in. For example:
Anfarel......................Stomping Ground Training
Norris.......................Center Square of Kael
Vasp.........................West Kael Road
Gomli........................Center Square of Kael
Nalad........................Stomping Ground Training
Now, heres the main part of it. I want to set a trigger so whenever I see an enemy, who would show up as:
*Duke Name*..................Stomping Ground Training
Now, I want it to report that in gtell, but, I have problems with 1) variables, which can be disabled by /*, but again, as it shows on a new line, it also has problems with things like:
*Duke Name*'s slash misses you. [0]
and:
*Duke Name* is here.
*Duke Name* is sleeping here.
And many other positions that would make *Duke Name* show up on a new line.
So, if anyone could help me out a little with this one too, that'd be awesome :>
PS: The .....'s in the lines of where people are are spaces. When I posted this, it took out all the excess spaces... so yea. | Top |
|
Posted by
| Shadowfyr
USA (1,791 posts) Bio
|
Date
| Reply #5 on Tue 18 Feb 2003 07:44 PM (UTC) |
Message
| Ok. For his you need to use regular expressions for one thing. Second, I assume that the ...... is actually in the line? So you would need a 'regular expression' like:
^\*(.*)\*\s{3,}(.*)
This would ^ - match at start of line, followed by any string, followed by 3 or more spaces (the number before the comma is the minimum, the second being the maximum, which is left blank for 'infinite'), then followed by more text. It should only match on those lines.
You would then just place 'gtell %0' in the send field, since %0 will be 'everything that matched', not just the wildcards. ;) However, since the name and the location are both in (), those can be used as wildcard %1 and %2 if you decide to do something different with the send text or use them in a sub. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #6 on Tue 18 Feb 2003 09:41 PM (UTC) |
Message
|
Quote:
PS: The .....'s in the lines of where people are are spaces. When I posted this, it took out all the excess spaces... so yea.
To keep the spaces in a forum posting, put the relevant part into:
[code] and [/code]
and check the "forum codes" checkbox. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Trunks_Zero
(13 posts) Bio
|
Date
| Reply #7 on Wed 19 Feb 2003 02:08 AM (UTC) |
Message
| ok, sweet. It worked.
<3 shadow, I'll try not to bug you with anymore of my newbie questions :)
Thanks | 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.
20,050 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top