Jump to content

Am i doing anything wrong? (inputbox)


TheOneX
 Share

Recommended Posts

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

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

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

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.

Link to comment
Share on other sites

You are so right B)

Totally forgot that i changed the name of Stamina_x to loc_x B) you are a life saver, would kiss you if i could :)

Thanks alot for the help truely ;)

And also thanks alot for the tips B) will implement then ASAP B)

Edited by TheOneX
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...