AutoHotkey Community

It is currently May 27th, 2012, 7:47 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: October 5th, 2006, 4:44 pm 
Offline

Joined: October 5th, 2006, 4:35 pm
Posts: 6
hey people..
i just found this program.. a friend told me to try it out..

and well.. i was wondering... till now i was using a program called ACtool..
and i made a macro in it for a game i play.. gunz
i was wondering if it you can write somehting like the macro i was using
just in AutoHotkey..

here is the macro

Code:
SetActiveWindow Gunz
while 1=1
  while 1=1
   
    if {globalkeys} contains 087 //press w
      clearglobalkeys
      Keydown {space} 10
      Delay 90
      Keys w
      Delay 5
      Keys w
      Delay 7
      Leftmousedown
      Delay 5
      Leftmouseup
      Delay 25
      Keys Shift
      Delay 15
      clearglobalkeys
      Delay 5
    end if
   
    if {globalkeys} contains 083 // press s
      clearglobalkeys
      Keydown {space} 10
      Delay 90
      Keys s
      Delay 5
      Keys s
      Delay 7
      Leftmousedown
      Delay 5
      Leftmouseup
      Delay 25
      Keys Shift
      Delay 15
      clearglobalkeys
      Delay 5
    end if
   
    if {globalkeys} contains 068 // press d
      clearglobalkeys
      Keydown {space} 10
      Delay 90
      Keys d
      Delay 5
      Keys d
      Delay 7
      Leftmousedown
      Delay 5
      Leftmouseup
      Delay 25
      Keys Shift
      Delay 15
      clearglobalkeys
      Delay 5
    end if
   
    if {globalkeys} contains 065 //press a
      clearglobalkeys
      Keydown {space} 10
      Delay 90
      Keys a
      Delay 5
      Keys a
      Delay 7
      Leftmousedown
      Delay 5
      Leftmouseup
      Delay 25
      Keys Shift
      Delay 15
      clearglobalkeys
      Delay 5
    end if
   
    if {globalkeys} contains 049 //press 1 to stop
      clearglobalkeys
      Break
    end if
  END
 
  while 1=1
   
    if {globalkeys} contains 088 //press x
      clearglobalkeys
      Keydown {space} 10
      Leftmousedown
      Delay 5
      Leftmouseup
      Delay 255
      Keys w
      Delay 10
      Keys w
      Delay 5
      clearglobalkeys
      Delay 5
    end if
   
    if {globalkeys} contains 050 // press 2 to restart
      clearglobalkeys
      Restart
    end if
  end
end


its easy to understand.. but if u dont get something just ask me.
thanks ahead. :)


Report this post
Top
 Profile  
Reply with quote  
PostPosted: October 5th, 2006, 5:09 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
moses wrote:
i was wondering if it you can write somehting like the macro i was using


Sure! Maybe even better.. Only that you have to concentrate and adapt
to AutoHotkey syntax style:

Code:
;SetActiveWindow Gunz
WinActivate Gunz

;if {globalkeys} contains 087 //press w
w::

;if {globalkeys} contains 083 // press s
s::

;if {globalkeys} contains 068 // press d
d::

;if {globalkeys} contains 065 //press a
a::

;if {globalkeys} contains 049 //press 1 to stop
1::

;if {globalkeys} contains 088 //press x
x::

;if {globalkeys} contains 050 // press 2 to restart
2::

;Keydown {space} 10
Send, {Space 10}

;Delay 90
Sleep 90

;Keys w
Send {W}

;Leftmousedown
Send {LButton Down}

;Leftmouseup
Send {LButton Up}

;Keys Shift
Send {Shift}

;Restart
Reload


In my guess, the lines in blue are the equivalent commands for ACTool ( those commented in green)

Regards, :)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2006, 5:09 pm 
Offline

Joined: April 14th, 2005, 11:11 am
Posts: 186
Location: Wisconsin, USA
I really doubt anyone is going to rewrite your code for you in AHK. You sould open up the AHK help file and use the search to find what your looking for.

