|
Sending a command to another world
|
Reply to this subject
Start a new subject
 
Refresh page
| Posted by |
Nylian
(12 posts) bio
|
| Date |
Thu 21 Jun 2012 10:20 PM (UTC) [ quote
] 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.
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) [ quote
] |
| 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) [ quote
] |
| 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) [ quote
] |
| 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.
510 views.
Reply to this subject
Start a new subject
 
Refresh page
top
Comments to:
Gammon Software support
Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )