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(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | You will need the following picture file: | ||
+ | |||
+ | [[File:Takepaint.png]] | ||
+ | |||
+ | |||
+ | |||
+ | and [[http://www.atitd.org/wiki/tale5/File:Veggie_paint_watch.zip this script for veggietales]] | ||
+ | |||
+ | then copy the following in white box to a text file and save as .lua file in your lua-scripts folder | ||
+ | |||
<pre> | <pre> | ||
Line 10: | Line 20: | ||
loadfile("luaScripts/screen_reader_common.inc")(); | loadfile("luaScripts/screen_reader_common.inc")(); | ||
loadfile("luaScripts/ui_utils.inc")(); | loadfile("luaScripts/ui_utils.inc")(); | ||
− | |||
− | |||
clickpos = "Takepaint.png"; | clickpos = "Takepaint.png"; | ||
+ | count = 0; | ||
button_names = { | button_names = { | ||
Line 43: | Line 52: | ||
lsSetCaptureWindow(); | lsSetCaptureWindow(); | ||
− | askForWindow(" | + | askForWindow("Set your batch size (if avaiable) to your needings. "); |
srReadScreen(); | srReadScreen(); | ||
Line 59: | Line 68: | ||
error "No buttons found"; | error "No buttons found"; | ||
end | end | ||
+ | |||
+ | |||
-- Number of runs: count | -- Number of runs: count | ||
+ | numcount = promptNumber("How many passes ?", 1); | ||
+ | |||
+ | askForWindow ("Incredients go in order from top to bottom as followed:; 0 to cancel , 1 Cabbage , 2 Carrot , 3 Clay , 4 DeadTongue , 5 ToadSkin , 6 EarthLight , 7 RedSand , 8 Lead, 9 Silverpowder , 10 Iron , 11 Copper , 12 Sulfur , 13 Potash . 14 Lime , 15 Saltpeter "); | ||
+ | |||
+ | -- incredient number 1: | ||
+ | button1 = promptNumber("Which 1st incredient? ", 0); | ||
+ | -- incredient number 2: | ||
+ | button2 = promptNumber("Which 2nd incredient?", 0); | ||
+ | -- incredient number 3: | ||
+ | button3 = promptNumber("Which 3rd incredient?", 0); | ||
+ | -- incredient number 4: | ||
+ | button4 = promptNumber("Which 4th incredient?", 0); | ||
+ | -- incredient number 5: | ||
+ | button5 = promptNumber("Which 5th incredient?", 0); | ||
+ | -- incredient number 6: | ||
+ | button6 = promptNumber("Which 6th incredient?", 0); | ||
+ | -- incredient number 7: | ||
+ | button7 = promptNumber("Which 7th incredient?", 0); | ||
+ | -- incredient number 8: | ||
+ | button8 = promptNumber("Which 8th incredient?", 0); | ||
+ | -- incredient number 9: | ||
+ | button9 = promptNumber("Which 9th incredient?", 0); | ||
+ | -- incredient number 10: | ||
+ | button10 = promptNumber("Which 10th incredient?", 0); | ||
+ | -- incredient number 11: | ||
+ | button11 = promptNumber("Which 11th incredient?", 0); | ||
+ | -- incredient number 12: | ||
+ | button12 = promptNumber("Which 12th incredient?", 0); | ||
− | |||
while count<numcount do | while count<numcount do | ||
Line 86: | Line 124: | ||
--{ | --{ | ||
− | + | -- click the appropriate button to add paint. 1 | |
− | + | button_push = button1; | |
− | |||
− | -- click the appropriate button to add paint. | ||
− | button_push = | ||
if not (button_push==0) then | if not (button_push==0) then | ||
--{ | --{ | ||
− | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push] | + | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push][1]+2, right_click); |
− | |||
− | [1]+2, right_click); | ||
lsSleep(per_click_delay); | lsSleep(per_click_delay); | ||
--} | --} | ||
end | end | ||
− | -- click the appropriate button to add paint. | + | -- click the appropriate button to add paint. 2 |
− | button_push = | + | button_push = button2; |
if not (button_push==0) then | if not (button_push==0) then | ||
--{ | --{ | ||
− | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push] | + | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push][1]+2, right_click); |
− | |||
− | [1]+2, right_click); | ||
lsSleep(per_click_delay); | lsSleep(per_click_delay); | ||
--} | --} | ||
end | end | ||
− | -- click the appropriate button to add paint. | + | -- click the appropriate button to add paint. 3 |
− | button_push = | + | button_push = button3; |
if not (button_push==0) then | if not (button_push==0) then | ||
--{ | --{ | ||
− | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push] | + | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push][1]+2, right_click); |
− | |||
− | [1]+2, right_click); | ||
lsSleep(per_click_delay); | lsSleep(per_click_delay); | ||
--} | --} | ||
end | end | ||
− | -- click the appropriate button to add paint. | + | -- click the appropriate button to add paint. 4 |
− | button_push = | + | button_push = button4; |
if not (button_push==0) then | if not (button_push==0) then | ||
--{ | --{ | ||
− | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push] | + | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push][1]+2, right_click); |
− | |||
− | [1]+2, right_click); | ||
lsSleep(per_click_delay); | lsSleep(per_click_delay); | ||
--} | --} | ||
end | end | ||
− | -- click the appropriate button to add paint. | + | -- click the appropriate button to add paint. 5 |
− | button_push = | + | button_push = button5; |
if not (button_push==0) then | if not (button_push==0) then | ||
--{ | --{ | ||
− | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push] | + | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push][1]+2, right_click); |
− | |||
− | [1]+2, right_click); | ||
lsSleep(per_click_delay); | lsSleep(per_click_delay); | ||
--} | --} | ||
end | end | ||
− | -- click the appropriate button to add paint. | + | -- click the appropriate button to add paint. 6 |
− | button_push = | + | button_push = button6; |
if not (button_push==0) then | if not (button_push==0) then | ||
--{ | --{ | ||
− | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push] | + | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push][1]+2, right_click); |
− | |||
− | [1]+2, right_click); | ||
lsSleep(per_click_delay); | lsSleep(per_click_delay); | ||
--} | --} | ||
end | end | ||
− | -- click the appropriate button to add paint. | + | -- click the appropriate button to add paint. 7 |
− | button_push = | + | button_push = button7; |
if not (button_push==0) then | if not (button_push==0) then | ||
--{ | --{ | ||
− | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push] | + | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push][1]+2, right_click); |
− | |||
− | [1]+2, right_click); | ||
lsSleep(per_click_delay); | lsSleep(per_click_delay); | ||
--} | --} | ||
end | end | ||
− | -- click the appropriate button to add paint. | + | -- click the appropriate button to add paint. 8 |
− | button_push = | + | button_push = button8; |
if not (button_push==0) then | if not (button_push==0) then | ||
--{ | --{ | ||
− | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push] | + | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push][1]+2, right_click); |
− | |||
− | [1]+2, right_click); | ||
lsSleep(per_click_delay); | lsSleep(per_click_delay); | ||
--} | --} | ||
end | end | ||
− | -- click the appropriate button to add paint. | + | -- click the appropriate button to add paint. 9 |
− | button_push = | + | button_push = button9; |
if not (button_push==0) then | if not (button_push==0) then | ||
--{ | --{ | ||
− | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push] | + | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push][1]+2, right_click); |
− | |||
− | [1]+2, right_click); | ||
lsSleep(per_click_delay); | lsSleep(per_click_delay); | ||
--} | --} | ||
end | end | ||
− | -- click the appropriate button to add paint. | + | -- click the appropriate button to add paint. 10 |
− | button_push = | + | button_push = button10; |
if not (button_push==0) then | if not (button_push==0) then | ||
--{ | --{ | ||
− | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push] | + | srClickMouseNoMove(paint_buttons[button_push][0]+2,paint_buttons[button_push][1]+2, right_click); |
+ | lsSleep(per_click_delay); | ||
+ | --} | ||
+ | end | ||
− | [1]+2, right_click); | + | -- click the appropriate button to add paint. 11 |
+ | button_push = button11; | ||
+ | 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); | lsSleep(per_click_delay); | ||
--} | --} | ||
end | end | ||
+ | -- click the appropriate button to add paint. 12 | ||
+ | button_push = button12; | ||
+ | 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. | -- count up all the pixels. | ||
Line 198: | Line 230: | ||
srClickMouseNoMove(clickpos[0]+5, clickpos[1]+1, 0 ); | srClickMouseNoMove(clickpos[0]+5, clickpos[1]+1, 0 ); | ||
count=count+1; | count=count+1; | ||
− | |||
if (lsShiftHeld() and lsControlHeld()) then | if (lsShiftHeld() and lsControlHeld()) then | ||
error 'broke out of loop from Shift+Ctrl'; | error 'broke out of loop from Shift+Ctrl'; | ||
Line 206: | Line 237: | ||
end | end | ||
+ | --end | ||
+ | |||
+ | |||
</pre> | </pre> |
Latest revision as of 19:53, 30 March 2012
You will need the following picture file:
and [this script for veggietales]
then copy the following in white box to a text file and save as .lua file in your lua-scripts folder
--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")(); clickpos = "Takepaint.png"; count = 0; 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("Set your batch size (if avaiable) to your needings. "); 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); askForWindow ("Incredients go in order from top to bottom as followed:; 0 to cancel , 1 Cabbage , 2 Carrot , 3 Clay , 4 DeadTongue , 5 ToadSkin , 6 EarthLight , 7 RedSand , 8 Lead, 9 Silverpowder , 10 Iron , 11 Copper , 12 Sulfur , 13 Potash . 14 Lime , 15 Saltpeter "); -- incredient number 1: button1 = promptNumber("Which 1st incredient? ", 0); -- incredient number 2: button2 = promptNumber("Which 2nd incredient?", 0); -- incredient number 3: button3 = promptNumber("Which 3rd incredient?", 0); -- incredient number 4: button4 = promptNumber("Which 4th incredient?", 0); -- incredient number 5: button5 = promptNumber("Which 5th incredient?", 0); -- incredient number 6: button6 = promptNumber("Which 6th incredient?", 0); -- incredient number 7: button7 = promptNumber("Which 7th incredient?", 0); -- incredient number 8: button8 = promptNumber("Which 8th incredient?", 0); -- incredient number 9: button9 = promptNumber("Which 9th incredient?", 0); -- incredient number 10: button10 = promptNumber("Which 10th incredient?", 0); -- incredient number 11: button11 = promptNumber("Which 11th incredient?", 0); -- incredient number 12: button12 = promptNumber("Which 12th incredient?", 0); 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 --{ -- click the appropriate button to add paint. 1 button_push = button1; 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. 2 button_push = button2; 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. 3 button_push = button3; 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. 4 button_push = button4; 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. 5 button_push = button5; 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. 6 button_push = button6; 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. 7 button_push = button7; 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. 8 button_push = button8; 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. 9 button_push = button9; 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. 10 button_push = button10; 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. 11 button_push = button11; 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. 12 button_push = button12; 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 --end