Auto Say Function In Seperate Window

Posted by Dretzile on Fri 11 Apr 2014 10:42 PM — 5 posts, 18,046 views.

USA #0
So I have been able to successfully setup several windows that redirect different types of chat messages to different windows, and I've set it up so that each of the windows redirects and sends the command to the main world.

However, I have been trying to set up something along the lines of the "auto say" feature, which doesn't seem to work with my plugin to redirect to the main world.

Examble: If I type something into my OOC window, I want whatever I type to be automatically prefixed with "OOC" so that it gets sent as an OOC command, same for Radio, etc.

I have been scouring the web and the forums and through snippets and I haven't been able to find a way to get this to work...

Can anyone help with a solution?
USA Global Moderator #1
What code are you using to redirect what you say to the main world?
USA #2

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Saturday, June 30, 2007, 10:14  -->
<!-- MuClient version 4.13 -->

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

<muclient>
<plugin
   name="Redirect_Input"
   author="Nick Gammon"
   id="fefa658aa8caca3cb5e2fa81"
   language="Lua"
   purpose="Redirects commands to another world"
   date_written="2007-06-30 10:08:32"
   requires="4.00"
   version="1.0"
   >

</plugin>


<!--  Script  -->


<script>
<![CDATA[
world_name = "AwakeMUD"

function OnPluginCommandEntered (command)

  local w = GetWorld (world_name)  -- find world

  -- not found? show error
  if not w then
    ColourNote ("white", "red", "World " .. world_name .. " is not open")
  else
    w:Execute (command)  -- execute command (handle aliases, etc.)
    PushCommand (command)  -- save in command history
  end -- if

  return ("\t")  -- clear command

end -- OnPluginCommandEntered 


]]>
</script>


</muclient>
USA Global Moderator #3
See my very simple change below where I insert
command = "OOC "..command

That will inject "OOC " in front of anything entered before pushing it to the other world.

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Saturday, June 30, 2007, 10:14  -->
<!-- MuClient version 4.13 -->

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

<muclient>
<plugin
   name="Redirect_Input"
   author="Nick Gammon"
   id="fefa658aa8caca3cb5e2fa81"
   language="Lua"
   purpose="Redirects commands to another world"
   date_written="2007-06-30 10:08:32"
   requires="4.00"
   version="1.0"
   >

</plugin>


<!--  Script  -->


<script>
<![CDATA[
world_name = "AwakeMUD"

function OnPluginCommandEntered (command)
  local w = GetWorld (world_name)  -- find world

  -- not found? show error
  if not w then
    ColourNote ("white", "red", "World " .. world_name .. " is not open")
  else
    command = "OOC "..command
    w:Execute (command)  -- execute command (handle aliases, etc.)
    PushCommand (command)  -- save in command history
  end -- if

  return ("\t")  -- clear command

end -- OnPluginCommandEntered 


]]>
</script>


</muclient>


You can easily genericize this to happen differently based on the current world name, if you name the worlds different for OOC/Radio/etc.
Amended on Sun 13 Apr 2014 06:19 PM by Fiendish
USA #4
Thanks!
It worked perfectly. I appreciate the help very much.