The Wiki for Tale 4 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.

User:Kibble/Macros/Lead

From A Tale in the Desert
< User:Kibble‎ | Macros
Revision as of 05:27, 22 February 2009 by Kibble (talk | contribs) (New page: // Written by: Coyan/Mosaic Guild // This is what I suggest for setting up for this macro // First align your view so you can see all 7 crystals clearly // second use Alt-L to lock your ca...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

// Written by: Coyan/Mosaic Guild // This is what I suggest for setting up for this macro // First align your view so you can see all 7 crystals clearly // second use Alt-L to lock your camera angle // Third before starting this, I suggest you have your mouse sitting over // the first crystal. // You will have 3 seconds between the recording of each crystal's location // place your mouse over a spot of average gem color for each crystal in turn // Once it has identified the 7 crystals, it will run the mine // // Thank you Xyrrus for talking to me about using Hue // This is a derivation of the Iron macro, in this case I added a step to keep track of the crystals same color status Constructs MouseX=List // this is an array of mouse X coords for gem sample points MouseY=List // this is an array of mouse X coords for gem sample points CrysHue=List CrysIDcnt=List END // Initially this will fail up to 7 times while it looks for the "common" gem, once it finds it, its pretty accurate. Constants totalpulls = 1000 // How many times do you want it to pull the mine colordiff = 10 // this is used to find a base for comparison, shouldn't need adjusting CDiff = 0 CurrHigh = 0 Compare = 0 Currcrys = 0 NumCrysID = 0 currhighcnt = 0 cntr = 0 Minval = 0 Maxval = 0 Tmpval = 0 loopcnt = 1 Mousecnt = 1 MouseXN = 0 MouseYN = 0 ColorHS = 0 OElistcnt = 0 OELvlset = 1 CurrCrysHue = 0 End

// First part that requires a detailed explanation // this loop will pause for 3 seconds then grab the current mouse location // its purpose is to identify the 7 sampling locations for the crystals // when it grabs the sampling spot, it will then echo a . to the chat window // make sure you are in your main chat tab. setactivewindow eGenesis Client Loop 7 Delay 3 sec Listadd MouseX, {MouseX} Listadd MouseY, {MouseY} keys {loopno} END keys {return} keys {return}

ListClear CrysIDcnt

loop $totalpulls Compute loopcnt = 1 ListClear CrysHue loop 7 mousepos MouseX[$loopcnt], MouseY[$loopcnt] LoadRGB MouseX[$loopcnt], MouseY[$loopcnt]

Call CALCHUECOLOR //SayPaste {RGBRed} {RGBGreen} {RGBBlue} CrysHue[$loopcnt] $Tmpval for testing Compute loopcnt = $loopcnt + 1 Delay 100 END //Delay 100000 for testing CALL FindtheOdd CALL IncrementID

mousepos MouseX[$Mousecnt], MouseY[$Mousecnt] Delay 200 //200 keys w //leftclick //Compute MouseXN = MouseX[$Mousecnt] + 15 // adjust this if you need to for the menu click //Compute MouseYN = MouseY[$Mousecnt] - 5 // adjust this if you need to for the menu click //Mousepos $MouseXN, $MouseYN //Delay 200 //Leftclick

Delay 4300 // Delay to manage the str/perc timer on mining, adjust as needed

end

Procedure CALCHUECOLOR // This procedure calculates the Hue of the crystal Compute Minval = 0 Compute Maxval = 255 IF {RGBRed} > {RGBGreen} Compute Minval = {RGBGreen} Compute Maxval = {RGBRed} Else Compute Maxval = {RGBGreen} Compute Minval = {RGBRed} END IF {RGBBlue} < $Minval Compute Minval = {RGBBlue} ELSE IF {RGBBlue} > $Maxval Compute Maxval = {RGBBlue} END END

Compute Tmpval = $Maxval - $Minval

IF {RGBRed} = $Maxval Compute CurrCrysHue = {RGBGreen} - {RGBBlue} Compute CurrCrysHue = $CurrCrysHue/$Tmpval ELSE IF $Maxval = {RGBGreen} Compute CurrCrysHue = {RGBBlue} - {RGBRed} Compute CurrCrysHue = $CurrCrysHue/$Tmpval Compute CurrCrysHue = 2.0 + $CurrCrysHue ELSE IF $Maxval = {RGBBlue} Compute CurrCrysHue = {RGBRed} - {RGBGreen} Compute CurrCrysHue = $CurrCrysHue/$Tmpval Compute CurrCrysHue = 4.0 + $CurrCrysHue END END END Compute CurrCrysHue = $CurrCrysHue * 100 Listadd CrysHue, $CurrCrysHue END

Procedure FindtheOdd Call Findcompare Compute CDiff = 0 Compute CurrHigh = 0

Compute Currcrys = 1 loop 7 IF $Currcrys <> $Compare Compute ColorHS = CrysHue[$Currcrys] - CrysHue[$Compare] IF $ColorHS < 0 Compute ColorHS = 0 - $ColorHS END

IF $ColorHS > $CDiff Compute CDiff = $ColorHS Compute CurrHigh = $Currcrys END END

Compute Currcrys = $Currcrys + 1 END

Compute Mousecnt = $CurrHigh END

Procedure FindCompare // For Iron we need to find the common crystals in the first 3

Compute ColorHS = CrysHue[1] - CrysHue[2] IF $ColorHS < 0 Compute ColorHS = 0 - $ColorHS END

IF $ColorHS < $colordiff Compute Compare = 1 ELSE Compute ColorHS = CrysHue[1] - CrysHue[3] IF $ColorHS < 0 Compute ColorHS = 0 - $ColorHS END

IF $ColorHS < $colordiff Compute Compare = 1 ELSE Compute Compare = 2 END END

END

// this procedure keeps track of how many times each crystal has been NOT the odd crystal Procedure IncrementID ListCount CrysIDcnt, NumCrysID

IF $NumCrysID = 0 Loop 7 ListAdd CrysIDcnt, 1 END

ELSE Compute cntr = 1 Loop 7 Compute Tmpval = CrysIDcnt[$cntr] + 1 Compute CrysIDcnt[$cntr] = $Tmpval Compute cntr = $cntr + 1 END Compute CrysIDcnt[$Mousecnt] = 1 Compute currhighcnt = 1 Compute cntr = 1 Loop 7 IF CrysIDcnt[$cntr] > $currhighcnt Compute currhighcnt = CrysIDcnt[$cntr] Compute $Mousecnt = $cntr END Compute cntr = $cntr + 1 END END END