AutoHotkey Community

It is currently May 26th, 2012, 10:46 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: September 17th, 2009, 8:17 pm 
Hi,

I'm working at a little script for myself and have a problem right now.

I need something like a persistent function that detects if I press QWER or EWQR or QQWR or any of those combinations (always ended with R!). If I do so, my F key should send a Z instead of F.

I tried myself but I cant figure out how to make such a persistent function that checks all the time and doesnt have to be started by another hotkey.

Thanks in advance


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 17th, 2009, 8:25 pm 
Damn. Just when I sent that I read about hotstrings which I think is pretty much all I need. I hate that. Searching the whole day and when I decide to ask for help I'm finding the solutiong myself :?

Maybe there'll be another question so stay patient :D


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 17th, 2009, 10:08 pm 
Offline

Joined: April 8th, 2009, 8:23 pm
Posts: 3036
Location: Rio de Janeiro - RJ - Brasil
1) Looks like key-binding for Invoker (DotA) haha :lol:
2) You need to add "~" before the letters in the hotkeys
3) Maybe something like this:
Code:
~q::
~w::
~e::
~r::
  seq .= SubStr(A_ThisHotkey,2)
  CheckSequence(ByRef seq)
  ; the above should be a function to check a certain sequence
  ; use ByRef so you can make the variable blank if a sequence is found
Return

_________________
"Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried.
"
Image
Antonio França
My stuff: Google Profile


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 17th, 2009, 10:57 pm 
1) Looks like ur right :D Im trying to change the hotkeys on every new invoke so I can always use the left spell with D and the right with F no matter what spells they are.

But now I realized that there is no pattern in which the spellpositions change. Ofc the oldest one gets replaced, but sometimes they change positions and sometimes they don't. Cold Snap for example stays in the right slot no matter what (if u can invoke 2 spells).

I'm trying to compare the colors of a certain pixel but that pixel changes its color when switching spellslots. Thats pretty confusing -.-

So I cant find any solution to this problem (which is not really ahk related).

I changed it now so everytime I invoke a spell I have to press D or F afterwards which will be my hotkey after that.

Uhm now could anybody tell me whats the deal with that #maxhotkeysperinstance or whatever its called? Sometimes while running my script a little window opens that says "79 Hotkeys have been detected over the last xxxx Seconds/Minutes/whatever. Do you want to continue?" or something like that.
Whats that? :shock:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 18th, 2009, 3:05 am 
Offline

Joined: April 8th, 2009, 8:23 pm
Posts: 3036
Location: Rio de Janeiro - RJ - Brasil
Probably you're missing a Return or not breaking a Loop...
About finding a skill, you could try ImageSearch with the *n (variation) option.

_________________
"Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried.
"
Image
Antonio França
My stuff: Google Profile


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 18th, 2009, 2:05 pm 
Ok now everything is running fine except of one thing:

I implemented all the different qwe combinations as hotstrings and F and D as Hotkeys. After any succesful hotstring-use, there will be a function looking for where the spell appeared (@ D hotkey or @ F hotkey). D and F hotkeys have a lot of if-expressions to check which key they shall be remapped to.

Thats what is working at the moment. But after I'm using one of the hotkeys (D/F), the script doesn't recognize any hotstrings anymore. Anybody got an idea why that is? Hope theres an easy way to fix it since I dont want to rewrite everything again :/

Here are some code examples:

Code:
newspell := 1
olspell := 1
oldspellbackup := 1


checkwhere()
{
  global
  oldspellbackup = %oldspell%
  if (newspell = oldspell)
  {
    oldspell = %oldspellbackup%
  }
  if (oldspell = notset)
  {
    newspellhotkey = dkey
    oldspell = %newspell%
  }
  else if (newspell > oldspell)
  {
    oldspellhotkey = fkey
    newspellhotkey = dkey
    oldspell = %newspell%
  }
  else if (newspell < oldspell)
  {
    newspellhotkey = fkey
    oldspellhotkey = dkey
    oldspell = %newspell%
  }
   exp1 = %newspellhotkey%
   exp2 = %oldspellhotkey%

}
;Thats the function checking where the spell is appearing (required me to sort all the spells in a certain priority list to make it work with < or > comparisons)

;Example for a hotstring:
:*:qwqr::
send, r
newspell = 7
checkwhere()
return

;Example for a hotkey (D)
D::
if (exp2 = "dkey")
{
if (oldspellbackup = 1)
{
Send, b
}
else if (oldspellbackup = 2)
{
Send, h
}
else if (oldspellbackup = 3)
{
Send, j
}
else if (oldspellbackup = 4)
{
Send, i
}
else if (oldspellbackup = 5)
{
Send, k
}
else if (oldspellbackup = 6)
{
Send, z
}
else if (oldspellbackup = 7)
{
Send, g
}
else if (oldspellbackup = 8)
{
Send, t
}
else if (oldspellbackup = 9)
{
Send, n
}
else if (oldspellbackup = 10)
{
Send, u
}
}
else if (exp1 = "dkey")
{
if (newspell = 1)
{
Send, b
}
else if (newspell = 2)
{
Send, h
}
else if (newspell = 3)
{
Send, j
}
else if (newspell = 4)
{
Send, i
}
else if (newspell = 5)
{
Send, k
}
else if (newspell = 6)
{
Send, z
}
else if (newspell = 7)
{
Send, g
}
else if (newspell = 8)
{
Send, t
}
else if (newspell = 9)
{
Send, n
}
else if (newspell = 10)
{
Send, u
}
}
return


I guess that could be coded a lot shorter but in this way my brain can follow everything thats going on to kill all bugs. Maybe I'll shorten it when its running.

So the problem again: After pressing D, qwqr will not be recognized as a hotstring anymore. Why?

Thanks in advance,
SagaTious


Report this post
Top
  
Reply with quote  
 Post subject: That's alot of work
PostPosted: May 3rd, 2010, 10:58 pm 
You know that's very confused. Here my scripts for invoker.

[code]
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.

*AppsKey::
Sleep, 100
Send, {[ Down}
Send, {] Down}
Loop
{
GetKeyState, state, AppsKey, P
if state = D
break
Sleep, 50
}
Send, {[ Up}
Send, {] Up}
return

#q::Run C:\Program Files\Warcraft III\Frozen Throne.exe
1::send, {Numpad7}
2::send, {Numpad8}
f::send, {Numpad4}


;Forge Spirit
$4::
send, {q}
send, {e}
send, {e}
send, {r}
return

;Tornado
$e::
send, {w}
send, {w}
send, {q}
send, {r}
return


;Defeaning Blast
$w::
send, {q}
send, {w}
send, {e}
send, {r}
:send, {b}
return


;Ghost Walk
$5::
send, {q}
send, {q}
send, {w}
send, {r}
;send, {v}
return

;Ice Wall
$6::
send, {q}
send, {q}
send, {e}
send, {r}
return

;Meteor
$q::
send, {e}
send, {e}
send, {w}
send, {r}
:sendplay, {d}
return

*f1::
Hotkey, 1, Toggle
Hotkey, 2, Toggle
Hotkey, f, toggle
Hotkey, $4, Toggle
Hotkey, $w, Toggle
Hotkey, $q, Toggle
Hotkey, $e, Toggle
Hotkey, $5, Toggle
Hotkey, $6, Toggle

GetKeyState, state, Shift
if state = D
Send, +{Enter}
else
Send, {Enter}
return
[code]

PS. im still working on autocast send couldn't find the send input.


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot], JSLover, Maestr0, Miguel, rbrtryn and 56 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