Jump to content

Cant get my script to work, can you help me plz ?


Recommended Posts

Hi guys,

I have a script that i use to play a game (its not a bot) that works just fine, but i tried to make an interface for it but it doesnt work with it. The interface runs fine but when i fill the fields and press ok, nothing happens and the script doesnt do what it has to do.

Here is the script that works:

HotKeySet("^{SPACE}", "skills")
HotKeySet("^{NUMPADSUB}", "buffs")
HotKeySet("{ESC}","Terminate")

While 1
    Sleep(500)
WEnd
    
Func skills()
        Send ("{F1}")
            Sleep(300)
    Send("1")
        Sleep(500)
    Send("2")
        Sleep(500)
    Send("3")
        Sleep(500)
    Send("4")
EndFunc

Func buffs()
        Send ("{F2}")
            Sleep(500)
    Send("1")
        Sleep(1000)
    Send("2")
        Sleep(1000)
    Send("3")
        Sleep(1000)
    Send("4")
        Sleep(500)
        Send ("{F1}")
EndFunc

Func Terminate()
    Exit
EndFunc

Now here is the same thing (at least supose to be) with an interface:

Dim $slot1
Dim $slot2
Dim $slot3
Dim $slot4
Dim $slot5

Dim $delay1
Dim $delay2
Dim $delay3
Dim $delay4
Dim $delay5

Dim $buffslot1
Dim $buffslot2
Dim $buffslot3
Dim $buffslot4
Dim $buffslot5


#include <GUIConstants.au3>

