AutoHotKey tutorial

11/17/2007 19:49 evanxxxm#91
ok here is the situation
i put F1 and F2 slot for med and sit (for tao to gain mana)
F1: 110, 740
F2: 160, 740
and i have a second function that keeps right clicking 100 pixel above of the tao, which let that point be 500, 250. so whenever any players pass that clicking point, they will get stig or other skills.
of course, i do have a script for that already, which is:
Code:
#persistent
WinGet,id, ID,[Conquer2.0]
sleep 1000

loop
{
ControlClick, x500 y250,ahk_id %id%,,RIGHT
sleep 100
ControlClick, x110 y740,ahk_id %id%,,RIGHT
sleep 200
ControlClick, x160 y740,ahk_id %id%,,RIGHT
sleep 200
}
no problem for this code whatsoever, it runs perfectly
but it definately looks like using bots when other people look at it
so i was trying to make the sit and med function slower and more random sleep time. however the problem for that will be it might miss clicking 500, 250.
therefore i am trying to make something like this:
function 1:
Code:
ControlClick, x110 y740,ahk_id %id%,,RIGHT
sleep 2000 
ControlClick, x160 y740,ahk_id %id%,,RIGHT
sleep 2000
function 2:
Code:
ControlClick, x500 y250,ahk_id %id%,,RIGHT
sleep 200
by using the settimer function, it still load function 1 first, then load function2 afterwards...
so no difference than:
Code:
ControlClick, x110 y740,ahk_id %id%,,RIGHT
sleep 2000 
ControlClick, x160 y740,ahk_id %id%,,RIGHT
sleep 2000
ControlClick, x500 y250,ahk_id %id%,,RIGHT
sleep 200
for another example to understand what i am trying to say will be just like playing drums, right hand hits the drum every 2 seconds, while the left hand hits the drum every 0.2seconds.
any ideas that work around it?

PS* doesnt affect me anymore because i dont use the archer spawn to level at this moment. the purpose of this was when an archer click fly from the spot where my tao sits, the player will get stig and fly into the spawn.
11/17/2007 20:38 hieitk#92
Quote:
Originally Posted by evanxxxm View Post
ok here is the situation
i put F1 and F2 slot for med and sit (for tao to gain mana)
F1: 110, 740
F2: 160, 740
and i have a second function that keeps right clicking 100 pixel above of the tao, which let that point be 500, 250. so whenever any players pass that clicking point, they will get stig or other skills.
of course, i do have a script for that already, which is:

[......]

but it definately looks like using bots when other people look at it

[......]
If u want to make it more random, try using the function ... random xd
it works like this:

Random, OutPutVar, min, max

Here is an idea:

Code:
loop
{

Random, med_time , 1000, 2000
Random, skill_time , 1000, 2000
Random, delay_time , 100, 200
sit_time := med_time + delay_time

ControlClick, x500 y250,ahk_id %id%,,RIGHT
sleep,%med_time%
ControlClick, x110 y740,ahk_id %id%,,RIGHT
sleep, %sit_time%
ControlClick, x160 y740,ahk_id %id%,,RIGHT
sleep, %skill_time%
}
Of course you have to change the times, I never had a tao so I dont understand how it works, maybe u have to change the order between sit/med/skill as well.

Anyway, I hope it helps ^^
11/18/2007 01:34 evanxxxm#93
then again, with that script, sometimes 500, 250 will have to wait a 4 second cycle sleep
which will miss right click stiging the archer when he flies up
archer 100 lvl lower can only fly for 40 seconds, that 4 seconds waiting to get stig can get people frustrated.
so again for the drum example for the scrpt u provide will be:
Code:
Right
Right
Left
Right
Right
Left
Right
Right
Left....
which thats not i want, i want something similar to:
Code:
Right Left
Right 
Right
Right
Right Left
Right
Right
Right 
Right Left.......
i understand how to make a loop like
Code:
loop 
{
Random, time , 5, 20
loop %time%
{
ControlClick, x500 y250,ahk_id %id%,,RIGHT
sleep 100
}
ControlClick, x110 y740,ahk_id %id%,,RIGHT
}
Random, time , 5, 20
loop %time%
{
ControlClick, x500 y250,ahk_id %id%,,RIGHT
sleep 100
}
ControlClick, x160 y740,ahk_id %id%,,RIGHT
}
but trying to learn what exactly does the settimer function do.
if a simple loop like that can works the same, why need the settimer function
i was thinking about the settimer function might be more intelligent
11/19/2007 03:53 hieitk#94
Quote:
Originally Posted by evanxxxm View Post
then again, with that script, sometimes 500, 250 will have to wait a 4 second cycle sleep
which will miss right click stiging the archer when he flies up
archer 100 lvl lower can only fly for 40 seconds, that 4 seconds waiting to get stig can get people frustrated.
so again for the drum example for the scrpt u provide will be:
Code:
Right
Right
Left
Right
Right
Left
Right
Right
Left....

[...]
If u still want mora than 1 function to work at the same time, why dont you try with the controlSend(Fx) instead of making a right click over the Fx buttons?

