Sign in to follow this  
Followers 0
Dinosaurr

Send key from input box...

9 posts in this topic

#include <GUIConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MemoryEdit.au3>

$Archer = GUICreate("Archer Macro", 157, 146, 462, 402, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
GUISetFont(8, 400, 0, "Microsoft Sans Serif")
GUISetBkColor(0xFFFFE1)
$HPLabel = GUICtrlCreateLabel("Hp to pot:", 8, 8, 51, 17)
$WolfLabel = GUICtrlCreateLabel("WolfKey:", 8, 32, 47, 17)
$AttackLabel = GUICtrlCreateLabel("AttackKey:", 8, 56, 56, 17)
$HPKeyLabel = GUICtrlCreateLabel("HP Key:", 8, 80, 43, 17)
$HPInput = GUICtrlCreateInput("hphere", 64, 8, 57, 21)
$WolfKey = GUICtrlCreateInput("keyhere", 64, 32, 57, 21)
$AttackKey = GUICtrlCreateInput("keyhere", 64, 56, 57, 21)
$HPKey = GUICtrlCreateInput("keyhere", 64, 80, 57, 21)
$AutoWolf = GUICtrlCreateCheckbox("AutoWolf", 8, 104, 65, 17)
$AutoAttack = GUICtrlCreateCheckbox("AutoAttack", 80, 104, 73, 17)
$AutoPot = GUICtrlCreateCheckbox("AutoPot", 8, 128, 65, 17)
$MacroStart = GUICtrlCreateButton("Start", 80, 128, 73, 17, 0)
TraySetState(2)
Global $AttackCheck
Global $WolfCheck
Global $PotCheck
Global $AttackKey1
Global $WolfKey1
Global $HPKey1
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $MacroStart
            If WinExists("Knight OnLine Client") Then
                WinActivate("Knight OnLine Client")
                AdlibEnable("AutoWolf")
                AdlibEnable("AutoAttack")
                AdlibEnable("AutoPot")
            Else
                MsgBox(1, "Error!", "Knight Online is not open!")
            EndIf
    EndSwitch
WEnd

Func AutoAttack()
    While 1
        $AttackKey1 = GuiCtrlRead($AttackKey)
        $AttackCheck = GuiCtrlRead($AutoAttack)
        If $AttackCheck = $GUI_CHECKED Then
            WinWaitActive("Knight OnLine Client")
            Send("z")
            Send($AttackKey1)
            Sleep(1000)
        Else
            ExitLoop
        EndIf
    WEnd
EndFunc

Func AutoWolf()
    While 1
        $WolfKey1 = GuiCtrlRead($WolfKey)
        $WolfCheck = GuiCtrlRead($AutoWolf)
        If $WolfCheck = $GUI_CHECKED Then
            Send("8")
            Send($WolfKey1)
            Sleep(127000)
        Else
            ExitLoop
        EndIf
    WEnd
EndFunc

Func AutoPot()
    While 1
        Global $OffsetArray[2]
        $HPKey1 = GuiCtrlRead($HPKey)
        $PotCheck = GuiCtrlRead($AutoPot)
        $baseADDR = "0x00B6AECC"
        $OffsetArray[1] = "00000594"
        $PID = WinGetProcess("Knight OnLine Client")
        $Process = _MemoryOpen($PID)
        $CurrentHP = _MemoryPointerRead($baseADDR, $Process, $OffsetArray)
        _MemoryClose($PID)
        If $PotCheck = $GUI_CHECKED And $HPInput > $CurrentHP Then
            Send($HPKey1)
        Else
            ExitLoop
        EndIf
    WEnd
EndFunc

Thats the full code...Critique it if you want, But im really only looking for help with how to send key the user puts in from the input box.

I tried setting a variable for the key put into the input box and sending the variable, but that apprently doesnt work.

Anyone want to give me a push off in the right direction?

Share this post


Link to post
Share on other sites



#include <GUIConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MemoryEdit.au3>

$Archer = GUICreate("Archer Macro", 157, 146, 462, 402, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
GUISetFont(8, 400, 0, "Microsoft Sans Serif")
GUISetBkColor(0xFFFFE1)
$HPLabel = GUICtrlCreateLabel("Hp to pot:", 8, 8, 51, 17)
$WolfLabel = GUICtrlCreateLabel("WolfKey:", 8, 32, 47, 17)
$AttackLabel = GUICtrlCreateLabel("AttackKey:", 8, 56, 56, 17)
$HPKeyLabel = GUICtrlCreateLabel("HP Key:", 8, 80, 43, 17)
$HPInput = GUICtrlCreateInput("hphere", 64, 8, 57, 21)
$WolfKey = GUICtrlCreateInput("keyhere", 64, 32, 57, 21)
$AttackKey = GUICtrlCreateInput("keyhere", 64, 56, 57, 21)
$HPKey = GUICtrlCreateInput("keyhere", 64, 80, 57, 21)
$AutoWolf = GUICtrlCreateCheckbox("AutoWolf", 8, 104, 65, 17)
$AutoAttack = GUICtrlCreateCheckbox("AutoAttack", 80, 104, 73, 17)
$AutoPot = GUICtrlCreateCheckbox("AutoPot", 8, 128, 65, 17)
$MacroStart = GUICtrlCreateButton("Start", 80, 128, 73, 17, 0)
TraySetState(2)
Global $AttackCheck
Global $WolfCheck
Global $PotCheck
Global $AttackKey1
Global $WolfKey1
Global $HPKey1
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $MacroStart
            If WinExists("Knight OnLine Client") Then
                WinActivate("Knight OnLine Client")
                AdlibEnable("AutoWolf")
                AdlibEnable("AutoAttack")
                AdlibEnable("AutoPot")
            Else
                MsgBox(1, "Error!", "Knight Online is not open!")
            EndIf
    EndSwitch
WEnd

Func AutoAttack()
    While 1
        $AttackKey1 = GuiCtrlRead($AttackKey)
        $AttackCheck = GuiCtrlRead($AutoAttack)
        If $AttackCheck = $GUI_CHECKED Then
            WinWaitActive("Knight OnLine Client")
            Send("z")
            Send($AttackKey1)
            Sleep(1000)
        Else
            ExitLoop
        EndIf
    WEnd
EndFunc

Func AutoWolf()
    While 1
        $WolfKey1 = GuiCtrlRead($WolfKey)
        $WolfCheck = GuiCtrlRead($AutoWolf)
        If $WolfCheck = $GUI_CHECKED Then
            Send("8")
            Send($WolfKey1)
            Sleep(127000)
        Else
            ExitLoop
        EndIf
    WEnd
EndFunc

Func AutoPot()
    While 1
        Global $OffsetArray[2]
        $HPKey1 = GuiCtrlRead($HPKey)
        $PotCheck = GuiCtrlRead($AutoPot)
        $baseADDR = "0x00B6AECC"
        $OffsetArray[1] = "00000594"
        $PID = WinGetProcess("Knight OnLine Client")
        $Process = _MemoryOpen($PID)
        $CurrentHP = _MemoryPointerRead($baseADDR, $Process, $OffsetArray)
        _MemoryClose($PID)
        If $PotCheck = $GUI_CHECKED And $HPInput > $CurrentHP Then
            Send($HPKey1)
        Else
            ExitLoop
        EndIf
    WEnd
EndFunc

Thats the full code...Critique it if you want, But im really only looking for help with how to send key the user puts in from the input box.

I tried setting a variable for the key put into the input box and sending the variable, but that apprently doesnt work.

Anyone want to give me a push off in the right direction?

You have used AdLibEnable incorrectly and you can only have one function called by AdLibEnable. Maybe you need to call a function rather than have AdLibEnable repeatedly call it since ecah function has While/wend, and maybe you need to combine them into one function.

The line

If $PotCheck = $GUI_CHECKED And $HPInput > $CurrentHP Then

should be, I think,

If $PotCheck = $GUI_CHECKED And GuiCtrlRead($HPInput) > $CurrentHP Then


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

You have used AdLibEnable incorrectly and you can only have one function called by AdLibEnable. Maybe you need to call a function rather than have AdLibEnable repeatedly call it since ecah function has While/wend, and maybe you need to combine them into one function.

The line

If $PotCheck = $GUI_CHECKED And $HPInput > $CurrentHP Then

should be, I think,

If $PotCheck = $GUI_CHECKED And GuiCtrlRead($HPInput) > $CurrentHP Then

Oh i see, thanks for those tips.

I was wondering what the difference between call and adlibenable was :mellow: (besides being able to disable with adlibdisable)

and i think the latter should be right, i forgot that.

But other than that, can i send keys from a variable like that?

Send($Variablename)

?

Share this post


Link to post
Share on other sites

Also, I dont think you can send things to knight online.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Also, I dont think you can send things to knight online.

Off topic but, yes you can.

there is no protection system in it anymore, so it is possible.

[Edit] Unless you are talking about some reason other than the antihack preventing autoit from sending keys?

Edited by Dinosaurr

Share this post


Link to post
Share on other sites

Nope, Send() to your hearts content, then. xD


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Nope, Send() to your hearts content, then. xD

Alrighty then, question still stands if i can send a variable like Send($variablename), also if it would be more efficient to add everything into one function rather than having them all in separate functions? Or would it be the same? It just seems much cleaner with them in different functions :S

Share this post


Link to post
Share on other sites

I would have different functions, and from my experience, ive been able to send variables.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

I would have different functions, and from my experience, ive been able to send variables.

Okay, thanks.

I am done asking questions for now then.

Share this post


Link to post
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
Sign in to follow this  
Followers 0