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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  *Backwards* color bleeding using world.colourtell?

*Backwards* color bleeding using world.colourtell?

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


Pages: 1 2  3  

Posted by Neva   USA  (117 posts)  [Biography] bio
Date Tue 04 Feb 2003 04:44 PM (UTC)
Message
I'm doing a script that works in three parts. It's essentially just hiliting part of a line, but it can't be done any other way because of the way the line is sent. It's complicated.

But, in essence, what's happening is that I do, say,

world.colourtell "gray", "black", "Blah! "

in one 'sub' called by the first trigger. Then it turns on the second trigger.

Then,

world.colourtell "magenta", "black", "Magenta! "

with the second trigger. Which then turns itself off to wait for the first one again. Or that's it in essence, anyway. (Vastly simplified, but I have pretty much verified that the problem isn't related to the more complex bits.)

If I end the first colourtell with a vbCRLF or use colournote instead, the colors are done properly. And if I use multiple colourtells in the same trigger, it's fine.

But if I use them in multiple triggers, it goes back and converts the entire line to the color of the second colourtell.

So.. what's wrong with this picture?
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Wed 05 Feb 2003 08:42 PM (UTC)
Message
Can I clarify a couple of things here? You are matching on more than one line?

Line A is matched by trigger X which does a world.colourtell, and then enables trigger Y.

Line B which subsequently arrives is matched by trigger Y which also does a world.colourtell?

- Nick Gammon

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

Posted by Neva   USA  (117 posts)  [Biography] bio
Date Reply #2 on Wed 05 Feb 2003 08:50 PM (UTC)
Message
Pretty much. I have several lines arrive at once, that I want to be merged, but with one part highlighted. And they do properly show up on the same line, but somehow it seems to be screwing the colors up.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Thu 06 Feb 2003 09:09 PM (UTC)
Message
Although I haven't reproduced this bug, or possible bug :) , I suggest that what you are trying to do won't work, as such.

The problem is that I presume you are omitting the original lines in question, taking stuff from them and merging them into a new line you actually see with world.colourtell?

What will go wrong here is that the new line(s) (line B in my earlier post) are not omitted immediately, but placed in the output window, until a newline arrives, then the trigger omits them. What this means is that any partial line with world.colourtell will be terminated.

What I suggest you do is collect the prospective new line that you are assembling in variables, without displaying it yet, and then when it is all ready (eg. after 3 lines arrive) then display the whole lot - with consecutive world.colourtells if it is using different colours. That way the colourtells are all in one sequence, and should display OK.

- Nick Gammon

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

