--[[ Author: "Elverion" - admin@solarstrike.net License: Public Domain Requires: MicroMacro 1.03 or newer Character and resolution must be set properly before use. Refer to the below tables to lookup valid options. Character will be all lowercase and follow the format 'race_sex' where race is 'human', 'dwarf', 'gnome', 'elf', or 'porkul' and sex will be either 'm' or 'f'. Resolution will follow the format widthxheight ]] local character = 'human_m'; local resolution = '1024x768'; local locations = { ['1024x768'] = { okx = 450, oky = 725, ok2x = 515, ok2y = 418, cancelx = 575, cancely = 725, scanx1 = 494, scany1 = 378, scanx2 = 501, scany2 = 389, characters = { human_m = {x = 275, y = 620}, human_f = {x = 275, y = 660}, elf_m = {x = 435, y = 620}, elf_f = {x = 435, y = 660}, dwarf_m = {x = 600, y = 620}, gnome_f = {x = 600, y = 660}, porkul_m = {x = 740, y = 620}, porkul_f = {x = 740, y = 660}, } }, ['1440x900'] = { okx = 655, oky = 860, ok2x = 720, ok2y = 480, cancelx = 768, cancely = 855, scanx1 = 700, scany1 = 450, scanx2 = 708, scany2 = 455, characters = { human_m = {x = 490, y = 755}, human_f = {x = 490, y = 795}, elf_m = {x = 640, y = 755}, elf_f = {x = 640, y = 795}, dwarf_m = {x = 770, y = 755}, gnome_f = {x = 770, y = 795}, porkul_m = {x = 950, y = 755}, porkul_f = {x = 950, y = 795}, } }, }; --[[ okx/y Location of OK button ok2x/y Location of OK button (when rolling) cancelx/y Location of Cancel button scanx/y1 Top-left corner of scan rect (while rolling) scanx/y2 Bottom-right corner of scan rect (while rolling) characters Table of race/sex buttons for each character ]] -- Ensure that the resolution is supported if( locations[resolution] == nil ) then error('\aYour resolution isn\'t supported. Sorry.'); end -- Make sure that the character is set properly if( locations[resolution].characters[character] == nil ) then error('\aYou must set a proper character.'); end local win = findWindow("Wizardry Online", "WO-CL"); local hdc = openDC(win); local matchColor = makeColor(255, 255, 255); -- targetWindow() function is only available (and necessary) in latest beta version. if( targetWindow ) then targetWindow(win); end function mouseSetPos(x, y) mouseSet(x, y); mouseMove(1, 1); -- Makes the game recognize that it moved. yrest(500); end function pixelSearchSlow(hdc, color, sx, sy, wx, wy) local r,g,b = nil; local mr = getR(color); local mg = getG(color); local mb = getB(color); for y = sy, wy do for x = sx, wx do r,g,b = getPixel(hdc, x, y); if( r == mr and b == mb and g == mg ) then return true; end end yrest(100); end return false; end function main() local reroll = true; while(reroll) do yrest(100); mouseSetPos(locations[resolution].characters[character].x, locations[resolution].characters[character].y); yrest(100); mouseLClick(); yrest(500); mouseSetPos(locations[resolution].okx, locations[resolution].oky); yrest(500); mouseLClick(); yrest(2150); --pixelSearch(hdc, makeColor(255, 255, 255), 50, 50, 50, 50); -- Wait for it to show, let the user reroll/finish local wx = locations[resolution].scanx2 - locations[resolution].scanx1; local wy = locations[resolution].scany2 - locations[resolution].scany1; if( pixelSearchSlow(hdc, matchColor, locations[resolution].scanx1, locations[resolution].scany1, locations[resolution].scanx2, locations[resolution].scany2) ) then printf('\a\a\aFound something!\n'); reroll = false; break; end -- Else, clear and restart loop. mouseSetPos(locations[resolution].ok2x, locations[resolution].ok2y); mouseLClick(); yrest(400); -- Cancel mouseSetPos(locations[resolution].cancelx, locations[resolution].cancely); mouseLClick(400); end end startMacro(main);