Jump to content

GUI which counts runtime of a script


Recommended Posts

Hey guys,

lately I was working on a script... Good thing: the script works well. Bad thing: I would like to create a nice GUI which consists of various elements (1. Start Button, 2. Stop Button, 3. Input [to define the time which the script should work], 4. Timer [which counts the total runtime of the script]). Problem: I know how to create the GUI but I don't know how to create the timers and stuff. I visited some forum sites but I just don't understand how the whole timer stuff works :(.

Maybe someone could help me...

Thanks in advance :)

 

Jannik Rendl

Link to comment
Share on other sites

  • Moderators

@jannikrendl how about posting your script, so we can see what kind of timers would fit well in your GUI?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

@JLogan3o13 Basicly it does some clicks on random spots to "prentend" staying online and active.

 

Local $mygui = GUICreate('AntiAFK.exe', 300, 70)
GUICtrlCreateLabel('Runtime in minutes:', 10, 13, 100, 20)
Local $mytime = GUICtrlCreateInput('', 110, 10, 40, 20, $ES_NUMBER)
Local $start = GUICtrlCreateButton('Start', 160, 10, 60, 20)
Local $stop = GUICtrlCreateButton('Stop', 230, 10, 60, 20)
GUICtrlSetLimit(-1, 2)
Local $status = GUICtrlCreateLabel('', 10, 40, 280, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUICtrlSetColor($status, 0xff0000)
GUICtrlSetFont($status, 10, 800)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $gui_event_close
            Exit
        Case $mytime
        Case $start
                $timer = TimerInit()
                chk_time()
                AdlibRegister('chk_time', 1000)
                GUICtrlSetState($mytime, $GUI_DISABLE)
                GUICtrlSetState($start, $GUI_DISABLE)
                AntiAFK()
        Case $stop
            Exit
    EndSwitch
WEnd

Func chk_time()
    Local $diff = Int(TimerDiff($timer))
    If $diff > GUICtrlRead($mytime) * 1000 * 60 Then Exit MsgBox(0, 'AntiAFK', 'You are going to AFK now!', 10)
    GUICtrlSetData($status, 'Ending in ' & GUICtrlRead($mytime) - Int($diff / 1000 / 60) & ' Minutes')
EndFunc

Func AntiAFK();to stay online
    sleep(random(15000,120000)
    MouseMove(random(x,x),random(x,x),random(10,30));replace x
    sleep(random(15000,120000)
    MouseClick("Left",random(y,y),random(y,y),1,random(10,30));replace y
    sleep(random(15000,120000)
    MouseCLick("Right",random(z,z),random(z,z),1,random(10,30));replace z
EndFunc

Thats basically what I achieved right now... (Thanks to @kylomas for helping me with the first part :))

Missing stuff: Timer aka "Runtime counter"...

 

Edited by jannikrendl
Link to comment
Share on other sites

  • Moderators

So, how is this any different than your last post, which was locked? Aside from removing the references to Runescape, that is. Did you actually read the forum rules to which you were pointed, this piece in particular?

Quote

7. Do not repost the same question if the previous thread has been locked - particularly if you merely reword the question to get around one of the prohibitions listed above.

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

@jannikrendl as I see you have been viewing this thread, and no answer is forthcoming, I'll assume there is no decent explanation. This is the second thread locked for game automation, don't let there be a third.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...