hi everyone, I've been following this thread for some time now. though I haven't said anything, I just wanted to make sure I knew all the details.
I'm one of those who in the v11.3 was getting the error -1: specifically the 'subscript used with non-array variable' one.
and not the 'variable used not defined' that I saw some having. (or something similar)
I believe the problem is due to vista, as I am using vista 32-bit home basic.
and I have also been noting jt's attempts to getting rid of the -1 error.
However, I do not believe adding that pause to the script will fix the issue.
your new verson 11.4, does in fact get rid of the error, but only to send the script into an infinite loop.
my reasons for this are as follows:
I must apologize to jt before hand as I have been debugging his code (sorry, sorry) (and yes this means I do have the source *please don't kill me*, but due to jt's desire to keep cheap spin-offs floating around; I have respected his wish. and will continue to do so, as I am only trying to help)
jt there is a certain part of your 11.4a code that's causing the issue.
true the -1 error is gone, but look:
$FTARGET = PixelSearch(480, 5, 1200, 5, 11119531, 0)
While IsArray($FTARGET) = 0
ToolTip("Working - If this does not go away in after 10 seconds, Press
CTRL+ALT+X to exit")
WEnd
ToolTip("Target window POS set")
ftarget is remaining 0, the assumption that we need to wait for vista to update via the pixelsearch is incorrect!
(also, this is will cause a memory leak effectively maxing out one's CPU resources due to the excessive tooltip, the fix for this is simple just add a Sleep(200) line right below the tooltip)
however, the leak isn't the real problem here. the problem still remains that ftarget isn't getting updated (and thusly not being turned into an array, which means that if your code hits one of the ...target[x] lines, we will indeed see the -1 error return)
what I haven't done is try and fix the code myself, as I see this as useless because jt is the one coming out with the updates (and again, I do not intend to even attempt to do so)
however, my advice (should you decide to follow it) is this:
$FTARGET = PixelSearch(480, 5, 1200, 5, 11119531, 0)
While (@error = 1) ; because if pixelsearch fails @error becomes 1
Sleep (100) ; to stop the memory leak
@error = 0 ; you'll need to reset this because I do not believe that a success will change it back to a 0, (or you can use a temp variable via: temp_err = @error ... and so on and so forth.)
$FTARGET = PixelSearch(480, 5, 1200, 5, 11119531, 0) ; a retry, hoping it works this time around
ToolTip("-something else in here telling the user that it's retrying or whatever-") ; it doesn't matter much
Sleep (100) ; personal preference really, but it will also lessen the memory usage
WEnd
ToolTip("Target window POS set")
now, if even this doesn't work then I can only assume that vista isn't letting pixelsearch grab the correct information (but if it's working in other areas, then the problem may be something totally different all together, still)
....umm .... I think that's all I had to say.
oh yes, good work jt. I was really impressed by the amount of effort you put into this. (as I am very lazy when I actually have to write my own code from scratch, Kudos to you man

)
and if you so desire, I don't mind stopping in from time to time or helping you debug in general, or whatever else is needed (but seeing as though you're doing well on your own, I'm not expecting anything

)
alright, I'll check back tomorrow (after I sleep a bit -no pun intended- )
later all.