Jump to content

Problems With Check


Recommended Posts

Hello, I'm doing a game bot, I made 3 topics just asking things as i'm new in the autoit script.

This is the 3th. My problem now is that:

$rdy = GUICtrlCreateCheckbox ("Ativar", 10, 170)

While 1
    If GUICtrlRead($rdy) = 1 And IsArray($mao) and IsArray($runas) and IsArray($deposito) and GUICtrlRead($combo) = 'Runa' Then
        Sleep (1200000)
        MouseClickDrag ( "left", $runas[0], $runas[1], $mao[0], $mao[1], 0)
        Send("Runa + {ENTER}")
        Sleep (1000)
        MouseClickDrag ( "left", $mao[0], $mao[1], $deposito[0], $deposito[1], 0)
    EndIf 
WEnd

; a lot of drag 'whiles' like that but with their names changed for different effects.

All that 'if' arguments just work with this part of the script.

I mean, if in the combo there's another value, it will not work.

I think it's because the check is just above this part and not above the others. While doesn't work, because it will refresh the check and it will not get marked.

I don't know if you can understand. If you do, help me.

Link to comment
Share on other sites

  • Moderators

You have alot of scenerios in there that aren't posted, including the combo or checkbox... Not much that anyone can do for you with NO information.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I know It's not all info, but I'm sure the problem is with the checkbox.

Btw, If you want the full code...

Global $mao, $runas, $deposito, $rod, $water, $combo, $rdy, $food
HotKeySet( "{ESC}", "Sair" )
HotKeySet( "{F1}", "GetRunas" )
HotKeySet( "{F2}", "GetMao" )
HotKeySet( "{F3}", "GetDeposito" )
HotKeySet( "{F4}", "GetFood" )
HotKeySet( "{F5}", "GetRod" )
HotKeySet( "{F6}", "GetWater" )

GUICreate("UTRB v.1.1 by Frit", 290, 200)
GUICtrlCreateLabel ("ESC para sair.", 190, 175)
GuiSetstate()

;XY drags positions
Global $runelabel = GUICtrlCreateLabel('(x,y)', 240, 10, 80, 30)
GUICtrlSetColor ( $runelabel, 11141120)
GUICtrlCreateLabel('Posição das blank runes (alterar com F1)', 10, 10)
Func GetRunas();get runes position
    $runas = MouseGetPos()
    GUICtrlSetData( $runelabel, $runas[0] & ',' & $runas[1])
EndFunc

Global $maolabel = GUICtrlCreateLabel('(x,y)', 240, 30, 80, 30)
GUICtrlSetColor ( $maolabel, 11141120)
GUICtrlCreateLabel('Posição da mão (alterar com F2)', 10, 30)
Func GetMao();get hand position
    $mao = MouseGetPos()
    GUICtrlSetData( $maolabel, $mao[0] & ',' & $mao[1])
EndFunc

Global $depositolabel = GUICtrlCreateLabel('(x,y)', 240, 50, 80, 30)
GUICtrlSetColor ( $depositolabel, 11141120)
GUICtrlCreateLabel('Posição da bp de runas (alterar com F3)', 10, 50)
Func Getdeposito();get deposito position
    $deposito = MouseGetPos()
    GUICtrlSetData( $depositolabel, $deposito[0] & ',' & $deposito[1])
EndFunc

Global $foodlabel = GUICtrlCreateLabel('(x,y)', 240, 70, 80, 30)
GUICtrlSetColor ( $foodlabel, 11141120)
GUICtrlCreateLabel('Posição da food (alterar com F4) [opcional]', 10, 70)
Func GetFood();get food position
    $food = MouseGetPos()
    GUICtrlSetData( $foodlabel, $food[0] & ',' & $food[1])
EndFunc

;fishing
Global $rodlabel = GUICtrlCreateLabel('(x,y)', 240, 90, 80, 30)
GUICtrlSetColor ( $rodlabel, 11141120)
GUICtrlCreateLabel('Posição da fishing rod (alterar com F5)', 10, 90)
Func GetRod();get rod position
    $rod = MouseGetPos()
    GUICtrlSetData( $rodlabel, $rod[0] & ',' & $rod[1])
EndFunc

Global $waterlabel = GUICtrlCreateLabel('(x,y)', 240, 110, 80, 30)
GUICtrlSetColor ( $waterlabel, 11141120)
GUICtrlCreateLabel('Posição da água (alterar com F6)', 10, 110)
Func GetWater();get water position
    $water = MouseGetPos()
    GUICtrlSetData( $waterlabel, $water[0] & ',' & $water[1])
EndFunc

$combo = GUICtrlCreateCombo ("Tipo de Runa", 10, 140, 100, 20)
GUICtrlSetData(-1, "Adori Gran|Adori Gran Flam|Adori Vita Vis|Adura Vita", "Tipo de Runa")

$foodcombo = GUICtrlCreateCombo ("Tipo de food", 150, 140, 100, 20)
GUICtrlSetData(-1, "Meat|Ham|Fish", "Tipo de food")

$rdy = GUICtrlCreateCheckbox ("Ativar", 10, 170)

