New scripter

12/18/2010 19:19 nwomatt#1
Hey people. Im new to coding and tried makin a bot for a game. I have the bot working but only through following my mouse actions. I just need abit of help getting the script to read the gui input box's, I have read tutorials and youtube vids and got no where. i tried the learning to script with autoit v3 and think it's the 4.3 Assigning variable values. but there is no demo code so im still lost.
Code:
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Global $Paused

$Form1 = GUICreate("AngelBot v0.1", 289, 353, 325, 174)
$Menumain = GUICtrlCreateMenu("General")
$MenuItem6 = GUICtrlCreateMenuItem("Load", $Menumain)
$MenuItem5 = GUICtrlCreateMenuItem("Load Settings", $Menumain)
$MenuItem4 = GUICtrlCreateMenuItem("Save", $Menumain)
$MenuItem3 = GUICtrlCreateMenuItem("Save As", $Menumain)
$exit = GUICtrlCreateMenuItem("Exit", $Menumain)
$menu2 = GUICtrlCreateMenu("About")
$MenuItem7 = GUICtrlCreateMenuItem("Documentation", $menu2)
$MenuItem1 = GUICtrlCreateMenuItem("Version", $menu2)
$MenuItem8 = GUICtrlCreateMenuItem("Help", $menu2)
$MenuItem2 = GUICtrlCreateMenuItem("Website", $menu2)
GUISetBkColor(0x000000)
$startmining = GUICtrlCreateButton("Start Mining", 8, 280, 113, 41)
GUICtrlSetFont(-1, 14, 400, 0, "Papyrus")
GUICtrlSetBkColor(-1, 0xC0C0C0)
$Group1 = GUICtrlCreateGroup("", 8, 96, 113, 169)
$Drones = GUICtrlCreateCheckbox("Drones", 16, 112, 97, 17)
GUICtrlSetFont(-1, 12, 400, 0, "Papyrus")
GUICtrlSetColor(-1, 0x00FF00)
$cargoboxs = GUICtrlCreateCheckbox("CBox", 16, 136, 97, 17)
GUICtrlSetFont(-1, 12, 400, 0, "Papyrus")
GUICtrlSetColor(-1, 0x00FF00)
$Jettison = GUICtrlCreateCheckbox("Jettison", 16, 160, 97, 17)
GUICtrlSetFont(-1, 12, 400, 0, "Papyrus")
GUICtrlSetColor(-1, 0x00FF00)
$lazramm = GUICtrlCreateCombo("1", 16, 184, 33, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "1|2|3")
$lasamm = GUICtrlCreateLabel("Laser", 56, 184, 44, 24)
GUICtrlSetFont(-1, 12, 400, 0, "Papyrus")
GUICtrlSetColor(-1, 0x00FF00)
$Label1 = GUICtrlCreateLabel("Laser*", 57, 208, 50, 24)
GUICtrlSetFont(-1, 12, 400, 0, "Papyrus")
GUICtrlSetColor(-1, 0x00FF00)
$lzramm = GUICtrlCreateInput("180", 16, 208, 33, 21)
$Input4 = GUICtrlCreateInput("Input4", 16, 232, 33, 21)
$Label8 = GUICtrlCreateLabel("Trvltime", 56, 232, 60, 29)
GUICtrlSetFont(-1, 12, 400, 0, "Papyrus")
GUICtrlSetColor(-1, 0x00FF00)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("", 128, 0, 153, 329)
$astlist = GUICtrlCreateCombo("Veldspar", 136, 40, 137, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Veldspar|Scordite|Pyroxeres|Plagioclase|Omber|Kernite|Jaspet|Hemorphite|Hedbergite|Gneiss|Dark Ochre|Crokite|Spodumain|Bistot|Arkanor|Mercoxit|Condensed Alloy|Crystal Compound|Precious Alloy|Sheen Compound|Gleaming Alloy|Lucent Compound|Dark Compound|Motley Compound|Lustering Alloy|Glossy Compound|Plush Compound|Opulent Compound")
$Label2 = GUICtrlCreateLabel("Asteroids:", 167, 11, 75, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x00FF00)
$List1 = GUICtrlCreateList("", 136, 72, 137, 71)
GUICtrlSetData(-1, "")
$Label3 = GUICtrlCreateLabel("Emergency", 188, 197, 73, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Papyrus")
GUICtrlSetColor(-1, 0x00FF00)
$Label4 = GUICtrlCreateLabel("Logoff", 203, 213, 41, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Papyrus")
GUICtrlSetColor(-1, 0x00FF00)
$Cargobox = GUICtrlCreateCheckbox("", 144, 208, 17, 17)
$Label6 = GUICtrlCreateLabel("Container", 203, 303, 61, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Papyrus")
GUICtrlSetColor(-1, 0x00FF00)
$Label5 = GUICtrlCreateLabel("Bookmarks", 203, 271, 73, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Papyrus")
GUICtrlSetColor(-1, 0x00FF00)
$Label7 = GUICtrlCreateLabel("Cargo", 203, 239, 61, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Papyrus")
GUICtrlSetColor(-1, 0x00FF00)
$Input1 = GUICtrlCreateInput("10", 136, 264, 33, 21)
$Input3 = GUICtrlCreateInput("Name", 136, 296, 33, 21)
$Input2 = GUICtrlCreateInput("Size", 136, 232, 33, 21)
$Addore = GUICtrlCreateButton("Add", 144, 152, 51, 17)
$Remore = GUICtrlCreateButton("Remove", 208, 152, 51, 17)
$oreup = GUICtrlCreateButton("Up", 144, 176, 51, 17)
$oredown = GUICtrlCreateButton("Down", 208, 176, 51, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\matt\My Documents\My Pictures\alien head.jpg", 8, 16, 113, 81, BitOR($GUI_SS_DEFAULT_PIC,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    If  $nmsg = $startmining Then startmining()
    If  $nmsg = $exit Then Exit
    HotKeySet("{PAUSE}", "TogglePause")
    HotKeySet("{ESC}", "Terminate")
    HotKeySet("+!d", "ShowMessage")
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func startmining()

    $var = MsgBox(0,"","Please make sure eve is ready check help doc Before starting.")


_WinWaitActivate("EVE","")
    opt("MouseClickDelay", 25000)
MouseClick("left",18,748,1)
    Opt("MouseClickDelay", 5000)
MouseClick("right",111,291,1)
    Opt("MouseClickDelay", 2000)
MouseClick("left",162,301,1,2000)
    Opt("MouseClickDelay", 54000)
MouseClick("right",762,207,1)
    Opt("MouseClickDelay", 1000)
MouseClick("left",790,262,1)
    Opt("MouseClickDelay", 1000)
MouseClick("right",737,222,1)
    Opt("MouseClickDelay", 1000)
MouseClick("left",780,274,1)
    Opt("MouseClickDelay", 1000)
MouseClick("left",620,656,1)
    Opt("MouseClickDelay", 1000)
MouseClick("left",499,63,1)
    Opt("MouseClickDelay", 1000)
MouseClick("left",662,655,1)
    Opt("MouseClickDelay", 180000)
MouseClick("right",724,560,1)
    Opt("MouseClickDelay", 1000)
MouseClick("left",770,584,1)
    Opt("MouseClickDelay", 1000)
MouseClick("right",762,207,1)
    Opt("MouseClickDelay", 2000)
MouseClick("left",790,262,1)
    Opt("MouseClickDelay", 1000)
MouseClick("right",737,222,1)
    Opt("MouseClickDelay", 1000)
MouseClick("right",762,207,1)
    Opt("MouseClickDelay", 1000)
MouseClick("left",790,262,1)
    Opt("MouseClickDelay", 1000)
MouseClick("right",737,222,1)
    Opt("MouseClickDelay", 2000)
MouseClick("left",780,274,1)
    Opt("MouseClickDelay", 1000)
MouseClick("left",620,656,1)
    Opt("MouseClickDelay", 1000)
MouseClick("right",759,579,1)
    Opt("MouseClickDelay", 15000)
MouseClick("left",838,620,1)
    Opt("MouseClickDelay", 2000)
MouseClick("left",499,63,1)
    Opt("MouseClickDelay", 1000)
MouseClick("left",662,655,1)
    Opt("MouseClickDelay", 1000)
MouseClick("right",167,205,1)
    Opt("MouseClickDelay", 1000)
MouseClick("left",217,260,1)
    Opt("MouseClickDelay", 80000)
MouseClick("right",439,103,1)
    Opt("MouseClickDelay", 1000)
MouseClick("left",523,108,1)
    Opt("MouseClickDelay", 1000)
Mouseclickdrag("left",470,216,130,718,3000)

EndFunc

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd


    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func ShowMessage()
    MsgBox(4096,"","This is a message.")
EndFunc



Func _WinWaitActivate($title,$text,$timeout=0)
    WinWait($title,$text,$timeout)
    If Not WinActive($title,$text) Then WinActivate($title,$text)
    WinWaitActive($title,$text,$timeout)
EndFunc

$i = $Label8
Do
   MouseClickDelay $Label8
    $i = $Label8 + 1
Until $i = $label8
as you can see i have tried a Do to read the input box lol xD If somebody could please show me how it would be done id well appreciate it. Aslong as i know hot to read from the input box's im sure the rest is self explanitary with the autoit help and youtube.

for e.g i have
Code:
lzramm = GUICtrlCreateInput("180", 16, 208, 33, 21)
this is the input ammount that tells A mouseklick to wait for ammount of time that was inputted
12/18/2010 19:30 Banana.Crafts#2
GuiCtrlRead()

Get the syntax from the Scite-Help...
12/18/2010 19:35 nwomatt#3
Quote:
Originally Posted by Banana.Crafts View Post
GuiCtrlRead()

Get the syntax from the Scite-Help...
thanks mate :) u a legend
12/18/2010 21:22 nwomatt#4
so i tried lookin through that doc :( it doesnt show me how id make it a timer. so if somebody inputs 10000 into the input box it waits for 10 seconds then runs the command. But will be for. just an excample
Code:
 Opt("MouseClickDelay", 1000)
MouseClick("left",620,656,1)
12/19/2010 00:04 .Infinite#5
Are you looking for Sleep() command?
12/19/2010 01:17 nwomatt#6
Quote:
Originally Posted by .Infinite View Post
Are you looking for Sleep() command?
No but sleep would be better for the longer durations i never thought of that :) thx. What im tryin 2 do is to make it sleep/mouseclickdelay for the ammount of time i tell it to in the gui. $input1. Im new to scripting. been at it for 2 days :).
12/19/2010 02:36 nwomatt#7
thx all i found this [Only registered and activated users can see links. Click Here To Register...] ill take a look at it in the morning
12/19/2010 11:47 .Infinite#8
I still don't understand what youre trying to do.
You could do it like this:

Sleep( GuiCtrlRead($TimeInput) ) It would Sleep for the time (in miliseconds) you declare in the GUI...
12/19/2010 15:48 nwomatt#9
thx infinite yh thats the 1 :) just needed to know how to read from gui
Code:
GuiCtrlRead
i did it like
Code:
$lzrsleep1 = GUICtrlRead($lzramm) 
sleep($lzrsleep1)
MouseClick("left",499,63,1)
workes nicely. i will change it in future so the whole script dont freeze. just goin step at a time