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.
Difference between revisions of "Iron macro"
From A Tale in the Desert
Jump to navigationJump to searchLine 8: | Line 8: | ||
// place your mouse over a spot of average gem color for each crystal in turn | // 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 | // Once it has identified the 7 crystals, it will run the mine | ||
+ | // | ||
+ | // Thank you Xyrrus for talking to me about using Hue | ||
Constructs | Constructs | ||
MouseX=List // this is an array of mouse X coords for gem sample points | 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 | MouseY=List // this is an array of mouse X coords for gem sample points | ||
− | + | CrysHue=List | |
− | |||
− | |||
OEOffset=List | OEOffset=List | ||
END | END | ||
Line 19: | Line 19: | ||
// When it mis-id's a crystal it will fail as many times in a row as your OELevel is set | // When it mis-id's a crystal it will fail as many times in a row as your OELevel is set | ||
Constants | Constants | ||
− | OELevel = | + | OELevel = 3 // change this to your Ore Extraction level |
− | totalpulls = | + | totalpulls = 500 // How many times do you want it to pull the mine |
− | colordiff = | + | colordiff = 10 // this is used to find a base for comparison, shouldn't need adjusting |
CDiff = 0 | CDiff = 0 | ||
CurrHigh = 0 | CurrHigh = 0 | ||
Line 27: | Line 27: | ||
Currcrys = 0 | Currcrys = 0 | ||
DIFFFOUND = 0 | DIFFFOUND = 0 | ||
+ | Minval = 0 | ||
+ | Maxval = 0 | ||
+ | Tmpval = 0 | ||
loopcnt = 1 | loopcnt = 1 | ||
Mousecnt = 1 | Mousecnt = 1 | ||
MouseXN = 0 | MouseXN = 0 | ||
MouseYN = 0 | MouseYN = 0 | ||
− | + | ColorHS = 0 | |
− | |||
− | |||
OElistcnt = 0 | OElistcnt = 0 | ||
OELvlset = 1 | OELvlset = 1 | ||
+ | CurrCrysHue = 0 | ||
End | End | ||
Line 54: | Line 56: | ||
loop $totalpulls | loop $totalpulls | ||
Compute loopcnt = 1 | Compute loopcnt = 1 | ||
− | ListClear | + | ListClear CrysHue |
− | |||
− | |||
loop 7 | loop 7 | ||
mousepos MouseX[$loopcnt], MouseY[$loopcnt] | mousepos MouseX[$loopcnt], MouseY[$loopcnt] | ||
LoadRGB MouseX[$loopcnt], MouseY[$loopcnt] | LoadRGB MouseX[$loopcnt], MouseY[$loopcnt] | ||
− | Call | + | Call CALCHUECOLOR |
+ | //SayPaste {RGBRed} {RGBGreen} {RGBBlue} CrysHue[$loopcnt] $Tmpval for testing | ||
Compute loopcnt = $loopcnt + 1 | Compute loopcnt = $loopcnt + 1 | ||
Delay 100 | Delay 100 | ||
END | END | ||
− | + | //Delay 100000 for testing | |
CALL FindtheOdd | CALL FindtheOdd | ||
Line 71: | Line 72: | ||
ListCount OEOffset, $OElistcnt | ListCount OEOffset, $OElistcnt | ||
− | IF $OELevel > $OElistcnt | + | IF $OELevel >= $OElistcnt |
− | Compute OELvlset = OEOffset[ | + | Compute OELvlset = OEOffset[1] // work the current crystal until we are at our OE Level |
ELSE | ELSE | ||
Compute OELvlset = OEOffset[$OELevel] | Compute OELvlset = OEOffset[$OELevel] | ||
Line 91: | Line 92: | ||
end | end | ||
− | Procedure | + | 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 | END | ||
Line 105: | Line 138: | ||
Compute Currcrys = 1 | Compute Currcrys = 1 | ||
− | loop 7 | + | loop 7 |
IF $Currcrys <> $Compare | IF $Currcrys <> $Compare | ||
− | Compute | + | Compute ColorHS = CrysHue[$Currcrys] - CrysHue[$Compare] |
− | IF $ | + | IF $ColorHS < 0 |
− | Compute | + | Compute ColorHS = 0 - $ColorHS |
END | END | ||
− | IF $ | + | IF $ColorHS > $CDiff |
− | Compute CDiff = $ | + | Compute CDiff = $ColorHS |
Compute CurrHigh = $Currcrys | Compute CurrHigh = $Currcrys | ||
END | END | ||
Line 121: | Line 154: | ||
END | END | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Compute Mousecnt = $CurrHigh | Compute Mousecnt = $CurrHigh | ||
END | END | ||
Line 209: | Line 209: | ||
END | END | ||
− | Procedure FindCompare | + | 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 | |
− | |||
− | |||
− | |||
− | IF $ | ||
− | Compute | ||
END | END | ||
− | IF $ | + | IF $ColorHS < $colordiff |
Compute Compare = 1 | Compute Compare = 1 | ||
ELSE | ELSE | ||
− | Compute | + | Compute ColorHS = CrysHue[1] - CrysHue[3] |
− | + | IF $ColorHS < 0 | |
− | + | Compute ColorHS = 0 - $ColorHS | |
− | |||
− | IF $ | ||
− | Compute | ||
END | END | ||
− | + | ||
− | + | IF $ColorHS < $colordiff | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | IF $ | ||
Compute Compare = 1 | Compute Compare = 1 | ||
ELSE | ELSE |
Revision as of 00:00, 9 January 2009
// 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 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 OEOffset=List END // This macro doesn't work 100%, I have gotten between 80% and 90% return // When it mis-id's a crystal it will fail as many times in a row as your OELevel is set Constants OELevel = 3 // change this to your Ore Extraction level totalpulls = 500 // 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 DIFFFOUND = 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. Loop 7 Delay 3000 Listadd MouseX, {MouseX} Listadd MouseY, {MouseY} SayPaste . END ListClear OEOffset 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 OreExtractionstore ListCount OEOffset, $OElistcnt IF $OELevel >= $OElistcnt Compute OELvlset = OEOffset[1] // work the current crystal until we are at our OE Level ELSE Compute OELvlset = OEOffset[$OELevel] END //Saypaste $OELevel $OElistcnt $OELvlset mousepos MouseX[$OELvlset], MouseY[$OELvlset] Delay 200 //200 leftclick Compute MouseXN = MouseX[$OELvlset] + 15 // adjust this if you need to for the menu click Compute MouseYN = MouseY[$OELvlset] - 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 OreExtractionstore ListCount OEOffset, $OElistcnt IF $OElistcnt = 0 Listadd OEOffset, $Mousecnt ELSE IF $OElistcnt = 1 Listadd OEOffset, OEOffset[1] END IF $OElistcnt = 2 Listadd OEOffset, OEOffset[2] Compute OEOffset[2] = OEOffset[1] END IF $OElistcnt = 3 Listadd OEOffset, OEOffset[3] Compute OEOffset[3] = OEOffset[2] Compute OEOffset[2] = OEOffset[1] END IF $OElistcnt = 4 Listadd OEOffset, OEOffset[4] Compute OEOffset[4] = OEOffset[3] Compute OEOffset[3] = OEOffset[2] Compute OEOffset[2] = OEOffset[1] END IF $OElistcnt = 5 Listadd OEOffset, OEOffset[5] Compute OEOffset[5] = OEOffset[4] Compute OEOffset[4] = OEOffset[3] Compute OEOffset[3] = OEOffset[2] Compute OEOffset[2] = OEOffset[1] END IF $OElistcnt = 6 Listadd OEOffset, OEOffset[6] Compute OEOffset[6] = OEOffset[5] Compute OEOffset[5] = OEOffset[4] Compute OEOffset[4] = OEOffset[3] Compute OEOffset[3] = OEOffset[2] Compute OEOffset[2] = OEOffset[1] END IF $OElistcnt = 7 Compute OEOffset[7] = OEOffset[6] Compute OEOffset[6] = OEOffset[5] Compute OEOffset[5] = OEOffset[4] Compute OEOffset[4] = OEOffset[3] Compute OEOffset[3] = OEOffset[2] Compute OEOffset[2] = OEOffset[1] END Compute OEOffset[1] = $Mousecnt END 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
back to Macro list:[Mosaic Macros]