Jump to content

Global Vars + Functions Not Working At All..


Recommended Posts

Ok, I have a Function for pixel checksums, Smoke_N gave me them. What i found out after was that the variable $slot4, was not setting itself to 0, which you'll see in the script. Thus, the script would not stop hitting "4". So i decided to modify it, instead of having 1 function for 1 and 2, and another for 3 and 4, i made a Function for each of them. Now they do nothing at all. :D

Global $life1, $lifecom1
AdlibEnable('_Life1', 500)
Global $life2, $lifecom2
AdlibEnable('_Life2', 500)
Global $mana3, $manacom3
AdlibEnable('_Mana3', 500)
Global $mana4, $manacom4
AdlibEnable('_Mana4', 500)
Global $slot1 = 0
Global $slot2 = 0
Global $slot3 = 0
Global $slot4 = 0

Func _Life1()
    $life1 = PixelChecksum(73, 586, 76, 589)
    If $life1 <> $lifecom1 Then
        If $slot1 < 4 Then
            Send('1')
            $lifecom1 = $life1
            $slot1 = $slot1 + 1
            Sleep(2000)
        EndIf
    EndIf
EndFunc   ;==>_Life1
Func _Life2()
    $life2 = PixelChecksum(77, 586, 80, 589)
    If $life2 <> $lifecom2 Then
        If $slot2 < 4 Then
            Send('2')
            $lifecom2 = $life2
            $slot2 = $slot2 + 1
            Sleep(2000)
        EndIf
    EndIf
EndFunc   ;==>_Life2
Func _Mana3()
    $mana3 = PixelChecksum(733, 589, 735, 592)
    If $mana3 <> $manacom3 Then
        If $slot3 < 4 Then
            Send('3')
            $manacom3 = $mana3
            $slot3 = $slot3 + 1
            Sleep(2000)
        EndIf
    EndIf
EndFunc   ;==>_Mana3
Func _Mana4()
    $mana4 = PixelChecksum(737, 589, 736, 592)
    If $mana4 <> $manacom4 Then
        If $slot4 < 4 Then
            Send('4')
            $manacom4 = $mana4
            $slot4 = $slot4 + 1
            Sleep(2000)
        EndIf
    EndIf
EndFunc   ;==>_Mana4
Link to comment
Share on other sites

made a Function for each of them. Now they do nothing at all. :D

[autoit]Global $life1, $lifecom1

AdlibEnable('_Life1', 500)

Global $life2, $lifecom2

AdlibEnable('_Life2', 500)

Global $mana3, $manacom3

AdlibEnable('_Mana3', 500)

Global $mana4, $manacom4

AdlibEnable('_Mana4', 500)

Global $slot1 = 0

Global $slot2 = 0

Global $slot3 = 0

Global $slot4 = 0

well, after the last AdlibEnable() your script simply exists, as it has seen the last line of code to execute (I don't count the variable definitions).

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

well, after the last AdlibEnable() your script simply exists, as it has seen the last line of code to execute (I don't count the variable definitions).

Cheers

Kurt

heh, theres more to the script, i just figured i'd post whats essential :D

and, i believe its possible for multiple adlibs, the first script i received had 2 from Smoke..

Edited by Jasio
Link to comment
Share on other sites

  • Moderators

heh, theres more to the script, i just figured i'd post whats essential :D

and, i believe its possible for multiple adlibs, the first script i received had 2 from Smoke..

No, I showed you here http://www.autoitscript.com/forum/index.ph...st&p=211166 that you must use an AdlibManager... please look at the example, w0uter and dev are correct.

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