Given the amount of "go replace every. single. place. this card is used" code, I just wanted to leave some setup and support functions I have built into my script. Hopefully it can help others with versions that are a little more friendly to post / share.
That way, you end up with code like...
etc.. The core logic for the game would never change, just the setup portions.
Code:
; Prep The Board
Yshtola := {x:466, y:533, presentcolor:0x8F9FC9} ; Slot #1
Ultima := {x:577, y:521, presentcolor:0xBDBC93} ; Slot #2
Thancred := {x:680, y:505, presentcolor:0xE2CDCF} ; Slot #3
Urianger := {x:526, y:657, presentcolor:0x2C2926} ; Slot #4
Papalymo := {x:623, y:643, presentcolor:0x7A5A3A} ; Slot #5
TopLeft := {x:825, y:383, freecolor:0xC1CCD0}
TopMid := {x:960, y:377, freecolor:0xDEE6E7}
TopRight := {x:1094, y:375, freecolor:0xBECACD}
MidLeft := {x:824, y:507, freecolor:0xD6DFDE}
MidMid := {x:964, y:508, freecolor:0xC6CDCD}
MidRight := {x:1095, y:514, freecolor:0xDEE6E7}
BottomLeft := {x:821, y:648, freecolor:0xC8CDD0}
BottomMid := {x:960, y:645, freecolor:0xD1DEE1}
BottomRight := {x:1103, y:638, freecolor:0xC1CCD0}
; Helper Functions
IsSpotFree(spot)
{
PixelGetColor, color, spot.x, spot.y
SetFormat, Integer, HEX
cardcolor := spot.freecolor
return (color = cardcolor)
}
Pick(card)
{
SetFormat, Integer, D
cardx := card.x
cardy := card.y
Click, %cardx%, %cardy%
}
IsCardPresent(card)
{
PixelGetColor, color, card.x, card.y
SetFormat, Integer, HEX
cardcolor := card.presentcolor
return (color = cardcolor)
}
Drop(spot)
{
SetFormat, Integer, D
spotx := spot.x
spoty := spot.y
Click, %spotx%, %spoty%
}
MyTurn()
{
PixelGetColor, color, 684, 425, RGB
return color = 0x110D0F
}
That way, you end up with code like...
Code:
if IsCardPresent(Yshtola)
{
if IsSpotFree(MidLeft)
{
Pick(Yshtola)
Sleep 700
Drop(MidLeft)
etc.. The core logic for the game would never change, just the setup portions.