Jump to content

another simple script to help me understand


savage29
 Share

Recommended Posts

hey people,

so im still not understanding some things, im trying to teach myself but its kinda hard when you start with nothing.

at the moment, i am trying to create a very very simple script, and i have looked through the help files for the last 2 hours.

ive found the easiest way for me to understand something is to reverse-engineer it somewhat. im not trying to get anyone to write

script for me because im lazy, i seriously want to learn :x

anyway, i would appreciate it greatly if someone would show me a script or 2 that does only 2 things,

presses the TAB key then immediately after that, the number 1 key, and repeats this action once every 10 secs for a timespan i can

set either in the script or letting it repeat until i hit escape.

please please please help me, im having quite a lot of trouble figuring this out.

thanks in advance :P

Link to comment
Share on other sites

Tab 1 is related for selecting and attacking, show what did you try, this still isnt new eyer, we still dont give scripts as presents, show something that did not work and someone maby will help you if its not "bot/game" related!!!

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

; a script or 2 that does only 2 things :
; presses the TAB key : see Send ( "keys" [, flag] ) 
send ( "{TAB}" )

; then immediately after that, the number 1 key,    
send ( "{NUMPAD1}" )

; and repeats this action once every 10 secs 

While 1
    ; action
    Sleep ( 10000 )
WEnd    

; repeat until i hit escape.  : 

HotKeySet ( "{ESC}", "_Terminate" )

Func _Terminate ( )
    Exit 
EndFunc

I give you all the functions needed for your script , now build it ! Posted Image

See help file for more details !

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Tab 1 is related for selecting and attacking, show what did you try, this still isnt new eyer, we still dont give scripts as presents, show something that did not work and someone maby will help you if its not "bot/game" related!!!

ok sure. it is game related, but not bot related in the sense that most would think, im not working on a hack or anything like that, i made a previous post asking how to click a mouse in the same spot for a period of time, and the reason im asking for an automated script to help me is quite simple, i lost 3 fingers in a work accident and its a downright pain in the butt having only a thumb and pointer finger, it wasnt the greatest day at work i tell ya... anyway, ill put it quite simply, and perhaps some of you will know what i am talking about, i have this dice i need to click on repeatedly until 6 comes up 6 times in a row, and i dont really feel like sitting here for the next 9 months clicking it, ive looked up the odds of it actually happening so believe me, this isnt cheating in the slighest lol, i did get that to work, and for the last week no luck on the dice so far. and now i would appreciate a bit of help making grinding easier. there is already a fully working bot for the game i play, healing etc included and i dont want that, theres no point in playing if you dont actually PLAY. so help me or dont, i cant force you, heres what i have ---

Do

Send("{TAB}")

Send("{ONE}")

sleep(10000)

Until

*******

there is where i lose it. i dont know what to put next. how do i set an inital sleep time and get the program to stop after say 1 minute?

thats all i need it to do so i can follow the team from one mob to another. i think i can work out how to set a hotkey to pause the program,

ill have to look into it a little more.

thanks for the reply

Link to comment
Share on other sites

; a script or 2 that does only 2 things :
; presses the TAB key : see Send ( "keys" [, flag] ) 
send ( "{TAB}" )

; then immediately after that, the number 1 key,    
send ( "{NUMPAD1}" )

; and repeats this action once every 10 secs 

While 1
    ; action
    Sleep ( 10000 )
WEnd    

; repeat until i hit escape.  : 

HotKeySet ( "{ESC}", "_Terminate" )

Func _Terminate ( )
    Exit 
EndFunc

I give you all the functions needed for your script , now build it ! Posted Image

See help file for more details !

ok, what exactly does While 1 do? i understand the idea behind the script now but i still dont understand where to pull these random lines of code from :S

Link to comment
Share on other sites

ok, what exactly does While 1 do? i understand the idea behind the script now but i still dont understand where to pull these random lines of code from :S

It's a condition to close the loop ( while 1 or while 2... )

See help file for while function ! Posted Image

Put hotkeyset first

Put the Send actions in the while loop

and function at the end

Try and show ...

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

ok, what exactly does While 1 do? i understand the idea behind the script now but i still dont understand where to pull these random lines of code from :S

ok now i found the controlsend command, and this is what i have

controlsend("window name") **the window name itself has brackets in it so how do i put them in?**

send ( "{TAB}" )

send ( "{NUMPAD1}" )

While 1

Sleep ( 10000 )

WEnd

HotKeySet ( "{ESC}", "_Terminate" )

Func _Terminate ( )

Exit

EndFunc

how is that looking or am i missing something? and i just noticed you replied again :x ok heres what i have now

HotKeySet ( "{ESC}", "_Terminate" )

controlsend("(game)")

While 1

send ( "{TAB}" )

send ( "{NUMPAD1}" )

Sleep ( 10000 )

WEnd

Func _Terminate ( )

Exit

EndFunc

Edited by savage29
Link to comment
Share on other sites

