Register forum user name Search FAQ

Gammon Forum

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 ➜ General ➜ timers script

timers script

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Tarrant   (20 posts)  Bio
Date Sat 03 Aug 2002 09:54 PM (UTC)
Message
How can i made a script that would do the command "scan" every few seconds. then i would have scanon and scanoff to be able to turn this on and off as i chose. because i cant scan during battle
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 04 Aug 2002 04:42 AM (UTC)
Message
As I have now released version 3.24 of MUSHclient, which supports plugins, I'll answer the question using a plugin.

Copy the stuff below (under the line), and paste it into a notepad window, then save that as "scan.xml" in your MUSHclient plugins directory. Then use MUSHclient's File -> Plugins dialog to add that file (scan.xml) as a plugin. Then it should work as requested. Hopefully the code below is self-explanatory.

You can also find this plugin at:


http://www.gammon.com.au/mushclient/plugins/






<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient [
  <!ENTITY timer_interval "5" > 
]>


<!--

Plugin to do a "scan" every 5 seconds.
  
Change the "5" in "timer_interval" above to make it happen after a different
number of seconds.

-->

<muclient>
<plugin name="Scan"
  author="Nick Gammon"
  language="vbscript"
  id = "5f2ab730145c150a2535677d"
  purpose = "Does a &quot;scan&quot; every &timer_interval; seconds"
  version = "1.0"
  >
<description trim="y">
This plugin does a "scan" every &timer_interval; seconds.

Commands
--------

scan:help       - shows this description in the output window
scanon          - enables scanning
scanoff         - disables scanning (for battle)
</description>
</plugin>

<!--  Get our standard VB constants -->
<include name="constants.vbs"/>
 
<!--  =============================================

Timer:   scan

 =============================================  -->
 
<timers>
  <timer name="scan" 
         enabled="y" 
         second="&timer_interval;" >
  <send>scan</send>

  </timer>
</timers>


<!--  =============================================

Alias:    scanon
Script:   do_scanon
Purpose:  Enables scanning timer

 =============================================  -->

<aliases>
  <alias
   script="do_scanon"
   match="scanon"
   enabled="y"
  >
  </alias>
</aliases>


<script>
<![CDATA[

sub do_scanon (sName, sLine, wildcards)
  world.enabletimer "scan", 1
  world.note "Scanning enabled"
end sub

]]>            
 </script>
 
<!--  =============================================

Alias:    scanoff
Script:   do_scanoff
Purpose:  Disables scan timer (during battle)

 =============================================  -->

<aliases>
  <alias
   script="do_scanoff"
   match="scanoff"
   enabled="y"
  >
  </alias>
</aliases>


<script>
<![CDATA[

sub do_scanoff (sName, sLine, wildcards)
  world.enabletimer "scan", 0
  world.note "Scanning disabled"
end sub

]]>            
 </script>


<!--  =============================================

Alias:   scan:help
Script:  OnHelp
Purpose: Shows plugin help

 =============================================  -->
 
<aliases>
   <alias
    script="OnHelp"
    match="scan:help"
    enabled="y"
   >
   </alias>
 </aliases>

<script>
<![CDATA[
 sub OnHelp (sName, sLine, wildcards)
   world.note world.getplugininfo (world.getpluginid, 3)
 end sub
]]>            
 </script> 
 
 </muclient>

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Tarrant   (20 posts)  Bio
Date Reply #2 on Sun 04 Aug 2002 05:09 AM (UTC)
Message
cool it works thanks, nick's kung-fu is the best
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.


12,213 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.