| View previous topic :: View next topic |
| Author |
Message |
ifckladyluck
Joined: 20 Jan 2009 Posts: 16
|
Posted: Wed Jan 21, 2009 3:23 am Post subject: loop/hotkey quesiton |
|
|
does anyone know why this isnt working? and if there is a better way to do this?
switch := 1
End:: switch/=-1
loop
{
if switch = 1
tooltip running
sleep 500
} |
|
| Back to top |
|
 |
SpiderGames
Joined: 09 Jun 2008 Posts: 936 Location: Canada
|
Posted: Wed Jan 21, 2009 3:25 am Post subject: Re: loop/hotkey quesiton |
|
|
| ifckladyluck wrote: | does anyone know why this isnt working? and if there is a better way to do this?
switch := 1
End:: switch/=-1
loop
{
if switch = 1
tooltip running
sleep 500
} |
It helps if you tell us what you are trying to do. _________________
I know i have 6 legs. It's cuz I'm special. |
|
| Back to top |
|
 |
ifckladyluck
Joined: 20 Jan 2009 Posts: 16
|
Posted: Wed Jan 21, 2009 3:58 am Post subject: |
|
|
sorry i thought it was apparent.
just trying to toggle the tooltip on and off depending on when i press the endkey. |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 5044 Location: the tunnel(?=light)
|
|
| Back to top |
|
 |
Guest
|
Posted: Wed Jan 21, 2009 4:28 am Post subject: |
|
|
The 1st problem is that the script never runs far enough to get to the loop. When you run the code you posted, it stops as soon as it hits End:: switch/=-1 (hotkeys mark the end of the Auto-Execute section of a script).
So put that below your loop and then you can finish debugging why your switch isn't working  |
|
| Back to top |
|
 |
ifckladyluck
Joined: 20 Jan 2009 Posts: 16
|
Posted: Wed Jan 21, 2009 4:31 am Post subject: |
|
|
| Anonymous wrote: | The 1st problem is that the script never runs far enough to get to the loop. When you run the code you posted, it stops as soon as it hits End:: switch/=-1 (hotkeys mark the end of the Auto-Execute section of a script).
So put that below your loop and then you can finish debugging why your switch isn't working  |
this was a very handy piece of info, this was exactly what the problem was. thank you very much. |
|
| Back to top |
|
 |
animeaime
Joined: 04 Nov 2008 Posts: 1045
|
Posted: Wed Jan 21, 2009 5:18 pm Post subject: |
|
|
My recommendation would be to use "*=" instead of "/=".
My reasons:
1) it does the same thing
2) Multiplcation is ALWAYS faster than division.
3) Just some input of my own - you might want to do this instead.
Then, you could use
| Code: | if Switch
MsgBox, Do thing
else
MsgBox, Don't do thing |
Plus, my quess is that the not operation ("!") is quicker than multiplication, but that's just my guess. _________________ As always, if you have any further questions, don't hesitate to ask.
Add OOP to your scripts via the Class Library. Check out my scripts. |
|
| Back to top |
|
 |
|