How to keep the original color of the mud output that matched by the wait.regexp

Posted by Killunix on Sun 05 Sep 2010 12:16 PM — 6 posts, 23,871 views.

#0
How to keep the original color of the mud output that matched by the wait.regexp?
For example: the following image is the mud output that has the original color
http://lh3.ggpht.com/_t0oKqYjPmEo/TIOH9QkW9KI/AAAAAAAAAJY/QV7LXvzZrf0/Original%20Color.jpg"
I use the wait.regexp function to cap the mud output, then the color changed.like this:
http://lh5.ggpht.com/_t0oKqYjPmEo/TIOH9vPv_MI/AAAAAAAAAJc/fhdq4SV-xys/ChangebyRegexp.jpg


Thanks!
Amended on Sun 05 Sep 2010 12:59 PM by Killunix
USA #1
Template:what
Please help us by showing:
  • A copy of the trigger, alias or timer you were using (see Copying XML)
  • The error message, if any, that you got
Australia Forum Administrator #2
You get the style runs and draw using those. See this and watch the video if necessary:

http://www.gammon.com.au/forum/bbshowpost.php?id=9965
Amended on Tue 26 Nov 2013 03:45 AM by Nick Gammon
#3
I have watched your video carefully,I still don't know how can modify the coder to keep the original styles.My code as follows:


function hyd_yzm()
	local count=0
	yzm={}
	wait.make(function()
		repeat
			lines,wildchards=wait.regexp(".+")
				table.insert(yzm,lines)
				count=count+1
		until count>=25
		Execute("answer "..getyzm())
	end)
end
Australia Forum Administrator #4
In my forum post that accompanied that video I had:


local line, wildcards, styles = wait.match ("*")


You don't have the styles do you? That is what has the colours in it. The style runs. The line is the plain text. The style runs has each style in its own colours.
#5
Done!
Thanks you very much.