Jump to content

Recommended Posts

Posted

#include <GuiConstants.au3>
Opt("GUIOnEventMode",1)
HotKeySet("{F5}", "_Start")
HotKeySet("{ESC}","Terminate")
HotKeySet("^p", "_ToggleRun")
Global $Running = 0, $x, $y, $PixelColor
$ClickIt = 0
GUICreate("Auto-Potter", 200, 150)
GUISetOnEvent($GUI_EVENT_CLOSE,"Terminate")
$Checkbox_1 = GUICtrlCreateCheckbox("Auto-Pot HP", 20, 40, 150, 20)
GUISetState()
While 1
    Sleep( 10 )
WEnd
Exit
Func _Start ()
    $ClickIt = 1
    While $ClickIt = 1
            If BitAND(GUICtrlRead($Checkbox_1), $GUI_CHECKED) = $GUI_CHECKED Then
            While 1
    If $Running Then
        If $PixelColor <> PixelGetColor($x, $y) Then
            Send("{F1}"); F1 = health potion in your game?
            Sleep(1000); Wait long enough for F1 to take effect
        EndIf
    EndIf
    Sleep(50)
Wend

; Toggle the running flag, and save pixel pos and color info
Func _ToggleRun()
    $Running = NOT $Running
    If $Running Then
            $x = MouseGetPos(0)
            $y = MouseGetPos(1)
            $PixelColor = PixelGetColor($x, $y)
    EndIf
EndFunc
    WEnd
EndFunc;==>_Start
Func Terminate ()
    Exit
EndFunc;==>Terminate

Psalty think you can help me here? or anyone, i put your script in with my checkbox think and now it wont wont. If you would please think you can test run that and fix it up? It says Func _togglerun has no matching end func, well i have only 2 funcs on that script so i ahve 2 end funcs, 1 for the func start and other for togglerun. Any ideas anyone?

What's that "WEnd" doing between them... :D

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
Posted

What's that "WEnd" doing between them... :D

Dont know but i took it out, same error, func togglerun has no matching end func

Posted

Dont know but i took it out, same error, func togglerun has no matching end func

Some things to watch for... A function delcaration is done with matching Func/EndFunc statements. Function declarations are not nested. Function declarations are not done in a loop. By convention, for ease of reading and debugging, all function declarations are usually grouped at the bottom of the script. Etc.

You really are going to have to learn some AutoIT fundamentals. I strongly suggest you do the tutorial by Valuator that is linked in my signature. Your comments indicate a desire to have others do this script for you without having to learn it yourself. That is not what this particular forum generaly does.

A SmOke_N wisely said earlier (I should have taken the hint myself at the time)... I'm done here. :D

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
Posted

Thank you for helping but as ive said before the AutoIt 1-2-3 thing DOES NOT work, all it goes over is if you select check box you click run demo it says "This is a checkbox" It teaches me nothing as what ive gotten out of it :D

  • Moderators
Posted

Thank you for helping but as ive said before the AutoIt 1-2-3 thing DOES NOT work, all it goes over is if you select check box you click run demo it says "This is a checkbox" It teaches me nothing as what ive gotten out of it :D

Too bad that line never worked to help me pass a grade. Couldn't believe they used to tell me, "All you need is there, however, what you put in is what you get out".

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.

Posted

Too bad that line never worked to help me pass a grade. Couldn't believe they used to tell me, "All you need is there, however, what you put in is what you get out".

Well ive put everything to try to find that out and nothing gets me ANYwhere but those little demos, it dont give me any scripts or anything :D

Posted

Ok pasalty i wont ask for anymore new questions but can you help me with what youve helped me with once? Your program thing wont work for me...Global $Running = 0, $x, $y, $PixelColor

HotKeySet("^p", "_ToggleRun")

While 1
    If $Running Then
        If $PixelColor <> PixelGetColor($x, $y) Then
            Send("{F1}"); F1 = health potion in your game?
            Sleep(1000); Wait long enough for F1 to take effect
        EndIf
    EndIf
    Sleep(50)
Wend

; Toggle the running flag, and save pixel pos and color info
Func _ToggleRun()
    $Running = NOT $Running
    If $Running Then
            $x = MouseGetPos(0)
            $y = MouseGetPos(1)
            $PixelColor = PixelGetColor($x, $y)
        EndIf
