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 ➜ Sending a command to another world

Sending a command to another world

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


Posted by Nylian   (12 posts)  Bio
Date Thu 21 Jun 2012 10:20 PM (UTC)

Amended on Thu 21 Jun 2012 10:28 PM (UTC) by Nylian

Message
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
Top

Posted by Digs   USA  (17 posts)  Bio
Date Reply #1 on Thu 21 Jun 2012 11:34 PM (UTC)
Message
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>
Top

Posted by Digs   USA  (17 posts)  Bio
Date Reply #2 on Thu 21 Jun 2012 11:59 PM (UTC)
Message
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>
Top

Posted by Nylian   (12 posts)  Bio
Date Reply #3 on Fri 22 Jun 2012 10:43 PM (UTC)
Message
Thank you VERY much, I was putting "chat" in too many places. Makes much more sense now.

Appreciated!
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.


18,187 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.