 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
SagaTious Guest
|
Posted: Thu Sep 17, 2009 7:17 pm Post subject: Detect input but still send the keys? |
|
|
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 |
|
| Back to top |
|
 |
SagaTious Guest
|
Posted: Thu Sep 17, 2009 7:25 pm Post subject: |
|
|
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  |
|
| Back to top |
|
 |
MasterFocus
Joined: 08 Apr 2009 Posts: 882 Location: Rio de Janeiro - RJ - Brasil
|
Posted: Thu Sep 17, 2009 9:08 pm Post subject: |
|
|
1) Looks like key-binding for Invoker (DotA) haha
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 |
_________________
Antonio França
aka MasterFocus aka Tunis
+ My AHK stuff: ~MasterFocus
+ AHK @ irc.freenode.net: #ahk
Contact: PM only ! |
|
| Back to top |
|
 |
SagaTious Guest
|
Posted: Thu Sep 17, 2009 9:57 pm Post subject: |
|
|
1) Looks like ur right 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?  |
|
| Back to top |
|
 |
MasterFocus
Joined: 08 Apr 2009 Posts: 882 Location: Rio de Janeiro - RJ - Brasil
|
Posted: Fri Sep 18, 2009 2:05 am Post subject: |
|
|
Probably you're missing a Return or not breaking a Loop...
About finding a skill, you could try ImageSearch with the *n (variation) option. _________________
Antonio França
aka MasterFocus aka Tunis
+ My AHK stuff: ~MasterFocus
+ AHK @ irc.freenode.net: #ahk
Contact: PM only ! |
|
| Back to top |
|
 |
SagaTious Guest
|
Posted: Fri Sep 18, 2009 1:05 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|