Jump to content
Sign in to follow this  
AlmarM

I'm new and need help

Recommended Posts

AlmarM

Hi,

My script isn't working...

I mean the Pause and Unpause wont work when the script is activated, and the exit func wont work too...

The problem is:

All things work but i think i didn't set all things in right order..

Can someone help ??

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.6.0
 Author:         AlmarM

 Script Function:
    Auto Loots

 Extra information:
    AutoIT v3 Script
#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
WinWait("2Moons","") ;Waits for 2Moons
If Not WinActive("2Moons","") Then WinActivate("2Moons","") ;If 2Moons is not active, it will make it active
WinWaitActive("2Moons","") ;Waits untill 2Moons is active

HotKeySet('{esc}', '_Exit') ;ESC to Exit (put any other key you want, but it need to be between the { and }
HotKeySet('{pause}', 'TogglePause') ;PAUSE to Pause and Unpause

While 1

ControlSend("2Moons","","","{space}") ;Sends the key space into 2Moons
Sleep(500) ;Time in Miliseconds (1000 = 1 Second)

Wend

Global $Paused = False

While 1
    If $Paused Then
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    Else
        ToolTip("")
    EndIf
WEnd

Func TogglePause()
    $Paused = Not $Paused
EndFunc   ;==>TogglePause

Func _Quit()
    Exit
EndFunc

Func _Exit()
;ToolTip(' '&@CRLF&' EXITING '&@CRLF&' ')
Sleep(500)
Exit
EndFunc
Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites
Wooltown

Do it like this instead, then it works.

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)

;WinWait("2Moons","");Waits for 2Moons
;If Not WinActive("2Moons","") Then WinActivate("2Moons","");If 2Moons is not active, it will make it active
;WinWaitActive("2Moons","");Waits untill 2Moons is active

HotKeySet('{ESC}', '_Exit');ESC to Exit (put any other key you want, but it need to be between the { and }
HotKeySet('{pause}', 'TogglePause');PAUSE to Pause and Unpause

Global $Paused = False

While 1

ControlSend("2Moons","","","{space}");Sends the key space into 2Moons
Sleep(500);Time in Miliseconds (1000 = 1 Second)

Wend


Func TogglePause()
    $Paused = Not $Paused
     If $Paused Then
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    Else
        ToolTip("")
    EndIf
EndFunc  ;==>TogglePause

Func _Quit()
    Exit
EndFunc

Func _Exit()
;ToolTip(' '&@CRLF&' EXITING '&@CRLF&' ')
Sleep(500)
Exit
EndFunc

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.