Jump to content

Recommended Posts

Posted

I just found AutoIt by accidence and I think AutoIt is a good place to learn new things. Recently I created a script for my favourite game and I have some problem. I tried to use it when the window is inactive using ControlSend function but seems all messed up. Can anyone help me to convert my script to make it useable for inactive window, Here is the code:

CODE
$Topup = 0

Hotkeyset ( "e", "exit1")

winmove ( "Game", "", 1, 1 )

while 1 = 1

If PixelGetColor ( 168, 528 ) = 2101304 then topup()

If PixelGetColor ( 168, 528 ) > 2101304 then strafe()

wend

Func Topup()

If PixelGetColor ( 657, 565 ) < 16317688 then

Send ( "{z down}", 0 )

Send ( "{LCTRL down}", 0 )

Send ( "{z up}", 0 )

Send ( "{LCTRL up}", 0 )

MouseMove ( 597, 423, 10000000 )

MouseClick ( "left", 597, 423 )

Sleep ( 1 )

MouseMove ( 691, 279, 10000000 )

MouseClick ( "left", 691, 279 )

Sleep ( 1 )

MouseMove ( 597, 423, 10000000 )

Else

MouseMove ( 597, 423, 10000000 )

EndIf

endfunc

func Strafe()

; do nothing

endfunc

func exit1()

Exit (0)

endfunc

Perhaps someone can help me convert this and fix any mistakes.Your hel is greatly appreciated. Tq

Posted

Hi,

just have a look at the helpfile for ControlSend and ControlSetText and use Autoit Window Info to get the title and text and ControlID.

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Posted

I have used the AutoIt Window Info but return nothing on my game..

The controlID is a problem because I could not figure out what it is.

ok. Thanx for the reply, i wanna try it

Posted

One more thing I wanna ask is:

Is that any function we can use to detect a window title when we open the same program in several window

Posted

I have use this code but seems a problem. I could use ControlSend function but I could not figure out what is wrong with my ControlClick function

If PixelGetColor ( 657, 565 ) < 16317688 then 
    ControlSend ( "Game", "", "", "{z down}", 0 )
    ControlSend ( "Game", "", "", "{LCTRL down}", 0 )
    ControlSend ( "Game", "", "", "{z up}", 0 )
    ControlSend ( "Game", "", "", "{LCTRL up}", 0 )
    
    ControlClick ( "Game", "", "", "left", 1, 597, 423 )
    Sleep ( 1 )

    ControlClick ( "Game", "", "", "left", 1, 691, 279 )
    Sleep ( 1 )

Anyone know how I can press CTRL+Z rather than what I am using now? I know about ^z but it just don't work. Really appreciated your response. Thanks

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
×
×
  • Create New...