While 1; adori gran
    If GUICtrlRead($rdy) = 1 And IsArray($mao) and IsArray($runas) and IsArray($deposito) and GUICtrlRead($combo) = 'Adori Gran' Then
        Sleep (1200000)
        MouseClickDrag ( "left", $runas[0], $runas[1], $mao[0], $mao[1], 0)
        Send("Adori Gran + {ENTER}")
        Sleep (1000)
        MouseClickDrag ( "left", $mao[0], $mao[1], $deposito[0], $deposito[1], 0)
    EndIf 
WEnd

While 1; adori gran flam
    If GUICtrlRead($rdy) = 1 And IsArray($mao) and IsArray($runas) and GUICtrlRead($combo) = 'Adori Gran Flam' Then
        Sleep (2000000)
        MouseClickDrag ( "left", $deposito[0], $deposito[1], $mao[0], $mao[1], 0)
        Send("Adori Gran Flam + {ENTER}")
        Sleep (1000)
        MouseClickDrag ( "left", $mao[0], $mao[1], $runas[0], $runas[1], 0)
    EndIf 
WEnd

While 1; adori vita vis
    If GUICtrlRead($rdy) = 1 And IsArray($mao) and IsArray($runas) and GUICtrlRead($combo) = 'Adori Vita vis' Then
        Sleep (3600000)
        MouseClickDrag ( "left", $deposito[0], $deposito[1], $mao[0], $mao[1], 0)
        Send("Adori Vita vis + {ENTER}")
        MouseClickDrag ( "left", $mao[0], $mao[1], $runas[0], $runas[1], 0)
    EndIf 
WEnd

While 1; adura vita
    If GUICtrlRead($rdy) = 1 And IsArray($mao) and IsArray($runas) and GUICtrlRead($combo) = 'Adura Vita' Then
        Sleep (3600000)
        MouseClickDrag ( "left", $deposito[0], $deposito[1], $mao[0], $mao[1], 0)
        Send("Adura Vita + {ENTER}")
        MouseClickDrag ( "left", $mao[0], $mao[1], $runas[0], $runas[1], 0)
    EndIf 
WEnd

While 1;fishing
    If GUICtrlRead($rdy) = 1 and IsArray($rod) and IsArray($water) Then
        Sleep (2000)
        MouseClick ( "right", $rod[0], $rod[1], 1, 1)
        Sleep (2000)
        MouseClick ( "left", $water[0], $water[1], 1, 1)
    EndIf 
WEnd

While 1; food
    If GUICtrlRead($rdy) = 1  and GUICtrlRead($foodcombo) = 'Meat' Then
        Sleep (360000)
        MouseClick("right", $food[0], $food[1], 1, 1)
        Elseif GUICtrlRead($rdy) = 1 and IsArray($food) and GUICtrlRead($foodcombo) = 'Ham' Then
        Sleep (720000)
        MouseClick("right", $food[0], $food[1], 1, 1)
        Elseif GUICtrlRead($rdy) = 1 and IsArray($food) and GUICtrlRead($foodcombo) = 'Fish' Then
        Sleep (96000)
        MouseClick("right", $food[0], $food[1], 1, 1)   
    EndIf
WEnd


;misc

While 1;soltar guis
GuiSetstate()
Wend

While 1; mantem ativo
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
;;;
    EndSelect
WEnd

Func Sair();func sair
    Exit
EndFunc

All my work on this bot is here... (some parts in portuguese :S)

Edited by Frit
Link to comment
Share on other sites

  • Moderators

How do you get to the other loops... there's no ExitLoops or anything?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Hello, I'm doing a game bot, I made 3 topics just asking things as i'm new in the autoit script.

This is the 3th. My problem now is that:

$rdy = GUICtrlCreateCheckbox ("Ativar", 10, 170)

While 1
    If GUICtrlRead($rdy) = 1 And IsArray($mao) and IsArray($runas) and IsArray($deposito) and GUICtrlRead($combo) = 'Runa' Then
        Sleep (1200000)
        MouseClickDrag ( "left", $runas[0], $runas[1], $mao[0], $mao[1], 0)
        Send("Runa + {ENTER}")
        Sleep (1000)
        MouseClickDrag ( "left", $mao[0], $mao[1], $deposito[0], $deposito[1], 0)
    EndIf 
WEnd

; a lot of drag 'whiles' like that but with their names changed for different effects.

All that 'if' arguments just work with this part of the script.

I mean, if in the combo there's another value, it will not work.

I think it's because the check is just above this part and not above the others. While doesn't work, because it will refresh the check and it will not get marked.

I don't know if you can understand. If you do, help me.

I'm not sure I understand your question, but on a general point:

I don't think the value returned for $rdy is as simple as 0=not checked, and 1=checked. Look at the help file under GuiCtrlRead() and there is a link for the state table at GuiCtrlSetState(). That state table indicates the values you might see, and 0=unchanged, not necesarily unchecked.

Hope that helps! :)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • Moderators

I'm not sure I understand your question, but on a general point:

I don't think the value returned for $rdy is as simple as 0=not checked, and 1=checked. Look at the help file under GuiCtrlRead() and there is a link for the state table at GuiCtrlSetState(). That state table indicates the values you might see, and 0=unchanged, not necesarily unchecked.

Hope that helps! :)

A check box returns a value of 1 ($GUI_CHECKED) when checked and a value of 4 ($GUI_UNCHECKED) when un-checked... These values can be found in the GUIConstants.au3... So using GUICtrlRead() would return on of those 2 values.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...