The Wiki for Tale 6 is in read-only mode and is available for archival and reference purposes only. Please visit the current Tale 11 Wiki in the meantime.
If you have any issues with this Wiki, please post in #wiki-editing on Discord or contact Brad in-game.
Difference between revisions of "User:Pheros/paint script"
From ATITD6
Jump to navigationJump to search| Line 60: | Line 60: | ||
	end  | 	end  | ||
| − | 	while   | + | --  Number of runs: count   | 
| + | |||
| + | 	numcount = promptNumber("How many  passes ?", 1);  | ||
| + | |||
| + | 	while count<numcount do  | ||
		-- Where to start putting buttons/text on the screen.  | 		-- Where to start putting buttons/text on the screen.  | ||
| Line 193: | Line 197: | ||
			clickpos= srFindImage("Takepaint.png");  | 			clickpos= srFindImage("Takepaint.png");  | ||
			srClickMouseNoMove(clickpos[0]+5, clickpos[1]+1, 0 );  | 			srClickMouseNoMove(clickpos[0]+5, clickpos[1]+1, 0 );  | ||
| + | 			count=count+1;  | ||
		if (lsShiftHeld() and lsControlHeld()) then  | 		if (lsShiftHeld() and lsControlHeld()) then  | ||
Revision as of 19:11, 29 March 2012
 
--for mass paint making...
paint_colourR = { 129, 225, 129, 112, 48,  128, 145, 81,  16,  97,  64  };
paint_colourG = { 64,  113, 97,  64,  96,  240, 16,  81,  16,  48, 194  };
paint_colourB = { 145, 33,  33,  64,  48,  224, 24,  97,  32,  33, 194  };
catalyst1 = 12;
loadfile("luaScripts/screen_reader_common.inc")();
loadfile("luaScripts/ui_utils.inc")();
--create your own png file of *take the paint* from pigment lab
clickpos = "Takepaint.png";
button_names = {
"CabbageJ","Carrot","Clay","DeadTongue","ToadSkin","EarthLight","RedSand",
"Lead","SilverP","Iron","Copper","C:Sulfur","C:potash","C:Lime","C:Saltpeter"}; 
per_paint_delay_time = 1000;
per_read_delay_time = 600;
per_click_delay = 10;
--function doit()
	local paint_sum = {0,0,0};
	local paint_count = 0;
	local bar_colour = {0,0,0};
	local expected_colour = {0,0,0};
	local diff_colour = {0,0,0};
	local new_px = 0xffffffFF;
	local px_R = nil;
	local px_G = nil;
	local px_B = nil;
	local px_A = nil;
	local m_x = 0;
	local m_y = 0;
	local update_now = 1;
	local y=0;
	local button_push = 0;
	lsSetCaptureWindow();
	askForWindow("Open the paint window. Take any paint away so to start with 'Black'.");
	srReadScreen();
	xyWindowSize = srGetWindowSize();
	local colour_panel = findAllImages("paint-black.png");
	if (#colour_panel == 0) then
		m_x, m_y = srMousePos();
	else
		m_x = colour_panel[1][0];
		m_y = colour_panel[1][1];	
	end
	local paint_buttons = findAllImages("paint-button.png");
	if (#paint_buttons == 0) then
		error "No buttons found";
	end
--  Number of runs: count 
	numcount = promptNumber("How many  passes ?", 1);
	while count<numcount do
		-- Where to start putting buttons/text on the screen.
		y=0;
		-- Create each button and set the button push.
		for i=1, #button_names do
			if lsButtonText(10, y, 0, 250, 0xFFFFFFff, button_names[i]) then
				image_name = button_names[i];
				update_now = 1;
				button_push = i;
			end
			y = y + 26;
		end
		srReadScreen();
		if not(update_now==0) then
		--{
-- add recipe with number of incredient starting here:
-- click the appropriate button to add paint. incregient 1
button_push = 1;
			if not (button_push==0) then
			--{
				srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push]
[1]+2, right_click);
				lsSleep(per_click_delay);
						--}
			end
-- click the appropriate button to add paint. incregient 2
button_push = 1;
			if not (button_push==0) then
			--{
				srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push]
[1]+2, right_click);
				lsSleep(per_click_delay);
						--}
			end
-- click the appropriate button to add paint. incregient 3
button_push = 1;
			if not (button_push==0) then
			--{
				srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push]
[1]+2, right_click);
				lsSleep(per_click_delay);
						--}
			end
-- click the appropriate button to add paint. incregient 4
button_push = 1;
			if not (button_push==0) then
			--{
				srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push]
[1]+2, right_click);
				lsSleep(per_click_delay);
						--}
			end
-- click the appropriate button to add paint. incregient 5
button_push = 1;
			if not (button_push==0) then
			--{
				srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push]
[1]+2, right_click);
				lsSleep(per_click_delay);
						--}
			end
-- click the appropriate button to add paint. incregient 6
button_push = 1;
			if not (button_push==0) then
			--{
				srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push]
[1]+2, right_click);
				lsSleep(per_click_delay);
						--}
			end
-- click the appropriate button to add paint. incregient 7
button_push = 1;
			if not (button_push==0) then
			--{
				srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push]
[1]+2, right_click);
				lsSleep(per_click_delay);
						--}
			end
-- click the appropriate button to add paint. incregient 8
button_push = 1;
			if not (button_push==0) then
			--{
				srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push]
[1]+2, right_click);
				lsSleep(per_click_delay);
						--}
			end
-- click the appropriate button to add paint. incregient 9
button_push = 1;
			if not (button_push==0) then
			--{
				srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push]
[1]+2, right_click);
				lsSleep(per_click_delay);
						--}
			end
-- click the appropriate button to add paint. incregient 10
button_push = 1;
			if not (button_push==0) then
			--{
				srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push]
[1]+2, right_click);
				lsSleep(per_click_delay);
						--}
			end
			-- count up all the pixels.
			lsSleep(per_paint_delay_time);
			srReadScreen();
			clickpos= srFindImage("Takepaint.png");
			srClickMouseNoMove(clickpos[0]+5, clickpos[1]+1, 0 );
			count=count+1;
			
		if (lsShiftHeld() and lsControlHeld()) then
			error 'broke out of loop from Shift+Ctrl';
		end
		--}
		end
	end