Posted by Neva   USA  (117 posts)  [Biography] bio
Date Reply #4 on Thu 06 Feb 2003 11:24 PM (UTC)
Message
But, see, the tells themselves work. It merges into one line perfectly. (All the multiple lines arrive at the exact same time; it's one set, the game just inserts line breaks.) The colors are the only thing that don't work properly.
[Go to top] top

Posted by Neva   USA  (117 posts)  [Biography] bio
Date Reply #5 on Sun 09 Feb 2003 11:31 PM (UTC)
Message
Nick? Anything?

Really, I swear, the only problem with it is that the colors for some reason aren't showing up right. The tells all happen perfectly. But for some reason, when done by separate scripts, the colors just don't work right.
[Go to top] top

Posted by Neva   USA  (117 posts)  [Biography] bio
Date Reply #6 on Sun 09 Feb 2003 11:49 PM (UTC)
Message
I'm amending this now, because I've been playing with other scripts, to see just where things are going wrong, and I'm beginning to come to the conclusion that world.ColourTell is just busted in general.

I.e.:

sub Test1 (sTrigName,sTrigOutput,aWildcards)
world.colourtell "red", "blue", "Test."
end sub

Use that, match it to anything you like, and what I get (in 3.32) is 'Test.'--in plain output colors.

Yet if I substitute 'colournote' for 'colourtell', it does in fact send the colors properly.

Then, I take it one step further.

sub Test1 (sTrigName,sTrigOutput,aWildcards)
world.colourtell "yellow", "blue", "Test."
world.colourtell "red", "blue", "Test."
end sub

This produces the first tell in proper colors... but the second in standard output. It's not, in effect, coloring in whatever shade it's supposed to be until it receives either another world.colortell or a linebreak. Where the *expected* behavior is that no matter what it contains, no matter what it follows or precedes, the colors should appear as requested.

Get any more complicated than that, and I start running into behavior I can't even possibly explain.

sub Test1 (sTrigName,sTrigOutput,aWildcards)
world.colourtell "yellow", "blue", "Test1."
end sub

sub Test2 (sTrigName,sTrigOutput,aWildcards)
world.colourtell "blue", "yellow", "Test2."
end sub

If Test1 is a Trigger that matches 'Blah1', and Test2 is a trigger that matches 'Blah2', both omitting from output, and each string arrives on a separate line one after the other, like so...

Blah1
Blah2

...then you'd expect that at the very least, you'd end up with the two colourtells on separate lines, but working otherwise. No such luck; what you get is:

Test2.

in plain output colors, no "Test1." anywhere to be seen.

Every single one of these examples works as expected using colournote instead, with the obvious addition of a line break in between. Yet not one of them works as expected using colourtell.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Mon 10 Feb 2003 10:39 PM (UTC)
Message
Quote:

Nick? Anything?


Sorry, was doing other things for a couple of days. I'll take your test data and see if I can reproduce it, and if so, fix it, so it can go in the next version.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #8 on Mon 10 Feb 2003 10:41 PM (UTC)
Message
Quote:

...then you'd expect that at the very least, you'd end up with the two colourtells on separate lines, but working otherwise.


Do you have "keep evaluating" checked on both triggers? Otherwise only one will fire.

- Nick Gammon

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

Posted by Neva   USA  (117 posts)  [Biography] bio
Date Reply #9 on Mon 10 Feb 2003 11:00 PM (UTC)
Message
Tried turning it on, it made no difference. They aren't on the same line, so that shouldn't pertain, should it?
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #10 on Thu 13 Mar 2003 11:58 PM (UTC)
Message
Quote:

Then, I take it one step further.

sub Test1 (sTrigName,sTrigOutput,aWildcards)
world.colourtell "yellow", "blue", "Test."
world.colourtell "red", "blue", "Test."
end sub



Yes, I can reproduce that. It is a bug. :)

- Nick Gammon

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

Posted by Guest1   USA  (256 posts)
Date Reply #11 on Fri 14 Mar 2003 12:48 AM (UTC)
Message
re the colour tells, if this helps, I've found that if you're doing a series of mixed colour tells in one line like that, the last one in the 'series' needs to be a World.ColourNote, the previous ones all scripted as World.ColorTell. It appears that the same applies if you're doing 2 separate routines where there is no activity between them being run, if that makes sense. Try that.
[Go to top] top

Posted by Guest1   USA  (256 posts)
Date Reply #12 on Fri 14 Mar 2003 01:16 AM (UTC)

Amended on Fri 14 Mar 2003 02:11 AM (UTC) by Guest1

Message
Nick said in reply to above: "I think the problem is, you don't necessarily know which is the last colourtell."

I don't know if that was the issue when I reread this thread.. I think Neva knows what 'order' the trigger lines were coming in (Neva: "All the multiple lines arrive at the exact same time, it's one set, the game just inserts line breaks"), even though they were all 'at once' so to speak, if I read it correctly, there still is an order to them?
I mean with this example Neva gave


sub Test1 (sTrigName,sTrigOutput,aWildcards)
world.colourtell "yellow", "blue", "Test."
world.colourtell "red", "blue", "Test."
end sub


just change that last bit to colournote instead of colourtell and it's fine.

..although, if Neva means that the above is one subroutine and then he wanted a separate subroutine to add on to the SAME line produced by the above one.. yeah then I see the problem. As I see it, World.ColourNote basically ends the line, anything following would be on a new line, right? Whereas World.ColourTell is waiting for another bit of script to follow it (whether it's world.ColourTell or World.ColourNote does not matter) before it will spit out the desired piece of that line in the correct format.

If that's the case, then this becomes something like multi-line triggering which is an entirely different matter. Am I on the right track here?

addon:

yeah rereading this thread again, and I think I'm on the right track. Nick you suggested on Thu 06 Feb 2003 04:09 PM what I would too, to use variables.

Neve replied "But, see, the tells themselves work. It merges into one line perfectly. ..The colors are the only thing that don't work properly"

and that's because the last one that is sent is a World.ColorTell and not a World.ColorNote.

In this example Neva gave:

Quote:


sub Test1 (sTrigName,sTrigOutput,aWildcards)
world.colourtell "yellow", "blue", "Test1."
end sub

sub Test2 (sTrigName,sTrigOutput,aWildcards)
world.colourtell "blue", "yellow", "Test2."
end sub

If Test1 is a Trigger that matches 'Blah1', and Test2 is a trigger that matches 'Blah2', both omitting from output, and each string arrives on a separate line one after the other, like so...

Blah1
Blah2

...then you'd expect that at the very least, you'd end up with the two colourtells on separate lines, but working otherwise. No such luck; what you get is:

Test2.

in plain output colors, no "Test1." anywhere to be seen.



if you changed the second one to World.ColourNote, does it work as desired? Guess I should try it for myself.


...( a few minutes later)

no it doesn't work, and that does not surprise me. They are still separate triggers and separate subroutines and the example above will only work if both are world.colorNote and then they display on separate lines.
The reason only Test2 came out in the above example is not immediately clear to me, I guess MC had to do something and that was it :) but it still sounds like multiline triggering as far as I can see.