EndFunc

$x = MouseGetPos(0) <---- says incorrect number of parameters when i hit ctrl+p. Any idea?

$y = MouseGetPos(1)

Posted

Ok pasalty i wont ask for anymore new questions but can you help me with what youve helped me with once? Your program thing wont work for me...Global $Running = 0, $x, $y, $PixelColor

HotKeySet("^p", "_ToggleRun")

$x = MouseGetPos(0) <---- says incorrect number of parameters when i hit ctrl+p. Any idea?

$y = MouseGetPos(1)

Yes, that may actually explain many of your troubles. The regular production (Prod or stable) version of AuotIT 3.1.1 uses no parameters for the MouseGetPos() function. Many usefull features have been added by the fine people associated with AutoIT, and these updates are put out for testing and eventual inclusion in the next Prod, as Beta versions. The current online help file is for Beta version 3.1.127!

Most people have found the enhancements of the Beta version so usefull they never bother with the Prod version. Most of the solutions posted on this forum are coded under the current Beta. If you look at the Beta ver help file entry for MouseGetPos(), you see the extra parameter that was added. So if you want to use that method, it will require running and/or compiling with Beta, not Prod. It looks like that is the only Beta function used in my little code snippet, so if you modify it to use the Prod version of MouseGetPos(), it should work for you under Prod:

Global $Running = 0, $MPos, $PixelColor
HotKeySet("^p", "_ToggleRun")

While 1
    If $Running Then
        If $PixelColor <> PixelGetColor($MPos[0], $MPos[1]) Then
            Send("{F1}"); F1 = health potion in your game?
            Sleep(1000); Wait long enough for F1 to take effect
        EndIf
    EndIf
    Sleep(50)
Wend

; Toggle the running flag, and save pixel pos and color info
Func _ToggleRun()
    $Running = NOT $Running
    If $Running Then
            $MPos = MouseGetPos()
            $PixelColor = PixelGetColor($MPos[0], $MPos[1])
        EndIf
EndFunc

The same issue of not using Beta may be why the AutoIT 1-2-3 tutorial and other things aren't working for you.

:D

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
Posted

Ok thanks but where do i get the beta version at? i looked on the home page could not find :wacko:

The link is buried a little bit, but not hard to find. From the Home Page, follow the link for AutoIT v3, then the link for Downloads, and all the way at the bottom of the page is the link for Beta Versions.

:D

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
Posted

Well since i dont know how to stick your code for the ctrl+p i jsut did a stupider way -.-

#include <GuiConstants.au3>
Opt("GUIOnEventMode",1)
HotKeySet("{F5}", "_Start")
HotKeySet("{F7}", "_NoClick")
HotKeySet("{ESC}","Terminate")
Dim $mycheckbox1
Dim $mycheckbox2
Dim $mycheckbox3
Dim $mycheckbox4
$ClickIt = 0
GUICreate("CO-MacroBot", 400, 300)
GUISetOnEvent($GUI_EVENT_CLOSE,"Terminate")
$Checkbox_1 = GUICtrlCreateCheckbox("Auto-Follow", 20, 40, 150, 20)
$Checkbox_2 = GUICtrlCreateCheckbox("Move-Miner", 20, 80, 150, 20)
$Checkbox_3 = GUICtrlCreateCheckbox("Fire circle lvler", 20, 120, 150, 20)
$Checkbox_4 = GUICtrlCreateCheckbox("Right-clicker", 20, 160, 150, 20)
GUISetState()
While 1
    Sleep( 10 )
