MUCK having a pet, new window for pet, but can't force window to send a prepend

Posted by Wire Razor on Tue 17 Nov 2015 04:58 PM — 11 posts, 43,143 views.

USA #0
I am on a MUCK called FurryMuck. I like it a lot. The sad thing is, I used to use BimpMU it had a pet feature, that would allow it to open a new window, just for a pet, and it would cut off, the prepend to what is sent to you, like for me I have, "Beast> " as my received prepend, and my send prepend is, "pet " BimpMU let me put that into the window, so that I can use my pet as if she was a whole new player... I have spent about a week trying to get the new window, that I am receiving my pet's messages, but when I try to send a look, command, from said window, it only sends look, to the first window, and not, "pet look" like I'd like it to. I have everything down, except this one thing. I don't mind the window always sending "Beast> " to me, as I know she is a pet, not a real player, but if that could be ironed out too... that would be very nice.

Thanks for reading... I hope this get's solved quickly...
Australia Forum Administrator #1
Quote:

my send prepend is, "pet " BimpMU let me put that into the window, so that I can use my pet as if she was a whole new player ...


Can you show what you did to (attempt to) achieve this? It should be do-able.

Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


You should be able to use a function like GetWorld to send things from one window to another.

Template:function=GetWorld
GetWorld

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

Amended on Tue 17 Nov 2015 07:46 PM by Nick Gammon
USA #2
Actually... I haven't a clue how... I've tried editing what it sends to the main window... but it seems to only send, what I've typed every time... but here is what I do have.


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Wedsday, November 17, 2015, 7:14  -->
<!-- MuClient version 4.13 -->

<!-- Plugin "pet_Input" generated by Wire Razor -->

<muclient>
<plugin
   name="pet_input"
   author="Wire Razor"
   id="fefa658aa8caca3cb5e2fa00"
   language="Lua"
   purpose="Works as a new window, for one's pet"
   date_written="2015-11-17 7:14:42"
   requires="4.00"
   version="1.0"
   >

</plugin>


<!--  Script  -->


<script>
<![CDATA[
world_name = "muck(wire)"

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>


The only bit I could see, that might work, was the "Return ("\t")" but... editing that, made no difference one way, or the other. I think I would need a new 'end -- OnPluginCommandEntered' but I don't know what I'd need to edit, to make that work like I would like. Again, thanks for looking at this.
Amended on Wed 18 Nov 2015 09:23 PM by Nick Gammon
Australia Forum Administrator #3
Can you clarify what you mean by a "new window for pet"?

Do you mean a separate world file, or just a different window in the current connection, so you only connect to the MUCK once?

The "miniwindow chat plugin" windows might be what you need.
USA #4
In one MUD I played for a few months, I had actually used the Chat Redirector plugin.

Template:post=7991
Please see the forum thread: http://gammon.com.au/forum/?id=7991.


I think that would do what you want, or at least could be a basis for what you're trying to accomplish. And I believe Nick even mentions an option for processing commands entered in the chat (in your case, pet-only communication) window and passing them back to the main one.
Amended on Wed 18 Nov 2015 10:04 PM by Daniel P
Australia Forum Administrator #5
Yes, that technique has been superseded a bit by using the miniwindow chat.

Quote:

... my send prepend is, "pet " ...


This sort-of hints at having two connections to the MUCK open, but perhaps if the OP clarifies.
USA #6
Ah right. I see that now. But what would be wrong with, say, making an assumption that every input in the Chat Redirect window should be therefore prefixed with "pet", and as such have something like:


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 ("pet " .. command)  -- execute command (handle aliases, etc.)
    PushCommand ("pet " .. command)  -- save in command history
  end -- if

  return ("\t")  -- clear command

end -- OnPluginCommandEntered


assuming that the triggers in the main world are redirecting only pet-related lines?
Australia Forum Administrator #7
That sounds OK to me, assuming that the OP wants two connections to the MUCK and not just one (or maybe not).

The initial post sounds a bit like one connection with some output being shoved into a different window.

If s/he doesn't mind typing "pet" in front of commands, then the miniwindow idea might be cleaner.
Amended on Thu 19 Nov 2015 04:55 AM by Nick Gammon
USA #8
Thanks Daniel... that is exactly what I was looking for... now to remove the "Beast> " from the window... not that it matters... but it would be nice.
USA #9
Woot! Awesome!!

So as for removing "Beast> ", I imagine that in the plugin loaded into your main world, you have a script that catches any text passed to it and sends it on to the chat window:


  if w then  -- if present
    for _, v in ipairs (styles) do
      w:ColourTell (RGBColourToName (v.textcolour), 
                    RGBColourToName (v.backcolour), 
                    v.text)
    end -- for each style run
    w:Note ("")  -- wrap up line

  end -- world found


What you could do is strip "Beast>" out of the v.text variable with string.find() and a bit of regex:


  if w then  -- if present
    for _, v in ipairs (styles) do
      str, en, cap = string.find(v.text, "^Beast\>%s+(.*)$")

      if cap == nil then
        cap = v.text
      end -- if
      
      w:ColourTell (RGBColourToName (v.textcolour), 
                    RGBColourToName (v.backcolour), 
                    cap) -- cleaned version of v.text or original text.
    end -- for each style run
    w:Note ("")  -- wrap up line

  end -- world found
Amended on Thu 19 Nov 2015 02:42 PM by Daniel P
USA #10
Thanks Daniel... That again, was exactly what I needed. Thanks.