you cant make 2 clicks on differents position at the same time, but maybe u can send more than one key at the same time.

g2g, peace
01/16/2008 15:09 TomasLT#95
I need som help

how to do that when some1 press button then this app close and open new app
01/16/2008 18:18 evanxxxm#96
TomasLT@
if u are refering to the AHK program, u can do

^r::reload

Ctrl+R will activate a reload program

if u are referring to specific program like CO window, u can do

^r::
{
winkill, [Conquer2.0]
run, play.exe, C:Program FilesConquer 2.0
}
01/17/2008 15:54 TomasLT#97
can some1 give me simple code that program open notepad and write some text?
01/18/2008 00:23 evanxxxm#98
TomasLT@
Run, Notepad.exe, C:\My Documents, max
sleep 500
send 1234567890
01/18/2008 13:03 TomasLT#99
Ty man. i forgot so simpe code xD
09/13/2009 23:41 thamade#100
hieitk :
erm so with autohotkey u cant make bots that u can minimize and do other things on the comp right?
10/11/2009 02:17 Coolcountry#101
Hello there everyone. I was wondering if someone could explain to me why I can't random to work.
Quote:
Gui,Show,h150 w250, Learning

Gui, Add, Button, x20 y110 w50 h20 gdouble,Answer
Gui, Add, Text, x10 y50 w90 Center,Random + 2 x
Gui, Add, Edit, w60 h20 x130 y50 vNumber Center

return



Double:
{
Random,A_number,10,2000
Gui,Submit,NoHide
double := (2 * Number) + %A_number%
Msgbox,,Result, The Result is %double%
return
}

GuiClose:
ExitApp
10/11/2009 02:34 SeanCool#102
Nice tuto!!
07/18/2010 00:19 ciberghost#103
Heregoes my first code in AutoHotKey, thats to this tutorial and help file that keep me on track.

Thanks

Code:
#NoTrayIcon
Gui, Show, w400 h300, Média do Estágio
Menu, FileMenu, Add,S&air,MenuHandler
Gui, Menu, FileMenu
Gui, add, text, x10 y10 cblue , 1º
Gui, add, edit, x30 y10 h20 w80 vNum1
Gui, add, text, x280 y10 cblue , 2º
Gui, add, edit, x300 y10 h20 w80 vNum2 
Gui, add, text, x10 y50 cblue , 3º
Gui, add, edit, x30 y50 h20 w80 vNum3
Gui, add, text, x280 y50 cblue , 4º
Gui, add, edit, x300 y50 h20 w80 vNum4
Gui, add, text, x10 y90 cblue , 5º
Gui, add, edit, x30 y90 h20 w80 vNum5
Gui, add, text, x280 y90 cblue , 6º
Gui, add, edit, x300 y90 h20 w80 vNum6
Gui, add, text, x10 y130 cblue , 7º
Gui, add, edit, x30 y130 h20 w80 vNum7
Gui, add, text, x280 y130 cblue , 8º
Gui, add, edit, x300 y130 h20 w80 vNum8
Gui, add, text, x10 y170 cblue , 9º
Gui, add, edit, x30 y170 h20 w80 vNum9
Gui, add, text, x130 y175 cblue, Resultado
Gui, add, edit, x200 y170 h20 w180 vNumResult ReadOnly
Gui, add, Button, x30 y200 w80 h30 gmedia, Calcular
Gui, add, button, x300 y200 w80 h30 gLimpar, Limpar
Gui, Add, Picture, w60 h-1 x160 y50 glink,logo.png
gui, Font, s10, Verdana
Gui, Add, Text, x60 y230, Agrupamento de Escolas do Alto do Lumiar
Gui, Add, Text, x150 y250, EB 2,3 D. José I
Return

MenuHandler:
MsgBox ,Obrigado Pela Preferência
ExitApp
Return

media:
{
Gui, Submit, NoHide
Resultado := Num1 + Num2 + Num3 + Num4 + Num5 + Num6 + Num7 + Num8 + Num9
Resultado := Ceil(Resultado /9)
If Resultado < 3
{
	GuiControl,,NumResult,O valor Obtido no Estágio é inferior a positivo, = %Resultado%
}
Else
GuiControl,,NumResult,Nota Final %Resultado%
Return
}

Limpar:
{
NumResult := ""
Num1 := ""
Num2 := ""
Num3 := ""
Num4 := ""
Num5 := ""
Num6 := ""
Num7 := ""
Num8 := ""
Num9 := ""
GuiControl,,Num1
GuiControl,,Num2
GuiControl,,Num3
GuiControl,,Num4
GuiControl,,Num5
GuiControl,,Num6
GuiControl,,Num7
GuiControl,,Num8
GuiControl,,Num9
GuiControl,,NumResult
Return
}
link:
{
	Run http://www.agrupamentoescolasaltodolumiar.com
	Return
}	

Return

GuiClose:
ExitApp
08/04/2010 20:03 Bl0wFish#104
THX for sharing.
10/27/2010 17:48 denominator#105
Seems autoit can have a disable on characters but ahk can`t????