Sending a command to another world

Posted by Nylian on Thu 21 Jun 2012 10:20 PM — 4 posts, 19,166 views.

#0
So I am currently using this to send chat to another window.

Template:faq=23
Please read the MUSHclient FAQ - point 23.


What if I wanted to make an alias that send a lua command to that window? Specifically DeleteOutput()


I have attempted to use this, but it doesn't seem to recognize the command. (It's a dummy world, connecting to 0.0.0.0 named "chat")


-- --------------------------------------------------
-- Example showing sending a message to another world
-- --------------------------------------------------

function SendToWorld (name, message)

local otherworld

  otherworld = GetWorld (name)

  if otherworld == nil then
    Note ("World " .. name .. " is not open")
    return
  end

  Send (otherworld, message)

  -- alternative syntax:   otherworld:Send (message)

end -- of SendToWorld

SendToWorld ("MyOtherWorld", "say Hi there")



I can't seem to get it to work.

Thanks for the help
Amended on Thu 21 Jun 2012 10:28 PM by Nylian
USA #1
Try this alias.


<aliases>
  <alias
   match="MyOtherWorld_clear"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>local otherworld = GetWorld ("MyOtherWorld")

if otherworld then
  otherworld:DeleteOutput()
end</send>
  </alias>
</aliases>
USA #2
Or rather this alias, since you did say that your dummy world was named "chat".


<aliases>
  <alias
   match="chat_clear"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>local otherworld = GetWorld ("chat")

if otherworld then
  otherworld:DeleteOutput()
end</send>
  </alias>
</aliases>
#3
Thank you VERY much, I was putting "chat" in too many places. Makes much more sense now.

Appreciated!