For example, on the mud I play if I type: save demon
what comes back is:
demon saved.
items saved.

both arrive 'at the same time', but they are still separate lines.
Neva you said "But, see, the tells themselves work. It merges into one line perfectly. ..The colors are the only thing that don't work properly"
I don't see how it worked, because you then gave the example above which clearly doesn't work. Are you saying that somehow you already have 3 seperate subroutines that are each doing worldnotes and they all merge onto one line? Maybe I'm just confusing myself here, but I didn't think that was possible.

When I tried my example using your script above and 'save demon' from the mud I use as above, although I had omit from output selected, I still saw the output.. what I got was

demon saved.
Test2. items saved.

since you are repeating the same line but trying to repeat them in colour, maybe you thought it was merging the lines when in fact it wasn't. See what I mean? It's just spitting out whatever it can..
[Go to top] top

Posted by Guest1   USA  (256 posts)
Date Reply #13 on Fri 14 Mar 2003 02:28 AM (UTC)
Message
On my way offline, but another thing worth trying, how about putting a short delays on all the subroutines, so in my example the mud spat out

demon saved.
items saved.

the trigger saw 'demon saved.' and tried to spit out 'colourtell Test1', but this was then follwed by the script seeing 'items saved.' so it basically spat the dummy.

This may not work but try having a delay on all of the triggered subroutines, so the other lines of triggered text have a chance to come out (even if it seems like they are all at the same time, they are still spearate lines nevertheless)

so in above mud would spit out

demon saved.
items saved.

(which would hopefully be omitted by the triggers), and the first triggered routine sees 'demon saved.' and waits 1 second.. during that 1 second delay, the next trigger sees 'items saved.' and it's corresponding subroutine also waits for 1 second.. then 1 second later the first routine sends out 'demon saved.' as a colourtell followed immediately by the 2nd routine sending out colournote 'items saved.' ..so nothing inbetween, if you get me.. maybe that works? I doubt it, but ya never know.

I'd try but dont have time left to do so atm.
cya
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #14 on Fri 14 Mar 2003 04:19 AM (UTC)

Amended on Fri 14 Mar 2003 04:21 AM (UTC) by Nick Gammon

Message
Quote:

sub Test1 (sTrigName,sTrigOutput,aWildcards)
world.colourtell "yellow", "blue", "Test."
world.colourtell "red", "blue", "Test."
end sub


OK, I think I see the problem, but am not absolutely certain what is the best solution. :)

Here is what is happening, I think. :P

Say you get two lines "A" and "B". You have a trigger matching "A" that sends "X" and "Y" in two different colours using world.ColourTell.

What actually happens is this is displayed:

A
XYB

Due to this "bug" (sorry, Neva) the B is not put on a new line, *and* bleeds the default output colour backwards to the "Y". This I think describes what is happening. (Note to myself: see function SetNewLineColour).

There could be two fixes:

  1. Fix this backwards bleeding.
  2. Make "B" start a new line. I am leaning towards that, as technically "B" is not a note and should therefore not share a line with a note/tell.


In other words, one or more world.colourtells would automatically be terminated (eg. a new line started) when a non-note/tell is received.

Any comments?

Quote:

No such luck; what you get is:

Test2.

in plain output colors, no "Test1." anywhere to be seen.


I think my evaluation explains this as well. By merging notes and MUD output onto one line, the "omit from output" actually omits the line with the colourtell in it as well.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[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.


75,357 views.

This is page 1, subject is 3 pages long: 1 2  3  [Next page]

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]