1 hotkey 2 diff commands?

11/01/2014 20:27 fikkifuk#1
Hello.
Code:
;Hotkeys
While 1
Hotkeyset("{NUMPAD1}", "com1")
WEnd

Func com1()
   Send("{ENTER}")
   Send("/com1 ON")
   Send("{ENTER}")
EndFunc
is it possible to make it like that my numpad1 can use 2 diff commands?


1st press = /com1 on
2nd press = /com2 off
3rd press = /com3 on

and so on :S

you guys would rlly help me ! THX
11/01/2014 20:30 alpines#2
Use a variable which counts how often you've tapped.
11/01/2014 20:34 fikkifuk#3
ty but i rlly dont know how to make it yet just started autoit yesterday :S
11/01/2014 20:42 alpines#4
I guess this will fit well
Code:
Global $iPress
HotKeySet("{NUMPAD1}", "com1")

While Sleep(100)
WEnd

Func com1()
	Switch $iPress
		Case 0
			Send("{ENTER}/com1 ON{ENTER}")
			$iPress += 1

		Case 1
			Send("{ENTER}/com2 OFF{ENTER}")
			$iPress += 1

		Case 2
			Send("{ENTER}/com3 ON{ENTER}")
			$iPress -= 2
	EndSwitch
EndFunc
11/01/2014 21:08 fikkifuk#5
thanks :)

its working i edited a bit though.

Code:
;Hotkeys
While 1
Global $iPress
Hotkeyset("{NUMPAD1}", "ghost")
Hotkeyset("{NUMPAD2}", "destribute")
WEnd


Func ghost()
	Switch $iPress
		Case 0
			Send("{ENTER}/gm ghostmode ON{ENTER}")
			$iPress += 1
            sleep(1000)
		Case 1
			Send("{ENTER}/gm ghostmode OFF{ENTER}")
			$iPress -= 1
			sleep(1000)
	EndSwitch
EndFunc


Func destribute()
   send("{ENTER}/gm destribute{ENTER}")
   sleep(300)
   EndFunc
fir what is Global $iPress?
11/01/2014 21:11 alpines#6
Wtf, you don't need to set 24/7 these HotKeys, set them once and sleep then.
Otherwise you have a high cpu usage.

The Global $iPress declares a global variable with the content 0.
11/01/2014 21:13 fikkifuk#7
oh thanks again xD im still a noobie :D

if i dont while them the script doesnt work o.o
11/01/2014 21:19 alpines#8
Code:
;Hotkeys
Global $iPress
Hotkeyset("{NUMPAD1}", "ghost")

Hotkeyset("{NUMPAD2}", "destribute")
While Sleep(100)
WEnd


Func ghost()
	Switch $iPress
		Case 0
			Send("{ENTER}/gm ghostmode ON{ENTER}")
			$iPress += 1
            sleep(1000)
		Case 1
			Send("{ENTER}/gm ghostmode OFF{ENTER}")
			$iPress -= 1
			sleep(1000)
	EndSwitch
EndFunc


Func destribute()
   send("{ENTER}/gm destribute{ENTER}")
   sleep(300)
EndFunc
11/01/2014 21:29 fikkifuk#9
thanks again :D

is there also a way to make a new hotkey menu ? for example if i make a hotkey
numpad3 it writes /gm callmonster

then i wanna use diff numbers numb 1 = 1 numb 2 = 2 and so on

but since i already used numb 1 and 2 will that work in any way?
11/01/2014 21:39 alpines#10
Sure, why should it be impossible?
11/01/2014 21:45 fikkifuk#11
cuz if i press 3 and then 1 the "ghost" func would be triggerd :S

but i want a new func for the 1 if i pressed 3