[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Bug reports
. . -> [Subject]  Possible bug...

Possible bug...

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


Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Sun 09 Jun 2002 09:21 PM (UTC)

Amended on Sun 09 Jun 2002 09:25 PM (UTC) by Shadowfyr

Message
Trying to work around the auto-wrap on my mud I am using this:

Trigger (reg exp): ^([ ]*)[newbie](.*)
Calling the following script>
sub setcolorgrab (trigname, output, wildcards)
  dim exptemp
  exptemp = "^  ([ ]*)(.*)"
  select case trigname
    case "Newbie"
      world.addtrigger "Colorcode", exptemp, "", 1065, 7, 0, "", ""
    case "General"
      world.addtrigger "colorcode", exptemp, "", 1065, -1, 0, "", ""
    case "General2"
      world.addtrigger "colorcode", exptemp, "", 1065, -1, 0, "", ""
    case "General3"
      world.addtrigger "colorcode", exptemp, "", 1065, -1, 0, "", ""
    case "Sales"
      world.addtrigger "Colorcode", exptemp, "", 1065, 8, 0, "", ""
    case "Hero"
      world.addtrigger "Colorcode", exptemp, "", 1065, 0, 0, "", ""
  end select
end sub

I then have another trigger for this like this:
^([ ]*)([[:alnum:]]+)(.*)

which calls the same script with the General2 name to stop the coloring. Now the problem is this, when I recieve a series of line that need to be colored I get:
[sales] Turbo: wts Thinking cap, Light elven platemail, Black cloak,     <- colored correctly by initial trigger.
               Light elven platemail, A sturdy leather belt, Light elven <- colored correctly by the capture trigger.
               platemail                                                 <- colored incorrectly (as 'no change').
[bs]: Mirak goes "You've got mail."

It appears that changing the triggers color setting 'while' the current line is still pending, i.e. no new info has been recieved, is incorrectly coloring the current line, even though the line that changes this setting is recieved 'after' the color should have already been changed. :p
[Go to top] top

Posted by Nick Gammon   Australia  (22,981 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sun 09 Jun 2002 10:14 PM (UTC)
Message
Quote:

I then have another trigger for this like this:
^([ ]*)([[:alnum:]]+)(.*)


On a cursory glance, it seems to me that the line:


   platemail


will match this trigger, thus turning the colouring off.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #2 on Sun 09 Jun 2002 10:47 PM (UTC)
Message
It shouldn't, if it did then so would the previous line with 'Light' in it. The ^ should be start of line and the ([ ]*) should mean one or no spaces, therefor since the indented lines have more than one space it should not match on anything but a line that starts with a single space then alphanumeric, or or just the alphanumeric. It couldn't think of a better what to make an exclusionary trigger that would match on anything 'except' then indented stuff. If it is doing what you say, then I need to change several dozen others as well. The main indent matcher 'requires' at least two spaces to match, so I assumed this was right. :p Matches do a pretty good job of 'and/or', but I am trying for 'not', this complicates things. ;) Same problem with colors, where I could have simple told it 'match anything -not- Blue on Black'.

Any better suggestion on how to test for the leading space I sometimes get from the mud, without also matching stuff I don't want?
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #3 on Sun 09 Jun 2002 11:05 PM (UTC)
Message
Hmm. Looks like I could use:

^\s{0,1}[newbie](.*) or ^([ ]?)[newbie](.*)
^\s{3,}([ ]*)(.*) or ^{[ ]?}([ ]*)(.*)
and
^\s{0,1}(.*) or ^([ ]?)(.*)

instead, but don't have time to test today to see if they work as expected. Sigh.. What I wouldn't give for a sort of false proxy that would simply echo back anything I typed in the command window, while making the client think it was really online. Would make testing this sort of thing offline a lot easier 'and' safer. Sadly I haven't a clue how to even try to write one. :p

But I guess you are right about the version I am using. I assumed * was one or less, not 0 or more, the fact that it isn't means 90% of my triggers are wrong anyway. :p
[Go to top] top

Posted by Nick Gammon   Australia  (22,981 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Sun 09 Jun 2002 11:29 PM (UTC)
Message
Yes indeed. From the regular expression documentation:


For convenience (and  historical  compatibility)  the  three most common quantifiers 
have single-character abbreviations:

       *    is equivalent to {0,}
       +    is equivalent to {1,}
       ?    is equivalent to {0,1}

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,981 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Sun 09 Jun 2002 11:31 PM (UTC)
Message
You might be better looking for something a chat channel doesn't have (eg. a prompt). So, use "*" (match all) until you get such a line.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #6 on Mon 10 Jun 2002 12:04 AM (UTC)
Message
Actually no, a prompt is a bad match, since if I am idle or something I can recieve a mess of channel messages or even tells, some I color, some I don't. As a result I need it to reset on anything channel or otherwise that is not specifically indented. Though... I got my terminator wrong... I need the 'any non-white space' match, not '(.*)'. Sigh... I really, really hate regular expressions sometimes. lol
[Go to top] top

Posted by Nick Gammon   Australia  (22,981 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Mon 10 Jun 2002 12:22 AM (UTC)
Message
That was an example. From your example you had:


[sales] blah blah


So, you could say, if a line started with "<" (a prompt) or "[" (a channel), cancel the previous chat.

Also, if the MUD uses colours, you can probably find a colour that indicates the end of a chat.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,981 posts)  [Biography] bio   Forum Administrator
Date Reply #8 on Mon 10 Jun 2002 12:23 AM (UTC)
Message
And tells? Have a trigger like this:

* tells you, *

That could cancel the chat colouring.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #9 on Mon 10 Jun 2002 12:54 AM (UTC)

Amended on Mon 10 Jun 2002 12:59 AM (UTC) by Shadowfyr

Message
I think my way is more universal actually. I have it so 'any' channels that use [] automatically either set a color or failing that fall through a final trigger to use General to turn it off. I also have one to match tells, but some help files and other places contain indents and the only color change does not happen at the end of the channels that I can tell. Basically a universal trigger like '^\s?\S(.*)' should work, since that is 0 or 1 spaces followed by 1 non-whitespace, then everything else. That should match 99% of everything the mud can send, except the channels, which is what I want. My prompt also can't produce the match you suggest because I intentionally added a \n to it so I could still let it provide me with information, but not have to test for the whole blasted thing every time. All I have to check for is the one trailing space the mud sends, even after a linefeed on the prompt. Makes life a lot easier, but at the time I wasn't trying to work around the forced auto-wrap this way and '^([ ]*)' was, I thought, perfectly functional. I didn't think to look it up, since the source seemed to know what they where doing. ;)

Also, I believe the mud may be only sending a color change when needed, like on a new line, instead of terminating everything with low-intense white. I did consider this as an option though, but couldn't think of any certain way to make it fool proof. So there would be almost any color, possibly including the color normally used for channels, that could be part of a new, non-chat line.
[Go to top] 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.


14,457 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]