[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  "#all" plugin

"#all" plugin

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


Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Sat 24 Aug 2002 07:41 PM (UTC)
Message
I still think that one of the few things MUSHClient is missing is ZMud's "#all" command. I need to be able to send stuff to window 1, 2, 3, etc, and as far as i know, that can't be done. So, i have decided to try and write a plugin for it. Even though loading the scripting engine increases a file's memory consumption and decreases its speed, I can't do it any other way, and i need it very much. Is there any way i can write this plugin, or maybe can it get coded in the next MUSHClient version? i don't think it's very hard to code, but i don't know of any variables that all the windows can check, and i don't know of a way to notify other windows when the variable needs to be read.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Nick Gammon   Australia  (23,001 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Mon 26 Aug 2002 06:41 AM (UTC)
Message
Are you just trying to send things to all (or some) windows? If so, that is a built-in function.

If you want to do it from a script it can be done easily enough (see GetWorldList function).

That could be made a plugin easily enough, eg.

#all I am going away now

If that is what you want to do.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #2 on Tue 27 Aug 2002 12:56 PM (UTC)
Message
I'm trying to send the command to any world i want, like the "Send to all worlds" menu command. Since MUSHClient can only load worlds 1-10, the command could be "#all say hello", and all worlds would say hello, "#1 say I'm world number 1", which would just be sent to world number 1, or "#1234780 say hello" which would be sent to worlds 1, 2, 3, 4, 7, 8, and 10. Also, how would it be possible for me to set my script to pause for customizable number of seconds in VBscript? (irrelevant)

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #3 on Tue 27 Aug 2002 07:31 PM (UTC)

Amended on Tue 27 Aug 2002 07:33 PM (UTC) by Shadowfyr

Message
Hmm. Lets see if I can take a crack at this...

Assuming that your alias is #* *, then this may do what you want:
sub SendToWlds(name, output, wildacards)
  dim z,wrld
  select case wildcards(1)
    case "all"
      for each wrld in world.getworldlist
        set sndworld = world.getworld(wrld)
        sndworld.send wildcards(2)
      next
    case else
      if isnumeric(wildcards(1)) then
        z = "1234567890"
        count = 1
        for each wrld in world.getworldlist
          if right(count,1) = mid(z,1,1) then
            set sndworld = world.getworld(wrld)
            sndworld.send wildcards(2)
          end if
          count = count + 1
        next
      else
        world.note "Error! Unable to determine world to send to."
      end if
  end select
end sub

It hasn't been tested, so no promises. ;) However to add any new commands for #, you just add 'case "command"' and the needed code.
[Go to top] top

Posted by Nick Gammon   Australia  (23,001 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Wed 28 Aug 2002 12:34 AM (UTC)
Message
Quote:

Since MUSHClient can only load worlds 1-10


Not really, there are only 10 buttons on the world activity button bar, but you can have 100 worlds open if you want to (or more).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (23,001 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Wed 28 Aug 2002 12:52 AM (UTC)

Amended on Wed 28 Aug 2002 12:55 AM (UTC) by Nick Gammon

Message
Close, Shadowfyr, the word "wildacards" was a typo, and your method of selecting #234 didn't work. I amended that a bit. Here it is as a plugin...

You can find it at:


http://www.mushclient.com/plugins/multiple_send.xml





<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>
<!-- Saved on Wednesday, August 28, 2002, 10:48 AM -->
<!-- MuClient version 3.26 -->

<!-- Plugin "Multiple_Send" generated by Plugin Wizard -->

<!--
See forum post 

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=1403

for more details about this script.
-->

<muclient>
<plugin
   name="Multiple_Send"
   author="Nick Gammon"
   id="33e3ed2a4a9751329b048b5c"
   language="VBscript"
   purpose="Sends commands to multiple worlds"
   date_written="2002-08-28 10:44:11"
   requires="3.25"
   version="1.0"
   >
<description trim="y">
<![CDATA[
You can send a command to one or more worlds, or all worlds, like this:

#all say Goodnight All  <-- sends to all open worlds
#1   say Hi everyone    <-- sends to world #1
#123 say Follow Me      <-- sends to worlds #1, #2 and #3

Multiple_Send:help      <-- this help screen


]]>
</description>

</plugin>


<!--  Aliases  -->

<aliases>
  <alias
   script="SendToWlds"
   match="#* *"
   enabled="y"
  >
  </alias>
</aliases>

<!--  Script  -->


<script>
<![CDATA[
'
'  based on a script by Shadowfyr (with minor corrections)
'

sub SendToWlds(name, output, wildcards)
 dim z,wrld
 select case wildcards(1)
   case "all"
     for each wrld in world.getworldlist
       set sndworld = world.getworld(wrld)
       sndworld.send wildcards(2)
     next
   case else
     if isnumeric(wildcards(1)) then
       count = 1
       for each wrld in world.getworldlist
         if instr (wildcards (1), cstr (count)) and count < 10 then
           set sndworld = world.getworld(wrld)
           sndworld.send wildcards(2)
         end if
         count = count + 1
       next
     else
       world.note "Error! Unable to determine world to send to."
     end if
 end select
end sub


]]>
</script>


<!--  Plugin help  -->

<aliases>
  <alias
   script="OnHelp"
   match="Multiple_Send: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
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #6 on Wed 28 Aug 2002 01:32 AM (UTC)
Message
I suspected that my loop method might not. Since vbscript doesn't allow specific type casting, it is hard to tell what the result is until you try. Also you didn't notice but it should have been mid(z,count,1). What the code was doing was checking each count # against the first letter is z. Oops!

That's what you get when you type the entire thing directly to the forum in about 2 minutes and have no way to test it. ;)
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #7 on Wed 28 Aug 2002 03:37 PM (UTC)
Message
Thanks a lot, that plugin helps me a lot, Nick :) You almost fully answered my question, except for that irrelevant part :) how can i make a script pause for 2 seconds? i really need to do that :(

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Reply #8 on Wed 28 Aug 2002 04:46 PM (UTC)
Message
Th quick answer is:

Have your script make a timer.
Have the timer call another subroutine.

Look at http://www.mushclient.com/functions.htm for help.

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #9 on Wed 28 Aug 2002 08:37 PM (UTC)
Message
Hmm, that would really mess up my script though. I tried doing VB's standard
Sub Timer (intSeconds)
Dim StartTime
StartTime = Timer
Do until Timer > StartTime + intSeconds
DoEvents
Loop
End Sub
but it produced an error :(

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Nick Gammon   Australia  (23,001 posts)  [Biography] bio   Forum Administrator
Date Reply #10 on Wed 28 Aug 2002 09:07 PM (UTC)
Message
Quote:

Also you didn't notice but it should have been mid(z,count,1).


I did notice, it came under the label "your method ... didn't work". Your problem there was more severe than the typo, your test doesn't actually check anywhere for the contents of wildcards (1), you were only checking a number against the fixed value of z. Thus, it didn't matter what number they typed, only that they had a number.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (23,001 posts)  [Biography] bio   Forum Administrator
Date Reply #11 on Wed 28 Aug 2002 09:09 PM (UTC)
Message
Quote:

how can i make a script pause for 2 seconds


You can't, at least not properly. This ground has been gone over many times in the past. If your script worked in the syntactic sense, it would pause the whole MUSHclient for 2 seconds.

There are a couple of workarounds. One is "DoAfter", which lets you send things to the world after x seconds, eg.

world.DoAfter 5, "say byebye"

The other is to make a timer (could be a one-shot, temporary timer), that takes over in 2 seconds. Ie. this timer calls a script that does whatever scripting you want to do in 2 seconds.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #12 on Wed 28 Aug 2002 09:32 PM (UTC)
Message
>Your problem there was more severe than the typo, your test
>doesn't actually check anywhere for the contents of
>wildcards (1)

Umm.. Can I say Duh!!? lol Like I said, this is what I get for typing it all in on the fly and not checking too carefully to see if I got it right. ;)
[Go to top] 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.


29,503 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]