Jump to content

Help with multiple things. ControlSend+Inputs


 Share

Recommended Posts

Hi, I'm sorry if this may be asked in other places, but I think it is not.

After searching a while, I've found out a solution to my problem, but another problem arised and maybe the solution did not actually work.

So, I am here asking a couple things. For ControlSend, if I wanted it to send a something in a variable I define like &a, then it should be ControlSend("GameTitle","","",$a) right?

If so, then I guess something is wrong with my overall script. (I just got into AutoIt scripting. Not even "into" it though. What I wanted to say was that I'm new.)

Okay, here is what I wanted to do. I wanted to make a bot for a game, Nostale, to be specific. I have figured out how to make the GUI (Using Koda form maker.) and everything, so then I made a bot.

It worked all up until the defining variables part and such. On my GUI, I have these inputs, and that is supposed to be what the bot is sending to the game. (Example: If the input is C, it'll send C to the game using ControlSend.)

Well, I am very frustrated right now, so I am asking for your help. Please? Here is my script:

#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=Icon_1.ico
#AutoIt3Wrapper_Compression=3
#AutoIt3Wrapper_Res_Comment=David and Miguel sucks. =]
#AutoIt3Wrapper_Res_Description=Nostale bot created by Alan Tai.
#AutoIt3Wrapper_Res_Fileversion=0.4
#AutoIt3Wrapper_Res_Language=1033
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=c:\documents and settings\blueducky\desktop\nosbotale v.0.4 form.kxf
$Form1_1 = GUICreate("Nosbotale v.0.4", 301, 531, 190, 123)
GUISetIcon("C:\Nostale(Global)\Nostale.exe")
$Buff1 = GUICtrlCreateInput("0", 16, 64, 121, 21)
GUICtrlSetLimit(-1, 1)
$Buff2 = GUICtrlCreateInput("9", 16, 96, 121, 21)
GUICtrlSetLimit(-1, 1)
$Buff3 = GUICtrlCreateInput("8", 168, 64, 121, 21)
GUICtrlSetLimit(-1, 1)
$Buff4 = GUICtrlCreateInput("7", 168, 96, 121, 21)
GUICtrlSetLimit(-1, 1)
$Skill1 = GUICtrlCreateInput("1", 16, 192, 121, 21)
GUICtrlSetLimit(-1, 1)
$Skill2 = GUICtrlCreateInput("2", 16, 224, 121, 21)
GUICtrlSetLimit(-1, 1)
$Skill3 = GUICtrlCreateInput("3", 160, 192, 121, 21)
GUICtrlSetLimit(-1, 1)
$Skill4 = GUICtrlCreateInput("4", 160, 224, 121, 21)
GUICtrlSetLimit(-1, 1)
$Label1 = GUICtrlCreateLabel("Insert hotkey for potions or to sit. (C) =>", 8, 320, 188, 17)
$Pot = GUICtrlCreateInput("C", 208, 320, 57, 21)
GUICtrlSetLimit(-1, 1)
$Label2 = GUICtrlCreateLabel("Number of times to attack before using a potion or resting:", 8, 264, 276, 17)
$Attacks = GUICtrlCreateInput("30", 112, 288, 57, 21)
GUICtrlSetLimit(-1, 2)
$Button1 = GUICtrlCreateButton("Click Me to Start Botting!", 80, 440, 129, 49, 0)
GUICtrlSetCursor (-1, 15)
$Buffs = GUICtrlCreateGroup("Buffs - Insert Hotkeys for the buffs you want to use.", 8, 48, 289, 81)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Skills = GUICtrlCreateGroup("Skills - Insert Hotkeys for the skills you want to use.", 8, 176, 289, 81)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label3 = GUICtrlCreateLabel("Note:", 8, 16, 42, 24, -1, $WS_EX_STATICEDGE)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("Just put the same hotkey as another buff/skill", 64, 8, 218, 17)
$Label5 = GUICtrlCreateLabel("if you don't have four buffs or skills.", 64, 24, 169, 17)
$Label6 = GUICtrlCreateLabel("If a skill is on cooldown, it will just attack normally.", 8, 144, 291, 20, BitOR($SS_CENTER,$WS_BORDER))
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("YOU MUST FILL IN EVERYTHING", 40, 392, 210, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label8 = GUICtrlCreateLabel("BEFORE STARTING THE BOT!!!!", 40, 416, 205, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label9 = GUICtrlCreateLabel("Time it takes to kill one monster:", 8, 368, 155, 17)
$KillTime = GUICtrlCreateInput("10", 168, 368, 41, 21)
GUICtrlSetLimit(-1, 3)
$Label10 = GUICtrlCreateLabel("Seconds", 216, 368, 46, 17)
$Label11 = GUICtrlCreateLabel("Must be divisible by 4.", 176, 296, 108, 17)
$Sit = GUICtrlCreateLabel("How long to sit for. (If potting, set as 0)", 8, 344, 185, 17)
$SitTime = GUICtrlCreateInput("0", 200, 344, 25, 21)
$Label12 = GUICtrlCreateLabel("Seconds", 232, 344, 46, 17)
$MenuItem4 = GUICtrlCreateMenu("&File")
$MenuItem5 = GUICtrlCreateMenuItem("Exit", $MenuItem4)
$MenuItem2 = GUICtrlCreateMenu("&About")
$MenuItem6 = GUICtrlCreateMenuItem("Created by MakeItSnow", $MenuItem2)
$MenuItem7 = GUICtrlCreateMenuItem("A.k.A. BlueDucky", $MenuItem2)
$MenuItem8 = GUICtrlCreateMenuItem("a.K.a. t00chineseforya", $MenuItem2)
$MenuItem9 = GUICtrlCreateMenuItem("A.K.A. Alan Tai", $MenuItem2)
$MenuItem1 = GUICtrlCreateMenu("&Help")
$MenuItem10 = GUICtrlCreateMenuItem("Version Info:", $MenuItem1)
$MenuItem12 = GUICtrlCreateMenuItem("v.1 will be the official version.", $MenuItem1)
$MenuItem13 = GUICtrlCreateMenuItem("The bot won't be v.1 until everything works.", $MenuItem1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $MenuItem5
    Exit 0
Case $Button1
    While 1=1
        $a = ($Buff1)
        $b = ($Buff2)
        $c = ($Buff3)
        $d = ($Buff4)
        $e = ($Skill1)
        $f = ($Skill2)
        $g = ($Skill3)
        $h = ($Skill4)
        $i = ($Attacks / 4)
        $j = ($Pot)
        $k = ($KillTime * 1000)
        $l = 0
        $m = ($SitTime * 1000)
            While $l < $i
                ControlSend("Nomad of Silver Spirit - Nostale","","",$a)
                Sleep(3000)
                ControlSend("Nomad of Silver Spirit - Nostale","","",$b)
                Sleep(3000)
                ControlSend("Nomad of Silver Spirit - Nostale","","",$c)
                Sleep(3000)
                ControlSend("Nomad of Silver Spirit - Nostale","","",$d)
                Sleep(3000)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{ESC}")
                Sleep(400)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{SPACE}")
                Sleep(400)
                ControlSend("Nomad of Silver Spirit - Nostale","","",$e)
                Sleep(1000)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{SPACE}")
                Sleep($k)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{X}")
                Sleep(800)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{X}")
                Sleep(800)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{X}")
                Sleep(1000)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{ESC}")
                Sleep(400)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{SPACE}")
                Sleep(400)
                ControlSend("Nomad of Silver Spirit - Nostale","","",$f)
                Sleep(1000)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{SPACE}")
                Sleep($k)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{X}")
                Sleep(800)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{X}")
                Sleep(800)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{X}")
                Sleep(1000)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{ESC}")
                Sleep(400)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{SPACE}")
                Sleep(400)
                ControlSend("Nomad of Silver Spirit - Nostale","","",$g)
                Sleep(1000)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{SPACE}")
                Sleep($k)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{X}")
                Sleep(800)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{X}")
                Sleep(800)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{X}")
                Sleep(1000)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{ESC}")
                Sleep(400)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{SPACE}")
                Sleep(400)
                ControlSend("Nomad of Silver Spirit - Nostale","","",$h)
                Sleep(1000)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{SPACE}")
                Sleep($k)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{X}")
                Sleep(800)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{X}")
                Sleep(800)
                ControlSend("Nomad of Silver Spirit - Nostale","","","{X}")
                Sleep(1000)
                $l = $l + 1
            WEnd
        Sleep(1000)
        ControlSend("Nomad of Silver Spirit - Nostale","","","{C}")
        Sleep($m)
        ControlSend("Nomad of Silver Spirit - Nostale","","","{C}")
        Sleep(1000)
    WEnd

EndSwitch
WEnd

Also, how do you make the exit function exit while it's botting? Only way I know is pausing the script and exitting from the task bar.

Edited by BlueDucky
Link to comment
Share on other sites

I'm not entirely sure what you try to send through the variables as well as I am not sure if controlsend is what you want if you do not actually access a control.

Did you try the send command? The help file recommends using lower case for letters to avoid issues.

It's a good idea to make the window the active one before sending the keys as well as adding short delays between the sent keys to avoid timing issues.

In that case it'd be:

winactivate("Nomad of Silver Spirit - Nostale", "")
Send("Nomad of Silver Spirit - Nostale", "", "{x}")
sleep(10)
Send("Nomad of Silver Spirit - Nostale", "",  $a)
Edited by Automania
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...