TheOneX Posted November 13, 2009 Share Posted November 13, 2009 I have a small problem i think this would be simple, but i dont know where my mistake lies, can anyone help?? The thing is that i would like to input some details and use it in a script, but no matter how many times i type in the data in the input boxes, the program just say "part.au3 (33) : ==> Variable used without being declared.:" Can anyone please tell me what i do wrong?? ... $stamina_xy = MouseGetPos () $stamina_co = PixelGetColor ($stamina_xy[0], $stamina_xy[1]) $loc_x = InputBox("Key setting", "Please input the X coordinate shown in the window","x") $loc_y = InputBox("Key setting", "Please input the Y coordinate shown in the window","y") $stamina_colour = InputBox("Key setting", "Please input the colour code shown in the window","colour code") SplashOff ( ) Func auto_rest() while 1=1 33 -> If PixelGetColor ($loc_x, $loc_y) <> $stamina_colour Then SplashTextOn ( "You have less than 10%", "Beginning to heal stamina", 180, 70, 350,120,2) Else If PixelGetColor ($stamina_x, $stamina_y) = $stamina_colour Then SplashTextOn ( "Done healing", "Begin gathering", 180, 70, 350,120,2) EndIf EndIf WEnd EndFunc Link to comment Share on other sites More sharing options...
jvanegmond Posted November 13, 2009 Share Posted November 13, 2009 You're probably calling auto_rest before you've defined $stamina_colour. It's a good idea to initialize $stamina_colour on the top of your script, before any logic, with a default value. github.com/jvanegmond Link to comment Share on other sites More sharing options...
TheOneX Posted November 13, 2009 Author Share Posted November 13, 2009 but the input part is before the autorest function since to start the autorest function i use this While 1=1 ; HotKeySet ("{ESC}", "terminate") HotKeySet ("{F1}", "auto_rest") WEnd The input part is right at the start when turning on the program... that is why i am so confused Link to comment Share on other sites More sharing options...
jvanegmond Posted November 13, 2009 Share Posted November 13, 2009 Is it possible if you could post your entire script? github.com/jvanegmond Link to comment Share on other sites More sharing options...
TheOneX Posted November 13, 2009 Author Share Posted November 13, 2009 sure i just thouGh the other parts wasnt important $rest_key = InputBox("Key setting", "Which key is your rest button?", "9") $Pot_key = InputBox("Key setting", "Which key is your potion/food button?", "4") MsgBox(0, "Next step", "Set your mouse on your stamina bar at approx 15% and press enter") $stamina_xy = MouseGetPos () $stamina_co = PixelGetColor ($stamina_xy[0], $stamina_xy[1]) SplashTextOn ("Type it down:","Your X,Y coordinates are:"&" X = "&$stamina_xy[0]&" Y = "&$stamina_xy[1]&" Colour = "&$stamina_co, 150,150,100,100,16) $loc_x = InputBox("Key setting", "Please input the X coordinate shown in the window","x") $loc_y = InputBox("Key setting", "Please input the Y coordinate shown in the window","y") $stamina_colour = InputBox("Key setting", "Please input the colour code shown in the window","colour code") SplashOff ( ) While 1=1 ; Keeping the program alive HotKeySet ("{ESC}", "terminate") HotKeySet ("{F1}", "auto_rest") WEnd Func auto_rest() ; Restin, eating and back to work. while 1=1 If PixelGetColor ($loc_x, $loc_y) <> $stamina_colour Then SplashTextOn ( "You have less than 10%", "Beginning to heal stamina", 180, 70, 350,120,2) Else If PixelGetColor ($stamina_x, $stamina_y) = $stamina_colour Then SplashTextOn ( "Done healing", "Begin gathering", 180, 70, 350,120,2) EndIf EndIf WEnd EndFunc Func terminate() ; The exit bot function ToolTip('Bot shuttin down',600,200,"",1,2) sleep (1000) exit endfunc Func TogglePause() ; the pause function $Paused = NOT $Paused While $Paused ToolTip('Please press "F8" to resume!',600,200,"",1,2) sleep(1000) WEnd ToolTip("") EndFunc Link to comment Share on other sites More sharing options...
jvanegmond Posted November 13, 2009 Share Posted November 13, 2009 This line is the problem: If PixelGetColor($stamina_x, $stamina_y) = $stamina_colour Then You never define $stamina_x and $stamina_y, only $stamina_xy .. : P Also: $Paused = Not $Paused $Paused is never declared. Also: Replace this: While 1 = 1 ; Keeping the program alive HotKeySet("{ESC}", "terminate") HotKeySet("{F1}", "auto_rest") WEnd With this: HotKeySet("{ESC}", "terminate") HotKeySet("{F1}", "auto_rest") While 1 = 1 ; Keeping the program alive Sleep(50) WEnd And you will see drastic CPU usage improvements. github.com/jvanegmond Link to comment Share on other sites More sharing options...
TheOneX Posted November 13, 2009 Author Share Posted November 13, 2009 (edited) You are so right Totally forgot that i changed the name of Stamina_x to loc_x you are a life saver, would kiss you if i could Thanks alot for the help truely And also thanks alot for the tips will implement then ASAP Edited November 13, 2009 by TheOneX Link to comment Share on other sites More sharing options...
jvanegmond Posted November 13, 2009 Share Posted November 13, 2009 You're welcome! Responses like the one you just gave me is the reason I like to help out. Thanks. github.com/jvanegmond Link to comment Share on other sites More sharing options...
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