GUICreate("Power Combo Attack", 220,320)
GUISetState (@SW_Show)
GUICtrlCreateLabel ("Attack (F1 Bar) - Ctrl+Space",  10, 5, 220)
GUICtrlCreateLabel ("Skill 1",  10, 30, 40)
   $slot1 = GUICtrlCreateInput ( "", 45,  25, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("Delay",  80, 30, 40)
   $delay1 = GUICtrlCreateInput ( "", 110,  25, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("ms (miliseconds)",  140, 30, 90)
GUICtrlCreateLabel ("Skill 2",  10, 55, 40)
   $slot2 = GUICtrlCreateInput ( "", 45,  50, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("Delay",  80, 55, 40)
   $delay2 = GUICtrlCreateInput ( "", 110,  50, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("ms (miliseconds)",  140, 55, 90)
GUICtrlCreateLabel ("Skill 3",  10, 80, 40)
   $slot3 = GUICtrlCreateInput ( "", 45,  75, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("Delay",  80, 80, 40)
   $delay3 = GUICtrlCreateInput ( "", 110,  75, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("ms (miliseconds)",  140, 80, 90)
GUICtrlCreateLabel ("Skill 4",  10, 105, 40)
   $slot4 = GUICtrlCreateInput ( "", 45,  100, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("Delay",  80, 105, 40)
   $delay4 = GUICtrlCreateInput ( "", 110,  100, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("ms (miliseconds)",  140, 105, 90)
GUICtrlCreateLabel ("Skill 5",  10, 130, 40)
   $slot5 = GUICtrlCreateInput ( "", 45,  125, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("Delay",  80, 130, 40)
   $delay5 = GUICtrlCreateInput ( "", 110,  125, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("ms (miliseconds)",  140, 130, 90)


GUICtrlCreateLabel ("Buffs (F2 Bar) - Ctrl+Numpad(-)",  10, 155, 220)
GUICtrlCreateLabel ("Buff 1",  10, 180, 40)
   $buffslot1 = GUICtrlCreateInput ( "", 45,  175, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel ("Buff 2",  10, 205, 40)
   $buffslot1 = GUICtrlCreateInput ( "", 45,  200, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel ("Buff 3",  10, 230, 40)
   $buffslot1 = GUICtrlCreateInput ( "", 45,  225, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel ("Buff 4",  10, 255, 40)
   $buffslot1 = GUICtrlCreateInput ( "", 45,  250, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel ("Buff 5",  10, 280, 40)
   $buffslot1 = GUICtrlCreateInput ( "", 45,  275, 30, 20, $ES_NUMBER)

$ok = GUICtrlCreateButton("Ok", 150,  290, 60, 20)

While 1
   $event = GUIGetMsg()   
   Select
   Case $event = $ok
      $s1 = Int(GUICtrlRead($slot1))
      $d1 = Int(GUICtrlRead($delay1))
      $s2 = Int(GUICtrlRead($slot2))
      $d2 = Int(GUICtrlRead($delay2))
      $s3 = Int(GUICtrlRead($slot3))
      $d3 = Int(GUICtrlRead($delay3))    
      $s4 = Int(GUICtrlRead($slot4))
      $d4 = Int(GUICtrlRead($delay4))    
      $s5 = Int(GUICtrlRead($slot5))
      $d5 = Int(GUICtrlRead($delay5))

      $bs1 = Int(GUICtrlRead($buffslot1))
      $bs2 = Int(GUICtrlRead($buffslot2))
      $bs3 = Int(GUICtrlRead($buffslot3))
      $bs4 = Int(GUICtrlRead($buffslot4))
      $bs5 = Int(GUICtrlRead($buffslot5))
   Case $event = $GUI_EVENT_CLOSE
      ExitLoop
   EndSelect
WEnd

HotKeySet("^{SPACE}", "skills")
HotKeySet("^{NUMPADSUB}", "buffs")
HotKeySet("{ESC}","Terminate")

Func skills()
   Send("{F1}")
       Sleep($d1)
   Send($s1)
       Sleep($d2)
   Send($s2)
       Sleep($d3)
   Send($s3)
       Sleep($d4)
   Send($s4)
       Sleep($d5)
   Send($s2)
EndFunc

Func Buffs()
    Send("{F2}")
       Sleep(500)
   Send($bs1)
       Sleep(1000)
   Send($bs2)
       Sleep(1000)
   Send($bs3)
       Sleep(1000)
   Send($bs4)
       Sleep(1000)
   Send($bs5)
       Sleep(500)
   Send("{F1}")
EndFunc

Func Terminate()
    Exit
EndFunc

What i am doing wrong ? Why it doesnt work with the interface ?

Thx a lot for your help ! :P

Link to comment
Share on other sites

It didnt work :P

Thats the script after i insert the lines you told me:

Dim $slot1
Dim $slot2
Dim $slot3
Dim $slot4
Dim $slot5

Dim $delay1
Dim $delay2
Dim $delay3
Dim $delay4
Dim $delay5

Dim $buffslot1
Dim $buffslot2
Dim $buffslot3
Dim $buffslot4
Dim $buffslot5


#include <GUIConstants.au3>

GUICreate("Power Combo Attack", 220,320)
GUISetState (@SW_Show)
GUICtrlCreateLabel ("Attack (F1 Bar) - Ctrl+Space",  10, 5, 220)
GUICtrlCreateLabel ("Skill 1",  10, 30, 40)
   $slot1 = GUICtrlCreateInput ( "", 45,  25, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("Delay",  80, 30, 40)
   $delay1 = GUICtrlCreateInput ( "", 110,  25, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("ms (miliseconds)",  140, 30, 90)
GUICtrlCreateLabel ("Skill 2",  10, 55, 40)
   $slot2 = GUICtrlCreateInput ( "", 45,  50, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("Delay",  80, 55, 40)
   $delay2 = GUICtrlCreateInput ( "", 110,  50, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("ms (miliseconds)",  140, 55, 90)
GUICtrlCreateLabel ("Skill 3",  10, 80, 40)
   $slot3 = GUICtrlCreateInput ( "", 45,  75, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("Delay",  80, 80, 40)
   $delay3 = GUICtrlCreateInput ( "", 110,  75, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("ms (miliseconds)",  140, 80, 90)
GUICtrlCreateLabel ("Skill 4",  10, 105, 40)
   $slot4 = GUICtrlCreateInput ( "", 45,  100, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("Delay",  80, 105, 40)
   $delay4 = GUICtrlCreateInput ( "", 110,  100, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("ms (miliseconds)",  140, 105, 90)
GUICtrlCreateLabel ("Skill 5",  10, 130, 40)
   $slot5 = GUICtrlCreateInput ( "", 45,  125, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("Delay",  80, 130, 40)
   $delay5 = GUICtrlCreateInput ( "", 110,  125, 30, 20, $ES_NUMBER)
   GUICtrlCreateLabel ("ms (miliseconds)",  140, 130, 90)


GUICtrlCreateLabel ("Buffs (F2 Bar) - Ctrl+Numpad(-)",  10, 155, 220)
GUICtrlCreateLabel ("Buff 1",  10, 180, 40)
   $buffslot1 = GUICtrlCreateInput ( "", 45,  175, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel ("Buff 2",  10, 205, 40)
   $buffslot1 = GUICtrlCreateInput ( "", 45,  200, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel ("Buff 3",  10, 230, 40)
   $buffslot1 = GUICtrlCreateInput ( "", 45,  225, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel ("Buff 4",  10, 255, 40)
   $buffslot1 = GUICtrlCreateInput ( "", 45,  250, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel ("Buff 5",  10, 280, 40)
   $buffslot1 = GUICtrlCreateInput ( "", 45,  275, 30, 20, $ES_NUMBER)

$ok = GUICtrlCreateButton("Ok", 150,  290, 60, 20)

While 1
   $event = GUIGetMsg()   
   Select
   Case $event = $ok
      $s1 = Int(GUICtrlRead($slot1))
      $d1 = Int(GUICtrlRead($delay1))
      $s2 = Int(GUICtrlRead($slot2))
      $d2 = Int(GUICtrlRead($delay2))
      $s3 = Int(GUICtrlRead($slot3))
      $d3 = Int(GUICtrlRead($delay3))    
      $s4 = Int(GUICtrlRead($slot4))
      $d4 = Int(GUICtrlRead($delay4))    
      $s5 = Int(GUICtrlRead($slot5))
      $d5 = Int(GUICtrlRead($delay5))

      $bs1 = Int(GUICtrlRead($buffslot1))
      $bs2 = Int(GUICtrlRead($buffslot2))
      $bs3 = Int(GUICtrlRead($buffslot3))
      $bs4 = Int(GUICtrlRead($buffslot4))
      $bs5 = Int(GUICtrlRead($buffslot5))
   Case $event = $GUI_EVENT_CLOSE
      ExitLoop
   EndSelect
WEnd

HotKeySet("^{SPACE}", "skills")
HotKeySet("^{NUMPADSUB}", "buffs")
HotKeySet("{ESC}","Terminate")

While 1
Sleep(50)
WEnd

Func skills()
   Send("{F1}")
       Sleep($d1)
   Send($s1)
       Sleep($d2)
   Send($s2)
       Sleep($d3)
   Send($s3)
       Sleep($d4)
   Send($s4)
       Sleep($d5)
   Send($s2)
EndFunc

Func Buffs()
    Send("{F2}")
       Sleep(500)
   Send($bs1)
       Sleep(1000)
   Send($bs2)
       Sleep(1000)
   Send($bs3)
       Sleep(1000)
   Send($bs4)
       Sleep(1000)
   Send($bs5)
       Sleep(500)
   Send("{F1}")
EndFunc

Func Terminate()
    Exit
EndFunc

It runs the interface, i fill the data and press OK but nothing happens.

Anyone has any idea ?

Thx a lot ! :lmao:

Link to comment
Share on other sites

Dim $slot1
Dim $slot2
Dim $slot3
Dim $slot4
Dim $slot5

Dim $delay1
Dim $delay2
Dim $delay3
Dim $delay4
Dim $delay5

Dim $buffslot1
Dim $buffslot2
Dim $buffslot3
Dim $buffslot4
Dim $buffslot5


#include <GUIConstants.au3>

GUICreate("Power Combo Attack", 220, 320)
GUISetState(@SW_SHOW)
GUICtrlCreateLabel("Attack (F1 Bar) - Ctrl+Space", 10, 5, 220)
GUICtrlCreateLabel("Skill 1", 10, 30, 40)
$slot1 = GUICtrlCreateInput("", 45, 25, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel("Delay", 80, 30, 40)
$delay1 = GUICtrlCreateInput("", 110, 25, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel("ms (miliseconds)", 140, 30, 90)
GUICtrlCreateLabel("Skill 2", 10, 55, 40)
$slot2 = GUICtrlCreateInput("", 45, 50, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel("Delay", 80, 55, 40)
$delay2 = GUICtrlCreateInput("", 110, 50, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel("ms (miliseconds)", 140, 55, 90)
GUICtrlCreateLabel("Skill 3", 10, 80, 40)
$slot3 = GUICtrlCreateInput("", 45, 75, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel("Delay", 80, 80, 40)
$delay3 = GUICtrlCreateInput("", 110, 75, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel("ms (miliseconds)", 140, 80, 90)
GUICtrlCreateLabel("Skill 4", 10, 105, 40)
$slot4 = GUICtrlCreateInput("", 45, 100, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel("Delay", 80, 105, 40)
$delay4 = GUICtrlCreateInput("", 110, 100, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel("ms (miliseconds)", 140, 105, 90)
GUICtrlCreateLabel("Skill 5", 10, 130, 40)
$slot5 = GUICtrlCreateInput("", 45, 125, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel("Delay", 80, 130, 40)
$delay5 = GUICtrlCreateInput("", 110, 125, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel("ms (miliseconds)", 140, 130, 90)


GUICtrlCreateLabel("Buffs (F2 Bar) - Ctrl+Numpad(-)", 10, 155, 220)
GUICtrlCreateLabel("Buff 1", 10, 180, 40)
$buffslot1 = GUICtrlCreateInput("", 45, 175, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel("Buff 2", 10, 205, 40)
$buffslot1 = GUICtrlCreateInput("", 45, 200, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel("Buff 3", 10, 230, 40)
$buffslot1 = GUICtrlCreateInput("", 45, 225, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel("Buff 4", 10, 255, 40)
$buffslot1 = GUICtrlCreateInput("", 45, 250, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel("Buff 5", 10, 280, 40)
$buffslot1 = GUICtrlCreateInput("", 45, 275, 30, 20, $ES_NUMBER)

$ok = GUICtrlCreateButton("Ok", 150, 290, 60, 20)

While 1
   $event = GUIGetMsg()
   Select
      Case $event = $ok
         $s1 = Int(GUICtrlRead($slot1))
         $d1 = Int(GUICtrlRead($delay1))
         $s2 = Int(GUICtrlRead($slot2))
         $d2 = Int(GUICtrlRead($delay2))
         $s3 = Int(GUICtrlRead($slot3))
         $d3 = Int(GUICtrlRead($delay3))
         $s4 = Int(GUICtrlRead($slot4))
         $d4 = Int(GUICtrlRead($delay4))
         $s5 = Int(GUICtrlRead($slot5))
         $d5 = Int(GUICtrlRead($delay5))
         
         $bs1 = Int(GUICtrlRead($buffslot1))
         $bs2 = Int(GUICtrlRead($buffslot2))
         $bs3 = Int(GUICtrlRead($buffslot3))
         $bs4 = Int(GUICtrlRead($buffslot4))
         $bs5 = Int(GUICtrlRead($buffslot5))
         ExitLoop
      Case $event = $GUI_EVENT_CLOSE
         ExitLoop
   EndSelect
WEnd
GUIDelete()

HotKeySet("^{SPACE}", "skills")
HotKeySet("^{NUMPADSUB}", "Buffs")
HotKeySet("{ESC}", "Terminate")

While 1
   Sleep(50)
WEnd

Func skills()
   Send("{F1}")
   Sleep($d1)
   Send($s1)
   Sleep($d2)
   Send($s2)
   Sleep($d3)
   Send($s3)
   Sleep($d4)
   Send($s4)
   Sleep($d5)
   Send($s2)
EndFunc  ;==>skills

Func Buffs()
   Send("{F2}")
   Sleep(500)
   Send($bs1)
   Sleep(1000)
   Send($bs2)
   Sleep(1000)
   Send($bs3)
   Sleep(1000)
   Send($bs4)
   Sleep(1000)
   Send($bs5)
   Sleep(500)
   Send("{F1}")
EndFunc  ;==>Buffs

Func Terminate()
   Exit
EndFunc  ;==>Terminate

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Thx gafrost, you are awesome man !

I have another question if you could plz answer:

If i dont fill an input field, it uses 0 (zero) for those fields.

Is there a way to simply ignore the blank input fields instead of typing 0 (zeros) ?

Sorry about all the doubts im having, im new to autoit, and im really trying to learn it by myself before asking for help.

Link to comment
Share on other sites

Thx gafrost, you are awesome man !

I have another question if you could plz answer:

If i dont fill an input field, it uses 0 (zero) for those fields.

Is there a way to simply ignore the blank input fields instead of typing 0 (zeros) ?

Sorry about all the doubts im having, im new to autoit, and im really trying to learn it by myself before asking for help.

you'll have to add conditions to the reads for example:

If StringLen(GUICtrlRead($slot1)) Then $s1 = Int(GUICtrlRead($slot1))

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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