Jump to content

Wont continue loop..Help please


Delta01
 Share

Recommended Posts

Hi,

I'm trying to make a script for a game. I'm trying to add a second loop inside the main loop, it doesn't work however. My code is below, does anybody know what's wrong?

#include <GuiConstants.au3>

Global $Paused, $Bar1 = "{F1}", $Bar2 = "{F2}", $Bar3 = "{F3}", $Bar4 = "{F4}"

HotKeySet("{F5}", "TogglePause")
HotKeySet("{F6}", "Terminate")

$main = GUICreate("AFK_Weaponchanger", 250, 400)
$Label1 = GuiCtrlCreateLabel("Your alternative weapon is..", 5, 10)
$Wep2 = GuiCtrlCreateInput("9", 5, 30, 15, -1, $ES_NUMBER)
$Label2 = GUICtrlCreateLabel("Your main weapon is..", 5, 60)
$Wep1 = GuiCtrlCreateInput("0", 5, 80, 15, -1, $ES_NUMBER)
$Label3 = GuiCtrlCreateLabel("Your speed buff is..", 5, 110)
$Speed = GuiCtrlCreateInput("1", 5, 130, 15, -1, $ES_NUMBER)
$Label4 = GuiCtrlCreatelabel("Your other buff is..", 5, 160)
$Other = GuiCtrlCreateInput("2", 5, 180, 15, -1, $ES_NUMBER)
$Label5 = GuiCtrlCreateLabel("Your quickbar is..", 5, 210)
$Bar = GuiCtrlCreateInput("F1", 5, 230, 20, -1, $ES_UPPERCASE)
$Label6 = GuiCtrlCreateLabel("Time to wait before buffing, in minutes..", 5, 260)
$Wait = GuiCtrlCreateInput("10", 5, 280, 20, -1, $ES_NUMBER)
$Help = GuiCtrlCreateMenu("&Help")
$About = GuiCtrlCreateMenuItem("Help",$Help)
$start = GuiCtrlCreateButton("Start", 5, 325, 80, 30)
$stop = GuiCtrlCreateButton("Stop", 100, 325, 80, 30)
GuiSetState()


While 1
    $msg = GuiGetMsg()
        $Read1 = GuiCtrlRead($Wep2)
    $Read2 = GuiCtrlRead($Wep1)
    $Read3 = GuiCtrlRead($Speed)
    $Read4 = GuiCtrlRead($Other)
    $Read5 = GuiCtrlRead($Bar)
    $wait = GuiCtrlRead($Wait)
    $time = $wait
Select
Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case $msg = $About
        MsgBox(0, "Help", "When it says, 'Your alternative weapon is.,' that means put the number of the quickslot which that weapon is on below. Eg. My sword is on number 2, so i would put number 2." & @CRLF & "Time to wait before buffing, in minutes.. means how long should the script wait, before buffing again." & @CRLF & "Press F6 to close the script." & @CRLF & @CRLF & "Made by BoT90210, 0x33.org")

If ProcessExists("sro_client.exe") then
If $msg = $start Then
    $loop = 1
    EndIf
If $msg = $stop Then
    $loop = $loop + 1
    EndIf
While $loop = 1
WinWaitActive("SRO_Client")
send("{END}")
sleep(1100)
If $Read5 = "F1" Then
    send($Bar1)
ElseIf $Read5 = "F2" Then
    send($Bar2)
ElseIf $Read5 = "F3" Then
    send($Bar3)
ElseIf $Read5 = "F4" Then
    send($Bar4)
EndIf
sleep(500)
Send($Read1)
sleep(1500)
Send($Read3)
sleep(5000)
Send($Read4)
sleep(5000)
Send($Read2)
send("{INSERT}")
sleep(1100)
WEnd
Else
    MsgBox(48, "Silkroad not found", "Please open silkroad, then try again")
    EndIf
EndSelect
Wend

Func TogglePause()
$Paused = Not $Paused
While $Paused
Sleep(50)
ToolTip("AFK_Weaponchanger is paused - Press F5 to resume",0,0)
WEnd
ToolTip("")
EndFunc
    
    Func Terminate()
        Exit
        EndFunc

Thanks

Link to comment
Share on other sites

Someone made a program to monitor variables in your script but it think a message box would be easier.

Msgbox (0, "", $loop)

Put that in right before your while loop and then put it right before the end of your while loop.

That didn't work, this is what my While..WEnd looks like, but it still wont work >.<

While 1
    $msg = GuiGetMsg()
        $Read1 = GuiCtrlRead($Wep2)
    $Read2 = GuiCtrlRead($Wep1)
    $Read3 = GuiCtrlRead($Speed)
    $Read4 = GuiCtrlRead($Other)
    $Read5 = GuiCtrlRead($Bar)
    $wait = GuiCtrlRead($Wait)
    $time = $wait
Select
Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case $msg = $About
        MsgBox(0, "Help", "When it says, 'Your alternative weapon is.,' that means put the number of the quickslot which that weapon is on below. Eg. My sword is on number 2, so i would put number 2." & @CRLF & "Time to wait before buffing, in minutes.. means how long should the script wait, before buffing again." & @CRLF & "Press F6 to close the script." & @CRLF & @CRLF & "Made by BoT90210, 0x33.org")

If ProcessExists("sro_client.exe") then
If $msg = $start Then
    $loop = 1
    
    EndIf
If $msg = $stop Then
    $loop = $loop + 1
EndIf
Msgbox (0, "", $loop)
While $loop = 1
WinWaitActive("SRO_Client")
send("{END}")
sleep(1100)
If $Read5 = "F1" Then
    send($Bar1)
ElseIf $Read5 = "F2" Then
    send($Bar2)
ElseIf $Read5 = "F3" Then
    send($Bar3)
ElseIf $Read5 = "F4" Then
    send($Bar4)
EndIf
sleep(500)
Send($Read1)
sleep(1500)
Send($Read3)
sleep(5000)
Send($Read4)
sleep(5000)
Send($Read2)
send("{INSERT}")
sleep(1100)
Msgbox (0, "", $loop)
WEnd
Else
    MsgBox(48, "Silkroad not found", "Please open silkroad, then try again")
    EndIf
EndSelect
Wend
Link to comment
Share on other sites

what number did the msgbox say?

Edit: it wont fix it it will just help figure out wat the problem is.

Edit: put a case else before If process exists.

After your

Case $msg = $About
            MsgBox(0, "Help", "When it says, 'Your alternative weapon is.,' that means put the number of the quickslot which that weapon is on below. Eg. My sword is on number 2, so i would put number 2." & @CRLF & "Time to wait before buffing, in minutes.. means how long should the script wait, before buffing again." & @CRLF & "Press F6 to close the script." & @CRLF & @CRLF & "Made by BoT90210, 0x33.org")
you are missing an "EndSelect".

The way you wrote it, the $msg needs to be $About for the second loop to be entered ...

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