To get you started heres a couple of the commands you would need


Keys in ACTool would be Send in AHK
Delay in ACTool would be Sleep in AHK

It's well worth your time to read at least the "Tutorial (quickstart)" section of the helpfile.

_________________
Image
"Make it idiot-proof, and someone will make a better idiot."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2006, 6:52 pm 
Offline

Joined: October 5th, 2006, 4:35 pm
Posts: 6
thanks alot.. thats all i wanted to know..
the commands..
but one question...
if i use the hotkey "w"
and the command floowing it uses the "w" letter as well..
will it interfer with the sequence of the macro?
and if it does.. anyway to make it in a way thats it will not?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2006, 7:03 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
moses wrote:
...
if i use the hotkey "w"
and the command floowing it uses the "w" letter as well..
will it interfer with the sequence of the macro?


Yes! It will interfere!
Suggestion:

use $w:: instead..

Regards, :)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2006, 7:36 pm 
Offline

Joined: October 5th, 2006, 4:35 pm
Posts: 6
thanks alot.. i rewrited the macro.. but one thing..
it doesnt work!! :?

it wont stay in the loop.. when i press 1 it should break and go to the next loop till i press 2 and it will restart..

but its acting like there isnt any loop!!

the code..

Code:
WinActivate Gunz
  Loop{
   
    $w::
      Send, {Space 10}
      Sleep 90
      Send {W}
      Sleep 5
      Send {W}
      Sleep 7
      Send {LButton Down}
      Sleep 5
      Send {LButton Up}
      Sleep 25
      Send {Shift}
      Sleep 15
    return
   
    $s::
      Send, {Space 10}
      Sleep 90
      Send {S}
      Sleep 5
      Send {S}
      Sleep 7
      Send {LButton Down}
      Sleep 5
      Send {LButton Up}
      Sleep 25
      Send {Shift}
      Sleep 15
    return
   
    $d::
      Send, {Space 10}
      Sleep 90
      Send {D}
      Sleep 5
      Send {D}
      Sleep 7
      Send {LButton Down}
      Sleep 5
      Send {LButton Up}
      Sleep 25
      Send {Shift}
      Sleep 15
    return
   
    $a::
      Send, {Space 10}
      Sleep 90
      Send {A}
      Sleep 5
      Send {A}
      Sleep 7
      Send {LButton Down}
      Sleep 5
      Send {LButton Up}
      Sleep 25
      Send {Shift}
      Sleep 15
    return
   
    1::
      break
    return

  }
 
  Loop{
   
    x::
      Send, {Space 10}
      Send {LButton Down}
      Sleep 5
      Send {LButton Up}
      Sleep 255
      Send {W}
      Sleep 10
      Send {W}
      Sleep 5
    return
   
    2::
      Reload
    return

  }

:?: :?: :?:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2006, 8:17 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
moses wrote:
thanks alot.. i rewrited the macro.. but one thing..
it doesnt work!! :?


The script does not require a Loop, I guess:

Code:
WinActivate Gunz
   
    $w::
      Send, {Space 10}
      Sleep 90
      Send {W}
      Sleep 5
      Send {W}
      Sleep 7
      Send {LButton Down}
      Sleep 5
      Send {LButton Up}
      Sleep 25
      Send {Shift}
      Sleep 15
    return
   
    $s::
      Send, {Space 10}
      Sleep 90
      Send {S}
      Sleep 5
      Send {S}
      Sleep 7
      Send {LButton Down}
      Sleep 5
      Send {LButton Up}
      Sleep 25
      Send {Shift}
      Sleep 15
    return
   
    $d::
      Send, {Space 10}
      Sleep 90
      Send {D}
      Sleep 5
      Send {D}
      Sleep 7
      Send {LButton Down}
      Sleep 5
      Send {LButton Up}
      Sleep 25
      Send {Shift}
      Sleep 15
    return
   
    $a::
      Send, {Space 10}
      Sleep 90
      Send {A}
      Sleep 5
      Send {A}
      Sleep 7
      Send {LButton Down}
      Sleep 5
      Send {LButton Up}
      Sleep 25
      Send {Shift}
      Sleep 15
    return
     
    $x::
      Send, {Space 10}
      Send {LButton Down}
      Sleep 5
      Send {LButton Up}
      Sleep 255
      Send {W}
      Sleep 10
      Send {W}
      Sleep 5
    return
   
    $2::
      Reload
    return


