Jump to content

GUICtrlSetState


Mike  :)
 Share

Recommended Posts

I must admit that I'm not entirely sure of what you want to do. When you run this line:

GUICtrlRead($loot)

what do you wish to happen? I suspect that you want the Space key to be pressed if a certain condition is true, so perhaps you wish to do something like this:

Global $DoLoot = 0
Func Loot()
    Global $DoLoot
    If $DoLoot Then Send('{SPACE}')
EndFunc
···
If $Button = $GUI_CHECKED Then
    $DoLoot = 1
Else
    $DoLoot = 0
EndIf
···
; some commands
; some commands
; some commands
Loot()
; some commands
; some commands
; some commands
Loot()
; some commands
; some commands
; some commands

In the above code, when Loot() is called the Send() will only be triggered if $DoLoot is not equal to 0.

Link to comment
Share on other sites

LxP, in previous code I was just trying different ways to put it all to work, i never thought GUICtrlRead($loot) could work ^^. Thanks for the code, I done it like this:

$autoloot = GUICtrlCreateCheckbox ("Auto PickUp", 120,153)

Then

Func Loot()

If GUICtrlread($autoloot) = 1 Then

Send("{SPACE}")

Else

EndIf

And here's code fragment ( i changed it completely in order to use less space, so I made it all in variables, theres just 1 scheme rest are vars):

If GUICtrlRead ( $afk1 ) = $GUI_CHECKED AND GUICtrlRead ( $heal ) = $GUI_CHECKED Then

Global $kolor1 = PixelGetColor( $pxl1,$buff1y )

Call ("SmartHeal_")

Call ("Loot")

ElseIf GUICtrlRead ( $afk2 ) = $GUI_CHECKED AND GUICtrlRead ( $heal ) = 1 OR 0 Then

WinActivate("Bez tytułu - Notatnik", "")

Send("1")

Call ("Buff")

Call ("Loot")

Else

Call ("Loot")

EndIf

Well, it works :P

Thanks alot guys! :lmao: But here's my another problem: ...To be continued in other topic...

Link to comment
Share on other sites

Here are some small suggestions for improvement:

The Loot() function can be simplified to this:

Func Loot()
    If GUICtrlRead($AutoLoot) = 1 Then Send('{SPACE}')
EndFunc

Also, instead of Call('XYZ') you can use XYZ(), i.e. --

If GUICtrlRead($AFK1) = $GUI_CHECKED AND GUICtrlRead($Heal) = $GUI_CHECKED Then
    Global $Kolor1 = PixelGetColor($Pxl1, $Buff1Y)
    SmartHeal_()
; Note the corrected line below
ElseIf GUICtrlRead ($afk2) = $GUI_CHECKED And GUICtrlRead($Heal) = 1 Or GUICtrlRead($Heal) = 0 Then
    WinActivate('Bez tytułu - Notatnik')
    Send('1')
    Buff()
EndIf

; Since Loot() is always called it does not need to be part of the If..EndIf block
Loot()

Both ideas will use less CPU.

Link to comment
Share on other sites

Thanks, I'll add them ASAP !!! :(:) Cool ideas anyway

I added more Loot just for fun, so it picks up more items in-game :P that's important for me so i left it alone.

Here's how my Loot looks like now (couldn't change it at all)

Func Loot()
    If GUICtrlRead($autoloot) = 1 Then 
    MsgBox (0, "loading", "" ,1)
    Sleep(1000)
    Sendstr('{SPACE}', 1000)
    Sendstr('{SPACE}', 1000)
    EndIf
    EndFunc

Func Sendstr($istr,$idelay)
    Opt('SendKeyDownDelay',$idelay)
    Send ($istr)
EndFunc

Well, I think it's ok :lmao:

Edited by Mike :)
Link to comment
Share on other sites

Here's another small improvement if you're interested:

Func Loot()
    If GUICtrlRead($AutoLoot) = 1 Then 
        SplashTextOn('', @LF & 'Loading...', 120, 65, -1, -1, 1)
        Sleep(1000)
        SendStr('{SPACE 2}', 1000)
        SplashOff()
    EndIf
EndFunc
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...