colors := {Rare: Rare, Epic: Epic, Legendary: Legendary, Mythical: Mythical, Exotic: Exotic, Divine: Divine, Celestial: Celestial}
saying its enumerable? Unsure what to do
Code: Select all
; Define color thresholds in RGB format
Basic := [211, 211, 221]
Rare := [190, 254, 167]
Epic := [158, 240, 255]
Legendary := [255, 212, 163]
Mythical := [255, 170, 187]
Exotic := [255, 173, 254]
Divine := [254, 243, 171]
Celestial := [212, 244, 251]
; Function to calculate Euclidean distance between two colors
EuclideanDistance(color1, color2) {
return Sqrt((color1[1] - color2[1]) ** 2 + (color1[2] - color2[2]) ** 2 + (color1[3] - color2[3]) ** 2)
}
; Function to convert hexadecimal color to RGB format
HexToRGB(hex_color) {
blue := (hex_color >> 16) & 0xFF
green := (hex_color >> 8) & 0xFF
red := hex_color & 0xFF
return [red, green, blue]
}
; Function to find the closest predefined color to a given color
FindClosestColor(color) {
closest_color := "Basic"
min_distance := EuclideanDistance(color, Basic)
colors := {Rare: Rare, Epic: Epic, Legendary: Legendary, Mythical: Mythical, Exotic: Exotic, Divine: Divine, Celestial: Celestial}
for color_name, color_value in colors
{
distance := EuclideanDistance(color, color_value)
if (distance < min_distance) {
closest_color := color_name
min_distance := distance
}
}
return closest_color
}
; Read reward value
Reward1 := FindClosestColor(HexToRGB(PixelGetColor(Item1X, ItemY)))
Reward2 := FindClosestColor(HexToRGB(PixelGetColor(Item2X, ItemY)))
Reward3 := FindClosestColor(HexToRGB(PixelGetColor(Item3X, ItemY)))
MsgBox(Reward1 . " " . Reward2 . " " . Reward3)