MHz Posted December 21, 2006 Posted December 21, 2006 Try this change $pos = MouseGetPos() Func ScriptStuck() $var_2 = MouseGetPos() If IsArray($var_2) And IsArray($pos) Then If $Timestack = 10 Then $Timestack = 0 Start() ElseIf $pos[0] = $var_2[0] And $pos[1] = $var_2[1] Then $Timestack += 1 Else $pos = $var_2 EndIf EndIf EndFunc
J0ker Posted December 21, 2006 Author Posted December 21, 2006 (edited) Wow Thx Mhz EDIT: Im getting this error: ==> Variable used without being declared.: If IsArray($var_2) And IsArray($pos) Then If IsArray($var_2) And IsArray(^ ERROR Edited December 21, 2006 by J0ker
MHz Posted December 21, 2006 Posted December 21, 2006 You need to declare $pos before the function is called. Add it at the top of your script as Global $pos, $Timestack ; other code $pos = MouseGetPos() Func ScriptStuck() Local $var_2 = MouseGetPos() If IsArray($var_2) And IsArray($pos) Then If $Timestack = 10 Then $Timestack = 0 Start() ElseIf $pos[0] = $var_2[0] And $pos[1] = $var_2[1] Then $Timestack += 1 Else $pos = $var_2 EndIf EndIf EndFunc
J0ker Posted December 21, 2006 Author Posted December 21, 2006 I dont get any errors now but it's not working. $TimeStack are not stacking value. I tried to put a splash text to see if $TimeStack was changing and it's not. SplashTextOn ("", "Time Stack: " & $TimeStack, 290, 20, 0, 30, 1, "", 10)With my other code values were stacking but I cannot get the else to work :S
MHz Posted December 21, 2006 Posted December 21, 2006 Depends how you have your script set up. With this test Global $pos, $Timestack AdlibEnable('ScriptStuck', 500) While 1 $pos = MouseGetPos() Sleep(500) WEnd Func ScriptStuck() Local $var_2 = MouseGetPos() If IsArray($var_2) And IsArray($pos) Then If $Timestack = 10 Then ConsoleWrite('If' & @CRLF) $Timestack = 0 ;~ Start() ElseIf $pos[0] = $var_2[0] And $pos[1] = $var_2[1] Then ConsoleWrite('ElseIf' & @CRLF) $Timestack += 1 Else ConsoleWrite('Else' & @CRLF) $pos = $var_2 EndIf EndIf EndFunc CODE Else Else ElseIf Else Else ElseIf Else Else Else ElseIf ElseIf Else Else ElseIf Else ElseIf ElseIf ElseIf ElseIf ElseIf If ElseIf ElseIf ElseIf Else Else Else Else ElseIf ElseIf ElseIfI get If, ElseIf and Else showing as being used.
J0ker Posted December 21, 2006 Author Posted December 21, 2006 (edited) Global $pos, $Timestack AdlibEnable('ScriptStuck', 500) While 1 $pos = MouseGetPos() Sleep(500) WEnd Func ScriptStuck() SplashTextOn ("", "Time Stack: " & $TimeStack ,290, 20, 0, 30, 1, "", 10) Local $var_2 = MouseGetPos() If IsArray($var_2) And IsArray($pos) Then If $Timestack = 10 Then ConsoleWrite('If' & @CRLF) $Timestack = 0 Exit ElseIf $pos[0] = $var_2[0] And $pos[1] = $var_2[1] Then ConsoleWrite('ElseIf' & @CRLF) $Timestack += 1 Else ConsoleWrite('Else' & @CRLF) $pos = $var_2 $Timestack = 0 EndIf EndIf EndFunc The splashtext always display 0, and the Exit never happen. It's like if no values were stacking. EDIT: If I run it in alone, it work, but If I add it to my real script, nothing happen. So this code work but I will see if I can get it to work in my script. EDIT2: Alone : The ConsoleWrite work In my script: He write nothing in the console Edited December 21, 2006 by J0ker
J0ker Posted December 21, 2006 Author Posted December 21, 2006 Func ScriptStuck() SplashTextOn ("", "Time Stack: " & $TimeStack ,290, 20, 0, 30, 1, "", 10) Local $var_2 = MouseGetPos() ConsoleWrite('Test' & @CRLF) If IsArray($var_2) And IsArray($pos) Then If $Timestack = 10 Then ConsoleWrite('If' & @CRLF) $Timestack = 0 Exit ElseIf $pos[0] = $var_2[0] And $pos[1] = $var_2[1] Then ConsoleWrite('ElseIf' & @CRLF) $Timestack += 1 Else ConsoleWrite('Else' & @CRLF) $pos = $var_2 $Timestack = 0 EndIf EndIf ConsoleWrite('ENDFUNC' & @CRLF) EndFunc # CONSOLEWRITE # Test ENDFUNC Test ENDFUNC Test ENDFUNC Test ENDFUNC Test ENDFUNC Test ENDFUNC Test ENDFUNC Test ENDFUNC Test ENDFUNC Test ENDFUNC The script reach the If and then exit the function .
MHz Posted December 22, 2006 Posted December 22, 2006 The splashtext always display 0, and the Exit never happen. It's like if no values were stacking.Upon executing your code, if I do not move the mouse the the splash increases the count and finally exits. In your real script, $pos does need to be updated for the function to react to those mouse coordinate changes.
kindlin Posted December 22, 2006 Posted December 22, 2006 (edited) I'm knew to programming in general, only made 2 programs (although they were no small feet, one was 15 hours of work the other about 5) and there are a few things in that script I don't understand the point of. AdlibEnable("ScriptStuck", 6000) Func ScriptStuck() $pos = MouseGetPos() ;why is this $pos $var_2 = MouseGetPos() ;but this $var_2. why not make this simply $pos2 ? if $pos[0] = $var_2[0] AND $pos[1] = $var_2[1] then ;and whats up with the [1] and [0]'s?? oÝ÷ Ø Ý¶§Â+a¢ëm槳«¶a¢Çª¹ë-ìZ¥vØb³ +«¢+Ø(í±°Ñ¡Ñ¡¥¹Ìɸ½¹°¥¹±Õ¥¹¸¸¸(ÀÌØíÑ¥µÍѬôÀ()Õ¹MÉ¥ÁÑMÑÕ¬ ¤(ÀÌØíÁ½ÌÄõ5½ÕÍÑA½Ì ¤)ͱÀ ØÀÀÀ¤(ÀÌØíÁ½ÌÈõ5½ÕÍÑA½Ì ¤)%ÀÌØíÁ½ÌÄõÁ½ÌÈÑ¡¸ÀÌØíÑ¥µÍѬ¬ôÄ)%ÀÌØíÑ¥µÍѬôÈÀÑ¡¸±°¡µ¥¸¤)¹Õ¹()Õ¹µ¥¸ ¤)±¥¹± ÅÕ½ÐíMÉ¥ÁÑMÑÕ¬ÅÕ½Ðì°ØÀÀÀ¤(í¹Ñ¥ÉÁɽɴ)±¥¹¥Í± ¤)¹Õ¹ Makes sense to me... Edited December 22, 2006 by kindlin
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now