WEnd
Exit
Func _Start ()
    $ClickIt = 1
    While $ClickIt = 1
        If BitAND(GUICtrlRead($Checkbox_1), $GUI_CHECKED) = $GUI_CHECKED Then
            While $mycheckbox1
                $correct_color = PixelGetColor( 57, 742 )
                while 1
                    If $correct_color <> PixelGetColor( 57, 742 ) Then
                        Send('{F8}')
                        Sleep(1500)
                    EndIf
                WEnd
                Sleep(100)
            WEnd
        EndIf
        If BitAND(GUICtrlRead($Checkbox_2), $GUI_CHECKED) = $GUI_CHECKED Then
            While $mycheckbox2
                $correct_color = PixelGetColor( 382, 730 )
                while 1
                    If $correct_color <> PixelGetColor( 382, 730 ) Then
                        Send('{F9}')
                        Sleep(1500)
                    EndIf
                WEnd
                Sleep(100)
            WEnd
        EndIf
        If BitAND(GUICtrlRead($Checkbox_3), $GUI_CHECKED) = $GUI_CHECKED Then
            While $mycheckbox3
                $correct_color = PixelGetColor( 63, 735 )
                while 1
                    If $correct_color <> PixelGetColor( 63, 735 ) Then
                        Send('{F6}')
                        Sleep(1500)
                    EndIf
                WEnd
                Sleep(100)
            WEnd
        EndIf
        If BitAND(GUICtrlRead($Checkbox_4), $GUI_CHECKED) = $GUI_CHECKED Then
            While $mycheckbox4
                $correct_color = PixelGetColor( 300, 730 )
                while 1
                    If $correct_color <> PixelGetColor( 300, 730 ) Then
                        Send('{F7}')
                        Sleep(1500)
                    EndIf
                WEnd
                Sleep(100)
            WEnd
        EndIf
        If GUICtrlRead($Checkbox_1) And GUICtrlRead($Checkbox_2) And GUICtrlRead($Checkbox_3) And GUICtrlRead($Checkbox_4)= $GUI_CHECKED Then
            While $mycheckbox1
                $correct_color = PixelGetColor( 57, 742 )
                while 1
                    If $correct_color <> PixelGetColor( 57, 742 ) Then
                        Send('{F8}')
                        Sleep(1500)
                    EndIf
                WEnd
                Sleep(100)
            WEnd
            While $mycheckbox2
                $correct_color = PixelGetColor( 382, 730 )
                while 1
                    If $correct_color <> PixelGetColor( 382, 730 ) Then
                        Send('{F9}')
                        Sleep(1500)
                    EndIf
                WEnd
                Sleep(100)
            WEnd
            While $mycheckbox3
                $correct_color = PixelGetColor( 63, 735 )
                while 1
                    If $correct_color <> PixelGetColor( 63, 735 ) Then
                        Send('{F6}')
                        Sleep(1500)
                    EndIf
                WEnd
                Sleep(100)
            WEnd
            While $mycheckbox4
                $correct_color = PixelGetColor( 300, 730 )
                while 1
                    If $correct_color <> PixelGetColor( 300, 730 ) Then
                        Send('{F7}')
                        Sleep(1500)
                    EndIf
                WEnd
                Sleep(100)
            WEnd
        EndIf
    WEnd
EndFunc ;==>_Start
Func _NoClick ()
    ToolTip("")
    $ClickIt = 0
EndFunc ;==>_NoClick
Func Terminate ()
    Exit
EndFunc ;==>Terminate

But only problem me and friend cannot figure out, is how to make them all work if 1+ is checked... any ideas psalty?

Posted

Well since i dont know how to stick your code for the ctrl+p i jsut did a stupider way -.-

CODE
#include <GuiConstants.au3>

Opt("GUIOnEventMode",1)

HotKeySet("{F5}", "_Start")

HotKeySet("{F7}", "_NoClick")

HotKeySet("{ESC}","Terminate")

Dim $mycheckbox1

Dim $mycheckbox2

Dim $mycheckbox3

Dim $mycheckbox4

$ClickIt = 0

GUICreate("CO-MacroBot", 400, 300)

GUISetOnEvent($GUI_EVENT_CLOSE,"Terminate")

$Checkbox_1 = GUICtrlCreateCheckbox("Auto-Follow", 20, 40, 150, 20)

$Checkbox_2 = GUICtrlCreateCheckbox("Move-Miner", 20, 80, 150, 20)

$Checkbox_3 = GUICtrlCreateCheckbox("Fire circle lvler", 20, 120, 150, 20)

$Checkbox_4 = GUICtrlCreateCheckbox("Right-clicker", 20, 160, 150, 20)

GUISetState()

While 1

Sleep( 10 )

WEnd

Exit

Func _Start ()

$ClickIt = 1

While $ClickIt = 1

