Sign in to follow this  
Followers 0
moczymorda

Help with loop

6 posts in this topic

Ok i have problem with my script. When im use only check script its work good

While 1
    $y = ControlListView("Sro Server List", "List1", 1001, "FindItem", "*SERVER NAME HERE*")
    $x = ControlListView("Sro Server List", "List1", 1001, "GetText", $y, "2")
    Sleep(500)
    If $x < 2999 Then
        SoundPlay(@WindowsDir & "\media\tada.wav",0)
        WinActivate("SRO_Client")
        MouseClick("left",602 , 506, 2, 1)
        Exit
    EndIf
WEnd

But i want use this script in GUI and look like this:

#include <GUIConstants.au3>

GUICreate("Free slot search", 240, 90) ; will create a dialog box that when displayed is centered

$servery=GUICtrlCreateCombo ("Chose server:", 10,10, 110, 20, $CBS_DROPDOWNLIST); create first item
GUICtrlSetData($servery, "Aege|Persia|Xian|Alexander|Poseidon", "")
GUICtrlSetStyle($servery, $CBS_DROPDOWNLIST)

$group_1 = GUICtrlCreateGroup ("Slots", 125, 4, 110, 50)
$radio_1 = GUICtrlCreateRadio ("&3", 133, 20, 25, 20)
$radio_2 = GUICtrlCreateRadio ("&2", 168, 20, 25, 20)
$radio_3 = GUICtrlCreateRadio ("&1", 203, 20, 25, 20)

; Init our vars that we will use to keep track of GUI events
$radioval1 = 0  ; We will assume 0 = first radio button selected, 2 = last button
$radioval2 = 0
$1slot = 3000
$2slot = 2999
$3slot = 2998


$button_1 = GUICtrlCreateButton ("go!", 10, 40, 80, 20)

GUISetState ()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Select
        
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
    
Case $msg = $radio_1
$sloty = $3slot

Case $msg = $radio_2
$sloty = $2slot

Case $msg = $radio_3
$sloty = $1slot
    
Case $msg = $button_1
WinActivate("Sro Server List")
$sName=GUICtrlRead($servery)
    $y = ControlListView("Sro Server List", "List1", 1001, "FindItem", $sName)
    $x = ControlListView("Sro Server List", "List1", 1001, "GetText", $y, "2")
    Sleep(500)
    If $x = $2slot Then
MsgBox(0, "Default button clicked", "Wait for: " & $sloty & $sName)
        Exit
    EndIf


Case $msg >= $radio_1 AND $msg <= $radio_3
$radioval1 = $msg - $radio_1

EndSelect
Wend

And this is work for $2slot but this is not problem. Problem is when in Sro Server List is free slot this not work. Only work when i click on go! button. All i want is this program work like a loop when i push go! button he check program all time and when is free slot show msg box. In first script its work he wait for free slot... but in this GUI script this work only when is free slot and i push go! button. Im know that i mess up but my english sux.

Share this post


Link to post
Share on other sites



can i know what this script can do? i play in silkroad.

Share this post


Link to post
Share on other sites

There is program named Sro Server List this check how many free slots are on server, and first my script work with this program and when is free slot on server u chose its click Confirm at code window. U must run silkroad, write login and pass.. then write image code. And run this script when on ur server is free slot he click on confirm button in game. Just type ur server name here: *SERVER NAME HERE*.

Share this post


Link to post
Share on other sites

sro server list is a turk program, u are sure isnt a keyloger program ? lol, u must to learn what is a function first to make a script.

try:

#include <GUIConstants.au3>

GUICreate("Free slot search", 240, 90); will create a dialog box that when displayed is centered

$servery=GUICtrlCreateCombo ("Chose server:", 10,10, 110, 20, $CBS_DROPDOWNLIST); create first item
GUICtrlSetData($servery, "Aege|Persia|Xian|Alexander|Poseidon", "")
GUICtrlSetStyle($servery, $CBS_DROPDOWNLIST)

$group_1 = GUICtrlCreateGroup ("Slots", 125, 4, 110, 50)
$radio_1 = GUICtrlCreateRadio ("&3", 133, 20, 25, 20)
$radio_2 = GUICtrlCreateRadio ("&2", 168, 20, 25, 20)
$radio_3 = GUICtrlCreateRadio ("&1", 203, 20, 25, 20)

; Init our vars that we will use to keep track of GUI events
$radioval1 = 0 ; We will assume 0 = first radio button selected, 2 = last button
$radioval2 = 0
$1slot = 3000
$2slot = 2999
$3slot = 2998


$button_1 = GUICtrlCreateButton ("go!", 10, 40, 80, 20)

GUISetState ()

; Run the GUI until the dialog is closed
While 1
sleep(50)
$msg = GUIGetMsg()
Select
        
Case $msg = $GUI_EVENT_CLOSE
    ExitLoop
    
Case $msg = $radio_1
    $sloty = $3slot

Case $msg = $radio_2
    $sloty = $2slot

Case $msg = $radio_3
    $sloty = $1slot
    
Case $msg = $button_1
    Look4slot()

Case $msg >= $radio_1 AND $msg <= $radio_3
    $radioval1 = $msg - $radio_1

EndSelect
Wend


Func Look4slot()
While 1
    $sName=GUICtrlRead($servery)
    $y = ControlListView("Sro Server List", "List1", 1001, "FindItem", $sName)
    $x = ControlListView("Sro Server List", "List1", 1001, "GetText", $y, "2")
    MsgBox(0, "Default button clicked", "Wait for: " & $sloty & $sName)
    
    Sleep(500)
    If $x < $2slot Then
        SoundPlay(@WindowsDir & "\media\tada.wav",0)
        if ProcessExists ("SRO_Client.exe") Then
            WinActivate("SRO_Client")
            MouseClick("left",602 , 506, 2, 1)
            Exit
        EndIf
    Exit
    EndIf
WEnd
EndFunc

Share this post


Link to post
Share on other sites

I have without virus <_< There is 2 of them but they are not danger.

But.. thx for ur help its work :)

Share this post


Link to post
Share on other sites

np

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