Regards, :)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2006, 8:24 pm 
Offline

Joined: October 5th, 2006, 4:35 pm
Posts: 6
but the loop is like for pausing it in a press of a butten..
any other way to do that?

EDIT: never mind dude.. i found it! tanks alot! just use suspend!!


Last edited by moses on October 5th, 2006, 8:29 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2006, 8:27 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
moses wrote:
but the loop is like for pausing it in a press of a butten..


Why do you want to pause? :shock:
When run - the script does nothing but to wait for a Hotkey to be pressed!
You press W then the following action is done:

Code:
      Send, {Space 10}
      Sleep 90
      Send {W}
      Sleep 5
      Send {W}
      Sleep 7
      Send {LButton Down}
      Sleep 5
      Send {LButton Up}
      Sleep 25
      Send {Shift}
      Sleep 15


It is the same way for the other keys!

Regards, :)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2006, 8:29 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
A friendly suggestion:

You want to learn AutoHotkey, then better unlearn ACtool

Regards, :)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2006, 8:30 pm 
Offline

Joined: October 5th, 2006, 4:35 pm
Posts: 6
dude thanks for all ur help but i found what i was looking for..
suspend.. to stop the hotkeys...

i got one last question... anyway for me to make the script into a dll file?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2006, 8:33 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
moses wrote:
i got one last question... anyway for me to make the script into a dll file?


Not in AutoHotKey...
Maybe you can try your luck with Visual basic!

Regards, :)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2006, 8:35 pm 
Offline

Joined: April 14th, 2005, 11:11 am
Posts: 186
Location: Wisconsin, USA
try my code.

I added #installkeybhook due to it being a game. and removed some {} you had in the send commands.

Code:
#InstallKeybdHook
WinActivate Gunz

$w::
Send, {Space 10}
Sleep 90
Send w
Sleep 5
Send w
Sleep 7
Send {LButton Down}
Sleep 5
Send {LButton Up}
Sleep 25
Send {Shift}
Sleep 15
return

$s::
Send, {Space 10}
Sleep 90
Send s
Sleep 5
Send s
Sleep 7
Send {LButton Down}
Sleep 5
Send {LButton Up}
Sleep 25
Send {Shift}
Sleep 15
return

$d::
Send, {Space 10}
Sleep 90
Send d
Sleep 5
Send d
Sleep 7
Send {LButton Down}
Sleep 5
Send {LButton Up}
Sleep 25
Send {Shift}
Sleep 15
return

$a::
Send, {Space 10}
Sleep 90
Send a
Sleep 5
Send a
Sleep 7
Send {LButton Down}
Sleep 5
Send {LButton Up}
Sleep 25
Send {Shift}
Sleep 15
return

$x::
Send, {Space 10}
Send {LButton Down}
Sleep 5
Send {LButton Up}
Sleep 255
Send w
Sleep 10
Send w
Sleep 5
return

$2::
Reload
return

_________________
Image
"Make it idiot-proof, and someone will make a better idiot."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2006, 8:35 pm 
Offline

Joined: October 5th, 2006, 4:35 pm
Posts: 6
thnaks alot dude..
u were a great help :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2006, 8:37 pm 
Offline

Joined: April 14th, 2005, 11:11 am
Posts: 186
Location: Wisconsin, USA
whops, bunch of people replied while i was tweaking your code :P

_________________
Image
"Make it idiot-proof, and someone will make a better idiot."


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: HotkeyStick, just me and 67 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group