Help - Search - Members - Calendar
Full Version: Mush And Echoing/#sayp Version Of Zmud
Achaea's Forums > Off-Topic > Tech Support
Dontarion
So I've switched to MUSH and I have an up-and-coming sans bugs system working. Now my main problem is echoing out to the prompt and inserting something as a prefix of the lines being displayed.

I've been searching the help files and forums with little luck so far.

Someone mentioned gag and reecho but I want to try and avoid this - It is obviously doable but gagging prompts I just try to avoid.
Soludra
I'm curious, why do you want to avoid gagging the prompt? If anything else wants to match on the prompt, and you gag/re-echo it, they still get to match the old one.

I mentioned to you before that I was working on a prompt plugin, to keep prompt modifications in one place (and allow a degree of configurability while I'm at it). If you want to wait for that, it would probably be an acceptable alternative. smile.gif
Dontarion
QUOTE (Soludra @ Aug 4 2009, 12:30 PM) *
I'm curious, why do you want to avoid gagging the prompt? If anything else wants to match on the prompt, and you gag/re-echo it, they still get to match the old one.

I mentioned to you before that I was working on a prompt plugin, to keep prompt modifications in one place (and allow a degree of configurability while I'm at it). If you want to wait for that, it would probably be an acceptable alternative. smile.gif


Yeah. All I'm hearing is write a plugin to handle this. Let me know about the plugin. What you writing it in?
Soludra
QUOTE (Dontarion @ Aug 4 2009, 12:21 PM) *
QUOTE (Soludra @ Aug 4 2009, 12:30 PM) *
I'm curious, why do you want to avoid gagging the prompt? If anything else wants to match on the prompt, and you gag/re-echo it, they still get to match the old one.

I mentioned to you before that I was working on a prompt plugin, to keep prompt modifications in one place (and allow a degree of configurability while I'm at it). If you want to wait for that, it would probably be an acceptable alternative. smile.gif


Yeah. All I'm hearing is write a plugin to handle this. Let me know about the plugin. What you writing it in?

Lua. It'll let other scripts add chunks of information, and the user can configure it to show only the info they want, in any order they want.

Of course, not even one line of code has been written yet, but that's how I want it to be. tongue.gif
Belus
I was looking at this earlier this week in an attempt to get triggers to fire on my prompt before it scrolled. I've since discovered the little box in MUSH's Configuration to do this. The strategy they're employing might work for you though.

http://www.gammon.com.au/forum/?id=9331
Soludra
QUOTE (Belus @ Aug 4 2009, 03:52 PM) *
I was looking at this earlier this week in an attempt to get triggers to fire on my prompt before it scrolled. I've since discovered the little box in MUSH's Configuration to do this. The strategy they're employing might work for you though.

http://www.gammon.com.au/forum/?id=9331

From discussing things with Dontarion earlier, it seems like he wants to add to the beginning or end of an incoming line, not just trigger on one.
Belus
QUOTE (Soludra @ Aug 4 2009, 04:15 PM) *
QUOTE (Belus @ Aug 4 2009, 03:52 PM) *
I was looking at this earlier this week in an attempt to get triggers to fire on my prompt before it scrolled. I've since discovered the little box in MUSH's Configuration to do this. The strategy they're employing might work for you though.

http://www.gammon.com.au/forum/?id=9331

From discussing things with Dontarion earlier, it seems like he wants to add to the beginning or end of an incoming line, not just trigger on one.

Yep! That's a MUSHclient forum discussion of how to use the OnPluginPacketReceived() function to append a newline to the prompt. I assume it wouldn't be hard to append or sub in other things.
Soludra
QUOTE (Belus @ Aug 4 2009, 04:20 PM) *
QUOTE (Soludra @ Aug 4 2009, 04:15 PM) *
QUOTE (Belus @ Aug 4 2009, 03:52 PM) *
I was looking at this earlier this week in an attempt to get triggers to fire on my prompt before it scrolled. I've since discovered the little box in MUSH's Configuration to do this. The strategy they're employing might work for you though.

http://www.gammon.com.au/forum/?id=9331

From discussing things with Dontarion earlier, it seems like he wants to add to the beginning or end of an incoming line, not just trigger on one.

Yep! That's a MUSHclient forum discussion of how to use the OnPluginPacketReceived() function to append a newline to the prompt. I assume it wouldn't be hard to append or sub in other things.

Right, yes. Unfortunately... doing it using OnPluginPacketReceived will affect what other triggers match on. It would modify the "standard" prompt so it's not really so standard, which could throw other triggers off. It's not really a great way to go.
Dontarion
Well, the prefix/suffix would all be known so I could easily set triggers to work for them. This is especially true regarding the prompt.
Dontarion
I've been working with that function. It doesn't look like it is going to be easy due to the color changes of Achaean prompts. I think the easiest thing may be to just create a few gsub entries with green, red, yellow hp entries and %1 out the rest of the color changes on mana and the others. I don't like how the function is accepting regular matching and not REGEX. I've gotten to used to REGEX now I can't really use that zScript TinTin style matching.
Belus
QUOTE (Dontarion @ Aug 4 2009, 06:25 PM) *
I've been working with that function. It doesn't look like it is going to be easy due to the color changes of Achaean prompts. I think the easiest thing may be to just create a few gsub entries with green, red, yellow hp entries and %1 out the rest of the color changes on mana and the others. I don't like how the function is accepting regular matching and not REGEX. I've gotten to used to REGEX now I can't really use that zScript TinTin style matching.

I don't really follow this since I'm pretty new to MUSH, but maybe it'll illuminate some things for you

Buhawi at http://achaea.ire-community.com/lofiversio....php/t3679.html
CODE
#--------------------Root of it all------------------
sub OnPluginPacketReceived {
    my $packet=@_[0];
    $packet=replace($packet);
    if ($terminatedpacket==1) {
$packet1=$packet;
    } else {
$packet1=$packet1.$packet;
    }
    if ($packet1 =~ /\x0d\x0a$/s) {
$terminatedpacket=1;
$packet1=parse($packet1);
return $packet1;
    } else {
$terminatedpacket=0;
return "";
    }
}

sub replace {
    my $packet=@_[0];
    my $basicprompt="\\x1b\\[(.*)m(\\d+)h,\\x1b\\[(.*)m\\x1b\\[(.*)m (\\d+)m\\x1b\\[(.*)m ([ckexdb]+)\\-\\xff\\xf9";
    $packet =~ s/$basicprompt/\x1b\[$1mHealth: $2\x1b\[$3m\x1b\[$4m Mana: $5\x1b\[$6m $7\-\x0d\x0a/g;
    $CurHealth=$1;
    $CurMana=$2;
    $PromptStatus=$3;
    $packet =~ s/\x20\x0d\x0a/\x20/g;
    return $packet;
}

sub parse {
#    my $packet=@_[0];
    my @lines=split(/\x0d\x0a/,$packet1);
    for my $ctr (@lines) {
$ctr=test($ctr);
    }
    my $packet=join("\x0d\x0a",@lines);
    $packet=$packet."\x0d\x0a";
    return $packet;
}
Dontarion
Thats definately not Lua. It looks like he is taking care of the coloring like I did with the old wholist triggers.
Soludra
Looks like it's VBscript, yeah.
Gorlasintan
I think it's Perl, actually.
Trevize
QUOTE (Gorlasintan @ Aug 4 2009, 10:05 PM) *
I think it's Perl, actually.

Correct.
Dontarion
QUOTE (Trevize @ Aug 5 2009, 04:16 AM) *
QUOTE (Gorlasintan @ Aug 4 2009, 10:05 PM) *
I think it's Perl, actually.

Correct.

What is with the \\x's in the line to match? Mean something specific for perl?
Gorlasintan
First \ escapes the second, so you can match '\x'.
Dontarion
If anyone wants to take a shot at this without using mush here is the packet debug:

I forgot to mention each of my prompt sets are green at this point. I'll do some for red, yellow, etc.

CODE
Sent  packet: 8 (6 bytes) at Wednesday, August 05, 2009, 10:20:02 AM

hwho..             68 77 68 6f 0d 0a

Incoming packet: 16 (284 bytes) at Wednesday, August 05, 2009, 10:20:02 AM

.[32mMember        1b 5b 33 32 6d 4d 65 6d 62 65 72 20 20 20 20 20
         Rank      20 20 20 20 20 20 20 20 20 52 61 6e 6b 20 20 20
   HTell  HNTell   20 20 20 48 54 65 6c 6c 20 20 48 4e 54 65 6c 6c
  Probation        20 20 50 72 6f 62 61 74 69 6f 6e 20 20 20 20 20
Class..------     20 43 6c 61 73 73 0d 0a 2d 2d 2d 2d 2d 2d 20 20
            ----   20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d
      -----  ---   20 20 20 20 20 20 2d 2d 2d 2d 2d 20 20 2d 2d 2d
---  ---------     2d 2d 2d 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 20
    -----...[37m   20 20 20 20 2d 2d 2d 2d 2d 0d 0a 1b 5b 33 37 6d
Nilix              4e 69 6c 69 78 20 20 20 20 20 20 20 20 20 20 20
      03           20 20 20 20 20 20 30 33 20 20 20 20 20 20 20 20
On      On        20 4f 6e 20 20 20 20 20 20 4f 6e 20 20 20 20 20
    No      Monk   20 20 20 20 4e 6f 20 20 20 20 20 20 4d 6f 6e 6b
...[32m2927h, .[   0d 0a 1b 5b 33 32 6d 32 39 32 37 68 2c 20 1b 5b
37m.[32m3434m, .   33 37 6d 1b 5b 33 32 6d 33 34 33 34 6d 2c 20 1b
[37m.[32m13535e,   5b 33 37 6d 1b 5b 33 32 6d 31 33 35 33 35 65 2c
.[37m.[32m14600   20 1b 5b 33 37 6d 1b 5b 33 32 6d 31 34 36 30 30
w .[37mex-ÿï
Trevize
huh.gif This is a ridiculously complex way to go about it.

Gag and redraw your prompt. It's simple. One trigger, one function for your script file, then just set prompt.append to a string whenever you want to add something.

CODE
<triggers>
  <trigger
   keep_evaluating="y"
   match="^\d+h(, \d+m)?(, \d+e)?(, \d+w)? [@cexkdb]*(?: Vote)?-"
   enabled="y"
   regexp="y"
   send_to="14"
   sequence="25">
    <send>prompt.data = TriggerStyleRuns
if prompt.append then prompt.draw () end
prompt.append = ""</send>
  </trigger>
</triggers>


CODE
prompt = {}
prompt.data = false
prompt.append = ""
prompt.draw = function ()
  DeleteLines (1)
  if prompt.data then
    for k,v in ipairs (prompt.data) do
      ColourTell (RGBColourToName (v.textcolour),
                  RGBColourToName (v.backcolour),
                  v.text)
    end -- for
  end -- if
  if prompt.append then ColourTell ("silver", "black", " " .. prompt.append) end
  Note ("")
end -- func
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.