While starts a loop. When it meets the WEnd it goes back to While When the condition after While is TRUE. The number '1' will always evaluate to TRUE so the looop will always be repeated. 'While 1' is the way it's always been done here, but you could use the True keyword or anopther expression like "1=1".

It makes sense when you understand what it aims to achieve and how computers think about that sort of stuff. I know it can look confusing when poeple start pulling lines out of a hat which don't make sense to humans :P Just learn those from examples and remember them. You'll use them so often your fingers will type it for you after a while :x

Edit: The other thing you'll learn is that there is two ways to stop people helping you on the forum. The second is not using code tags :shifty:

[autoit] CODE HERE [/autoit]

The result is much nicer looking output. It will keep whitespace, provide syntax highlighting, limit the height of the code, and generally makes the code look readable on the forums.

Edited by Mat
Link to comment
Share on other sites

While starts a loop. When it meets the WEnd it goes back to While When the condition after While is TRUE. The number '1' will always evaluate to TRUE so the looop will always be repeated. 'While 1' is the way it's always been done here, but you could use the True keyword or anopther expression like "1=1".

It makes sense when you understand what it aims to achieve and how computers think about that sort of stuff. I know it can look confusing when poeple start pulling lines out of a hat which don't make sense to humans :P Just learn those from examples and remember them. You'll use them so often your fingers will type it for you after a while :x

well i used to use delphi a long time ago, and i never really learnt much while i was in college, so i do kinda understand how everything works,

its just GETTING it to work and remembering again how to set variables etc... i really do appreciate the help guys (or gals) :shifty:

Link to comment
Share on other sites

While starts a loop. When it meets the WEnd it goes back to While When the condition after While is TRUE. The number '1' will always evaluate to TRUE so the looop will always be repeated. 'While 1' is the way it's always been done here, but you could use the True keyword or anopther expression like "1=1".

It makes sense when you understand what it aims to achieve and how computers think about that sort of stuff. I know it can look confusing when poeple start pulling lines out of a hat which don't make sense to humans :P Just learn those from examples and remember them. You'll use them so often your fingers will type it for you after a while :x

Edit: The other thing you'll learn is that there is two ways to stop people helping you on the forum. The second is not using code tags :nuke:

[autoit] CODE HERE [/autoit]

The result is much nicer looking output. It will keep whitespace, provide syntax highlighting, limit the height of the code, and generally makes the code look readable on the forums.

heh thanks for the heads up :shifty:
Link to comment
Share on other sites

Please use AutoIt Tag for post code

HotKeySet ( "{ESC}", "_Terminate" ) 
controlsend("(game)")

While 1 
    send ( "{TAB}" ) 
    send ( "{NUMPAD1}" ) 
    Sleep ( 10000 ) 
WEnd 

Func _Terminate ( ) 
    Exit 
EndFunc

So, It works ?

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Please use AutoIt Tag for post code

[color=#1C2837][size=2]HotKeySet ( "{ESC}", "_Terminate" ) 
controlsend("(game)")

While 1 
    send ( "{TAB}" ) 
    send ( "{NUMPAD1}" ) 
    Sleep ( 10000 ) 
WEnd 

Func _Terminate ( ) 
    Exit 
EndFunc [/size][/color]

So, It works ?

no, from the looks of it, its doing nothing at all. there must be something missing between controlsend and send?

its not pressing TAB or 1 :x

Link to comment
Share on other sites

no, from the looks of it, its doing nothing at all. there must be something missing between controlsend and send?

its not pressing TAB or 1 :x

It's pressing but not at the good place, what's the name of the window

where you want send Tab and 1 ?

use AutoItwindoinfo utility for get it...

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

It's pressing but not at the good place, what's the name of the window

where you want send Tab and 1 ?

use AutoItwindoinfo utility for get it...

i cant give away which game im playing, ill lose respect if anyone else here plays it lol

but ill type how it shows -

gamename- (server: 7)

*edit* ok from what i have now, it opens the game window, then does nothing --

HotKeySet ( "{ESC}", "_Terminate" ) 
WinActivate ( "game")
ControlSend ( "game")
While 1     
send ( "{TAB}" ) 
send ( "{NUMPAD1}" ) 
Sleep ( 10000 ) 
WEnd    

Func _Terminate ( )     
    Exit 
EndFunc
Edited by savage29
Link to comment
Share on other sites

Try to add WinActivate line and a winwaitactivate in the loop before the Send actions...

HotKeySet ( "{ESC}", "_Terminate" ) 
While 1     

WinActivate ("game")
WinWaitActive("game", "", 5)
ControlSend ("game")
send ( "{TAB}" ) 
send ( "{NUMPAD1}" ) 
Sleep ( 10000 ) 
WEnd    

Func _Terminate ( )     
    Exit 
EndFunc

doesnt work. compiling and running the program gives an error for line one, incorrect number of parameters in function call. so now what? lol

Edited by savage29
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...