If BitAND(GUICtrlRead($Checkbox_1), $GUI_CHECKED) = $GUI_CHECKED Then

While $mycheckbox1

$correct_color = PixelGetColor( 57, 742 )

while 1

If $correct_color <> PixelGetColor( 57, 742 ) Then

Send('{F8}')

Sleep(1500)

EndIf

WEnd

Sleep(100)

WEnd

EndIf

If BitAND(GUICtrlRead($Checkbox_2), $GUI_CHECKED) = $GUI_CHECKED Then

While $mycheckbox2

$correct_color = PixelGetColor( 382, 730 )

while 1

If $correct_color <> PixelGetColor( 382, 730 ) Then

Send('{F9}')

Sleep(1500)

EndIf

WEnd

Sleep(100)

WEnd

EndIf

If BitAND(GUICtrlRead($Checkbox_3), $GUI_CHECKED) = $GUI_CHECKED Then

While $mycheckbox3

$correct_color = PixelGetColor( 63, 735 )

while 1

If $correct_color <> PixelGetColor( 63, 735 ) Then

Send('{F6}')

Sleep(1500)

EndIf

WEnd

Sleep(100)

WEnd

EndIf

If BitAND(GUICtrlRead($Checkbox_4), $GUI_CHECKED) = $GUI_CHECKED Then

While $mycheckbox4

$correct_color = PixelGetColor( 300, 730 )

while 1

If $correct_color <> PixelGetColor( 300, 730 ) Then

Send('{F7}')

Sleep(1500)

EndIf

WEnd

Sleep(100)

WEnd

EndIf

If GUICtrlRead($Checkbox_1) And GUICtrlRead($Checkbox_2) And GUICtrlRead($Checkbox_3) And GUICtrlRead($Checkbox_4)= $GUI_CHECKED Then

While $mycheckbox1

$correct_color = PixelGetColor( 57, 742 )

while 1

If $correct_color <> PixelGetColor( 57, 742 ) Then

Send('{F8}')

Sleep(1500)

EndIf

WEnd

Sleep(100)

WEnd

While $mycheckbox2

$correct_color = PixelGetColor( 382, 730 )

while 1

If $correct_color <> PixelGetColor( 382, 730 ) Then

Send('{F9}')

Sleep(1500)

EndIf

WEnd

Sleep(100)

WEnd

While $mycheckbox3

$correct_color = PixelGetColor( 63, 735 )

while 1

If $correct_color <> PixelGetColor( 63, 735 ) Then

Send('{F6}')

Sleep(1500)

EndIf

WEnd

Sleep(100)

WEnd

While $mycheckbox4

$correct_color = PixelGetColor( 300, 730 )

while 1

If $correct_color <> PixelGetColor( 300, 730 ) Then

Send('{F7}')

Sleep(1500)

EndIf

WEnd

Sleep(100)

WEnd

EndIf

WEnd

EndFunc ;==>_Start

Func _NoClick ()

ToolTip("")

$ClickIt = 0

EndFunc ;==>_NoClick

Func Terminate ()

Exit

EndFunc ;==>Terminate

But only problem me and friend cannot figure out, is how to make them all work if 1+ is checked... any ideas psalty?

I don't understand what you're doing with the Wile/Wend loops that use the $mycheckbox1, $mycheckbox2, etc. variables. What sets the value in those variables? If you Dim a variable without initializing it to anything, it is may not give a usable non-zero to the While command, so those loops would never execute. But I can't tell for sure 'cause I'm not using Windows, so I can't test that.

Since I'm only running the script in my head, I can't really see what else is wrong.

Ciao! :D

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
Posted

I don't understand what you're doing with the Wile/Wend loops that use the $mycheckbox1, $mycheckbox2, etc. variables. What sets the value in those variables? If you Dim a variable without initializing it to anything, it is may not give a usable non-zero to the While command, so those loops would never execute. But I can't tell for sure 'cause I'm not using Windows, so I can't test that.

Since I'm only running the script in my head, I can't really see what else is wrong.

Ciao! :D

idk i jsut stcuk those dims in there, with just a while and wend still dont work. I want it so if i check checkbox 1 checkbox 1 will do its job, if i check checkbox 1,2, and 3 they will all do there own job but owrk together... any ideas?

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
×
×
  • Create New...