SendToAllWorlds on different MC instances

Posted by Rdiniz on Sun 19 Mar 2017 09:20 PM — 4 posts, 18,511 views.

Brazil #0
Hi,
is it possible to use send a command to all worlds, being n of those worlds in another instance on MushClient?
Reason I want this is to try to redude some slowness on the main game window since to too many worlds opened (20+).

Thank you.
Australia Forum Administrator #1
You can use:

Template:function=GetWorldIdList
GetWorldIdList

The documentation for the GetWorldIdList script function is available online. It is also in the MUSHclient help file.



That gets you a list of all the world IDs.

Then you can use:

Template:function=GetWorldById
GetWorldById

The documentation for the GetWorldById script function is available online. It is also in the MUSHclient help file.



That gets you an object reference (or Lua userdata) which points to one of the worlds.

Then you can send to that world.

Example in Lua:


-- --------------------------------------------------
-- Example showing sending a message all worlds
-- --------------------------------------------------

function SendToAllWorlds (message)

  for k, v in pairs (GetWorldIdList ()) do 
    GetWorldById (v):Send (message)
  end
end

SendToAllWorlds ("say Hi there")
USA Global Moderator #2
No, Nick, Rdiniz wants to command and control a remote botnet across multiple MUSHclients.


Quote:
too many worlds opened (20+)

I agree. That's too many. Problem identified. Solution obvious.
Amended on Mon 20 Mar 2017 03:19 PM by Fiendish
Brazil #3
It's not a problem, it's a requirement for what I want and do use. It's working well, I do use Nick's code to send to all worlds. I just wanted to get it running faster if possible, but if not, I'll live!

Thank you.