AutoHotkey Community

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 70 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject:
PostPosted: February 21st, 2006, 12:18 am 
thankyou, but as has been mentioned ealier in this thread it is better to remap keys than use send.

Space & w::Up

can't be done in the way that

w::Up

can be done.

For example I could make two scripts:

Script 1:

w::up
a::left
s::down
d::right

script 2:

w::w
a::a
s::s
d::d

All I'm trying to do is put this functionality into one script with a toggle between.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 21st, 2006, 2:31 am 
Offline

Joined: February 12th, 2006, 11:55 pm
Posts: 16
Okay I understand, try this:

Code:
;C:\Warcraft III\mainscript.ahk

Space::
Suspend, Permit
Run, C:\Warcraft III\arrows.ahk
Keywait, Space
Suspend, Off
return


Code:
;C:\Warcraft III\arrows.ahk

#Persistent
SetTimer, Closeme, 100

Closeme:
GetKeyState, state, Space, P
if(state == "U")
ExitApp
return

a::left
d::right
s::down
w::up


I don't know why, but this doesn't work correctly. The 2nd script will always quit right after launching. But if you comment out the Closeme stuff then the scripts works like you want (except it doesn't stop working after you release space.)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 22nd, 2006, 4:50 pm 
Offline

Joined: February 12th, 2006, 11:55 pm
Posts: 16
More possibly useful scripts:

Code:
;Double Right Click sends Alt Right Click, which forces a non-formation move.
;Useful if you want to have formation on but don't want units pausing when you are
;trying to run away.

$*RButton::
Send, {RButton}
Keywait, RButton, D, T0.1
if ErrorLevel = 0
   Send, !{RButton}
return



Code:
;An new version of a "Ctrl+#" replacement key.  Single click MButton to add/remove
;a unit to the group, drag and release MButton to add a selection to the group,
;and double click MButton to add all units of the same type to the group.
;Assumes "group" is a global variable which tracks last pressed # key.


MButton::
If(A_TimeSincePriorHotkey <= 150 and A_PriorHotkey == "MButton")
{
   Keywait, MButton
   Send, {Shift Down}
   Send, {LButton}
   Send, {LButton}
   Send, {Shift Up}
   Send, ^%group%
}
else
{
   Critical ;prevents this block from being interrupted by the previous block

   Send, {Shift Down}
   Send, {LButton Down}
   Keywait, MButton
   Send, {LButton Up}
   Send, {Shift Up}
   Send, ^%group%
}
return


Code:
;Auto cast hotkey.  Double press the spell key to toggle autocast.  Built in pixel checks
;to ensure that the script doesn't activate when spamming the key for unit production.
;Must manually edit the "<X>,<Y>" to the desired icon position (in pixels)!
;Useful if all spells bound to "r" have the same icon position.
;(see Warkeys program or customkeys.txt)

ColorEqual(x,y,t)
{
x += 0
y += 0

x1 := Floor(x/65536)
y1 := Floor(y/65536)
x2 := Floor((x-x1*65536)/256)
y2 := Floor((y-y1*65536)/256)
x3 := (x-x1*65536-x2*256)
y3 := (y-y1*65536-y2*256)

z1 := x1-y1
z1 := x2-y2
z1 := x3-y3

if (Abs(z1) <= t) and (Abs(z2) <= t) and (Abs(z2) <= t)
return 1
else
return 0
}

$r::
Send, r
Keywait, r
PixelGetColor, color1, 409, 679
PixelGetColor, color2, 521, 656
If(ColorEqual(color1,0x7B6E62,3) == 0 and ColorEqual(color2,0x12D3FC,3) == 0)
{
   KeyWait, r, D, T0.1
   If ErrorLevel = 0
   {
         Keywait, r
         MouseGetPos X1, Y1
         Send, {Escape}
         MouseClick,Right,<X>,<Y>,1,0
         MouseMove,%X1%,%Y1%, 0
   }
}
return


This code does not work flawlessly with autocast spells which have no target (raise dead, summon carrion beetle, get corpse, and phase shift); Unless the spell is cooling down, double pressing the spell key will result in a single activation before the autocast is disabled for these spells. If you move the "Send, r" command into an else statement for "If ErrorLevel = 0" then the script will work correctly for those 4 spells at the cost of a 100 ms delay in the "r" key.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 25th, 2006, 6:19 pm 
Offline

Joined: January 18th, 2006, 12:37 am
Posts: 290
I wrote a simple script to calculate your APM in the middle of the game.
You can download it here:
http://autohotkey.net/~POINTS/APM.ahk

Code:
; This script will calculate the APM based on using the following keys:
;  a-z, Numpad1, Numpad2, Numpad4, Numpad5, Numpad7, Numpad8, and the arrow keys
; However, the keys are still counted when chatting
;
; To Start the Script Press NumpadDot (you should hear a beeping sound)
;  At any time in the game you can press Numpad0 and the script will echo your
;  APM to warcraft via a chat message (make sure you don't press enter before
;  pressing Numpad0)

#SingleInstance Force

; The key to start the script
~NumpadDot::
~NumpadDel::
iTimeStart := A_TickCount ; A_Tickcount stores the number of milliseconds since the computer was rebooted
SoundPlay,*64 ; Beeps so we know it's started
return

~Numpad0::
~NumpadIns::
if not iTimeStart ; if we haven't started the timer yet, output this error
  Send, {Enter}My APM is unknown (the timer has not been started){Enter}
else
{
  ; APM is defined as the number of actions per minute
  ;  The time is the current time minus the start time (in msec) and there are
  ;   60,000 msec per minute
  iAPM := (60000*iCount)/(A_TickCount - iTimeStart)
  Send, {Enter}My APM is %iAPM%{Enter}
}
return

~a::
~b::
~c::
~d::
~e::
~f::
~g::
~h::
~i::
~j::
~k::
~l::
~m::
~n::
~o::
~p::
~q::
~r::
~s::
~t::
~u::
~v::
~w::
~x::
~y::
~z::
~Up::
~Down::
~Left::
~Right::
~Numpad1::
~Numpad2::
~Numpad4::
~Numpad5::
~Numpad7::
~Numpad8::
~LButton::
~RButton::
;SoundPlay,*48 ; for debugging you can turn this beep on
if iTimeStart
  iCount++
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 26th, 2006, 5:56 pm 
Offline

Joined: February 5th, 2006, 6:55 am
Posts: 35
Thanks dosboot for the "non-formation move". Thanks points for the APM. (When you guys posted, my email notification was not working anymore. WTF)


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 29th, 2006, 9:44 pm 
Offline

Joined: March 29th, 2006, 7:59 pm
Posts: 2
First : I use Warkeys, and config all hostkey to :
q w e r
a s d f
y x c v (hungarian layout)
And i will use Tab + key to rightclick for Autocasting skills/spells
I make this:

Code:
;;;; Auto Cast Spells ;;;;
AutoCast(grid)
{
  If (grid = 0) {
     grid_x := 815
     grid_y := 615
    }
  If (grid = 1) {
     grid_x := 815
     grid_y := 670
    }
  If (grid = 2) {
     grid_x := 815
     grid_y := 720
    }
  If (grid = 3) {
     grid_x := 875
     grid_y := 615
    }
  If (grid = 4) {
     grid_x := 875
     grid_y := 670
    }
  If (grid = 5) {
      grid_x := 875
      grid_y := 725
    }
  If (grid = 6) {
     grid_x := 930
     grid_y := 615
    }
  If (grid = 7) {
     grid_x := 930
     grid_y := 670
    }
  If (grid = 8) {
     grid_x := 930
     grid_y := 725
    }
  If (grid = 9) {
     grid_x := 985
     grid_y := 615
    }
  If (grid = 10) {
     grid_x := 985
     grid_y := 670
    }
  If (grid = 11) {
     grid_x := 985
     grid_y := 725
    }
  MouseGetPos orig_x, orig_y
  MouseClick R, %grid_x%, %grid_y%, 1, 0
  MouseMove %orig_x%, %orig_y%, 0
}
return

~Tab & q:: AutoCast(0)
~Tab & a:: AutoCast(1)
~Tab & y:: AutoCast(2) ;note: on my keybord layout y is under a
~Tab & w:: AutoCast(3)
~Tab & s:: AutoCast(4)
~Tab & x:: AutoCast(5)
~Tab & e:: AutoCast(6)
~Tab & d:: AutoCast(7)
~Tab & c:: AutoCast(8)
~Tab & r:: AutoCast(9)
~Tab & f:: AutoCast(10)
~Tab & v:: AutoCast(11)


it is works fine, if i use the screen on 1024x768
Possible make this for all resolution ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 31st, 2006, 11:09 am 
Hi all,

Great thread, as i am a huge fan of warcraft...

Dosboot, in the piece of code concerning the Ctrl+# replacement
how would you track the last pressed # key, that is the global variable "group"

Thanks for your answers


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 31st, 2006, 11:28 pm 
Offline

Joined: February 12th, 2006, 11:55 pm
Posts: 16
Nico wrote:
Hi all,

Great thread, as i am a huge fan of warcraft...

Dosboot, in the piece of code concerning the Ctrl+# replacement
how would you track the last pressed # key, that is the global variable "group"

Thanks for your answers


Sure thing. I guess I made it sound sort of fancy but this is how I do it:

Code:
~1::group = 1
~2::group = 2
~3::group = 3
~4::group = 4
~5::group = 5
~6::group = 6
~7::group = 7
~8::group = 8
~9::group = 9
~0::group = 0

~^1::group = 1
~^2::group = 2
~^3::group = 3
~^4::group = 4
~^5::group = 5
~^6::group = 6
~^7::group = 7
~^8::group = 8
~^9::group = 9
~^0::group = 0


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 1st, 2006, 5:37 pm 
I had problems with the healthbars always on. Maybe the issue stems from the fact that I'm using an english version of Warcraft and a german OS and keyboard. Using virtual keys it worked. Maybe somebody's got the same problem, so here's the code.

Code:
*Capslock::
if (CapsLockOn == False)
{
   Send, {vkDBsc01A down} 
   Send, {vkDDsc01B down} 
   CapsLockOn := True
}
else
{
   Send, {vkDBsc01A up} 
   Send, {vkDDsc01B up} 
   CapsLockOn := False
}
return


Somehow the healthbars didn't stay when using settimer so I have to turn them on myself.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 1st, 2006, 7:35 pm 
Offline

Joined: February 5th, 2006, 6:55 am
Posts: 35
Do you know if the timer is running? Or maybe you could post the code and get some advice. You could put this in the timer to check if running,

SoundPlay,*64


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2006, 4:15 pm 
Offline

Joined: February 12th, 2006, 11:55 pm
Posts: 16
In my script I have to put timers before any hotkeys are defined for it to work. That could be the problem if you find the timer isn't running.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 3rd, 2006, 1:46 pm 
dosboot, you're right. Timers before hotkeys. It's a pity you can't freely place hotkeys, timers and functions.

jtbalogh, thanks for your advice concerning SoundPlay. The timer works after moving it up in the script (see above). Anyway, SoundPlay didn't work, I used SoundBeep instead.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 18th, 2006, 8:56 pm 
Hi !!
I just discovered your programm , and i think it could be really useful for warcraft :)
I don't have time to learn a new coding language , (i play too much) so i would like to tell me the code i need to do what i want :)
I wouldt like to change items hotkeys (78 45 12) to TY GH BN !! But if i write something (pressing {ENTER} key ) i wouldnt like to say things like "78" for "ty" or "475" for "gth" !!!
Thx for your answers :)
(excuse my baaaaad english , im french :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 18th, 2006, 10:54 pm 
Offline

Joined: January 18th, 2006, 12:37 am
Posts: 290
Read signature.

They way to do it manually is like this:
Code:
; Note: this will of course mess up chatting, download my program
; to get it to work with enter and esc too
t::Numpad7
y::Numpad8
g::Numpad4
h::Numpad5
b::Numpad1
n::Numpad2


but my program will write the code for you.

Edit: My program will also fix it so when you send a message it will pause the script.

_________________
My AutoHotkey Program for Warcraft III:
Warkeys
http://warkeys.sourceforge.net/

Remap your hotkeys
Healthbars always on
Remap inventory


Last edited by POINTS on April 20th, 2006, 6:01 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 19th, 2006, 5:08 pm 
i dled Warkeys , and the script seems to work fine.
Does it add autocast script?
if i bind "a" for lightning shield , and i keep pushing "a" , it will continuly make shields where i want??


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 70 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 21 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