hello! i have been working on a script that helps me to detect HP in a game.
F9::
Loop
{
pixelsearch, px, py, 199, 47, 211, 62, 0x0008CC, 3, fast
if errorlevel
pixelsearch, px, py, 199, 47, 211, 62, 0x0008C8, 3, fast
if errorlevel
pixelsearch, px, py, 199, 47, 211, 62, 0x0008C9, 3, fast
if errorlevel
pixelsearch, px, py, 199, 47, 211, 62, 0x0008C8, 3, fast
if errorlevel
pixelsearch, px, py, 199, 47, 211, 62, 0x0008D3, 3, fast
if errorlevel
mouseclick, left, 513, 608
; msgbox, that color was not found
else
; mouseclick, left, 509, 619
mousemove, %px%, %py%
sleep, 3000
}
return
as you can see, there are many colorid in my script, and there are more.. if i put all of the them into my script, it would be a mess.
my question is .. can i put all those colorid into only one variable? something like
F9::
colorid = "0x0008CC" "0x0008C8" "0x0008C9" "0x0008C8" "0x0008D3"
Loop
{
pixelsearch, px, py, 199, 47, 211, 62, %colorid%, 3, fast
if errorleve
mouseclick, left, 513, 608
; msgbox, that color was not found
else
; mouseclick, left, 509, 619
mousemove, %px%, %py%
sleep, 3000
}
return
so that i can make it easier to read?
thank you so much for reading my question:))
can a variable hold many colorid
-
- Posts: 8
- Joined: 13 Feb 2018, 23:10
- Contact:
Re: can a variable hold many colorid
Code: Select all
cIndex := ["0x0008CC","0x0008C8","0x0008C9","0x0008C8","0x0008D3"]
Loop % cIndex.Length() {
MsgBox % cIndex[A_Index]
PixelSearch, px, py, 199, 47, 211, 62, cIndex[A_Index], 3, fast
Random, px, 0, A_ScreenWidth ; only for testing
Random, py, 0, A_ScreenHeight ; only for testing
ClipBoard .= px . ":" . py . "|"
}
MsgBox % SubStr(ClipBoard,1,-1)
-
- Posts: 8
- Joined: 13 Feb 2018, 23:10
- Contact:
Re: can a variable hold many colorid
thank you bobo!!
Who is online
Users browsing this forum: Shoobis and 91 guests