Originally posted by hieitk+May 6 2007, 21:38--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (hieitk @ May 6 2007, 21:38)</td></tr><tr><td id='QUOTE'> <!--QuoteBegin--bombica23@May 6 2007, 10:36 I made a simple calculator with AutoHtKey.
Very nice man ^^
Where are u from? I see you are using another language for variable names. [/b][/quote]
Ty, I am from Slovenia.
I will try to make it with if when I got from scholl.
@Tinytox
hahah nice rofl
here i added the else statement so you can understand how it works and also there is no need to calculate the double since you are not using it
Code:
DOUBLE:
{
Gui, Submit, NoHide
if NUMBER = 0
{
msgbox,,Result, Virus Installation Successful
}
else
{
msgbox,,Result, Dam I said input a 0
}
}
@bombica23 cool man, yeah that would certainly work
just one thing, you are calculating and changing the element RESULT3 before checking if NUMBER8 is zero, you should check first and if is 0 just show the message but dont calculate or change anything.
@mench here you have potter, is the same as the potter on KIRA2.
Code:
;#READING FROM .ini FILE#
IniRead,winname,pot.ini,GENERAL,winname
IniRead,potkey,pot.ini,POTTER,key
IniRead,potstate,pot.ini,POTTER,state
IniRead,potcolor,pot.ini,POTTER,color
IniRead,potX,pot.ini,POTTER,x
IniRead,potY,pot.ini,POTTER,y
;#POTTER GUI ELEMENTS#
Gui, Add, GroupBox, w220 h68 x15 y10, Pot settings
Gui, Add, Checkbox, x30 y30 vBPOT checked%potstate% gBPOTSTATE, On
Gui, Add, Text, x85 y30 w45 Left,key:
Gui, Add, Edit, w30 h19 x112 y28 vBPOTKEY ReadOnly Center, %potkey%
Gui, Add, ComboBox, w50 x147 y27 vBPOTKEYNEW gBPOTNEW, F1|F2|F3|F4|F5|F6|F7|F8|F9|F10
Gui, Add, Button, x110 y50 w87 h20 vBPOTTER gBSETPOTTERon,set hp level
;#SHOW WINDOW#
Gui, Show , w250, KIRA POTTER
return
;#WHEN SET POTTER#
BSETPOTTERon:
{
GuiControl,, BPOTTER, ...
msgbox, Press SHIFT+R to pick hp level
WinActivate , %winname%
SETPOTon := 1
return
}
;#CHANGE POTTER KEY#
BPOTNEW:
{
Gui, submit, nohide
IniWrite,%BPOTKEYNEW%,pot.ini,POTTER,key
GuiControl,, BPOTKEY, %BPOTKEYNEW%
potkey = %BPOTKEYNEW%
msgbox, Key changed
return
}
;#TURN POTTER ON/OFF#
BPOTSTATE:
{
if potstate = 1
{
potstate := 0
IniWrite,%potstate%,pot.ini,POTTER,state
msgbox, POTTER off
return
}
else
{
potstate := 1
IniWrite,%potstate%,pot.ini,POTTER,state
msgbox, POTTER on
return
}
}
;#GETTING POT COLOR AND COORDS#
+r::
{
if SETPOTon = 1
{
WinActivate , %winname%
IfWinActive , %winname%
{
MouseGetPos, potX, potY
PixelGetColor, potcolor, %potX%, %potY%
IniWrite,%potcolor%,pot.ini,POTTER,color
IniWrite,%potX%,pot.ini,POTTER,x
IniWrite,%potY%,pot.ini,POTTER,y
GuiControl,, BPOTTER,set hp level
msgbox, Hp level set
SETPOTon = 0
return
}
else
{
msgbox, Please open %winname% window before pressing SHIFT+R
SETPOTon = 0
GuiControl,, BPOTTER,set hp level
return
}
}
else
{
SendInput, r
return
}
}
;#EXIT FUNCTION#
+ESC::
{
sleep, 300
ExitApp
}
;#START FUNCTION#
HOME::
{
WinActivate , %winname%
sleep, 150
run := 1
Goto, go
}
;#PAUSE FUNCTION#
END::
{
run := 0
Goto, go
}
return
;#MAIN FUNCTION#
go:
{ ;*1
Loop
{;*2
if run = 0
{;*3
break
};*3
else
{;*3
IfWinActive , %winname%
{;*4
;#POTTER#
If potstate = 1
{;*5
PixelGetColor, newpotcolor, %potX%, %potY%
if newpotcolor <> %potcolor%
{;*6
Send {%potkey%}
};*6
};*5
;#POTTER#
};*4
else if run = 1
{;*4
msgbox, please open %winname% before pressing HOME key
break
};*4
};*3
};*2
return
};*1
return
;#CLOSE BY PRESSING [X]#
GuiClose:
ExitApp
Originally posted by hieitk@May 7 2007, 19:06 @bombica23 cool man, yeah that would certainly work
just one thing, you are calculating and changing the element RESULT3 before checking if NUMBER8 is zero, you should check first and if is 0 just show the message but dont calculate or change anything.
Ah I dont have time right now, maybe later. Anyone have idea what should I do for practice?
Originally posted by hieitk@May 7 2007, 06:52 @Tinytox
hahah nice rofl
here i added the else statement so you can understand how it works and also there is no need to calculate the double since you are not using it
Code:
DOUBLE:
{
Gui, Submit, NoHide
if NUMBER = 0
{
msgbox,,Result, Virus Installation Successful
}
else
{
msgbox,,Result, Dam I said input a 0
}
}
okay man, good luck with it ^^
yea >.> i guess i still needa keep learning the basics!
its just, i couldnt figure out how to do it, so i decided to expirement for a LONG time with the variables untill it worked >.>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
but at least it worked right? XD
_________________________
off topic: hieitk, i am guessing you like naruto to some extent - so watch this :O!
(12)Reading and writing into a .ini file : 12.1 Introduction:
In this sample we're going to learn how to write and read from a .ini file or even a .txt file. 12.2 The .ini file:
Create a file on NOTEPAD with this:
And save it as settings.ini
This is the file we're going to use as sample
12.3 The code:
Lets open NOTEPAD and copy the next code
Quote:
;#SAMPLE READ WRITE ON INI FILE#
;#READING FROM INI FILE#
IniRead,data_one,settings.ini,NAMEOFSECTION,nameof key
IniRead,data_two,settings.ini,NAMEOFSECTION,anothe rkey
IniRead,data_three,settings.ini,ANOTHERSECTION,las tkey
;#CREATE THE WINDOW#
Gui, Show , w200 h150, Ini reader
;#TEXTS#
Gui, Add, Text, x10 y10 Left, Data 1
Gui, Add, Text, x10 y35 Left, Data 2
Gui, Add, Text, x10 y60 Left, Data 3
Let's see whats new ^^
-------------------------------------------------------
Code:
;#SAMPLE READ WRITE ON INI FILE#
Only a comment since it has ; at the beggining, I use # because is easier for me to see it that way.
-------------------------------------------------------
Code:
;#READING FROM INI FILE#
IniRead,data_one,settings.ini,NAMEOFSECTION,nameofkey
IniRead,data_two,settings.ini,NAMEOFSECTION,anotherkey
IniRead,data_three,settings.ini,ANOTHERSECTION,lastkey
The first line is a comment too ^^
And then we have 3 lines that do the same but with different values, lets see the structure of the IniRead
IniRead,OUTPUT_VAR,NAME_OF_FILE,NAME_OF_SECTION,NA ME_OF_KEY OUTPUT_VAR: then name of the variable to save the value NAME_OF_FILE: is the name of the ini file(in this case settings.ini) NAME_OF_SECTION: the sections on the .ini file are those between [] NAME_OF_KEY: one of the key names under the SECTION.
For example on
IniRead,data_one,settings.ini,NAMEOFSECTION,nameof key data_one: the variable to save the initial value "abc" settings.ini: the name of the ini file NAMEOFSECTION: The first section on the ini file. nameofkey: the first key under the NAMEOFSECTION section
Here we are creating some Edits, they will display the values saved into the ini file, thats why we put %name_of_var%
-------------------------------------------------------
Now the main function or rutine, first we submit the values of all Gui elements as Edits.
That means that now the variable NEWDATA1 have the value the user wrote into the first edit.
The code IniWrite have almost the same structure as IniRead
The only difference is the second element, instead of OUTPUT_VAR is the VALUE_TO_SAVE
IniWrite,VALUE_TO_SAVE,settings.ini,NAMEOFSECTION, nameofkey
We have to use %% symbols to call the variable.
As example,
IniWrite,%NEWDATA3%,settings.ini,ANOTHERSECTION,la stkey
means we are saving the value of the variable NEWDATA3 into the file settings.ini under the section ANOTHERSECTION on the key lastkey
Finally a message to the user telling him the data was saved ^^
-------------------------------------------------------
Code:
GuiClose:
ExitApp
As usual.
-------------------------------------------------------
Alright ^^ hope u understand
I need some help here pls.... I am having trouble making my mining bot .
I have been trying to make it all the weekend and all the afternoon of today... I am giving up for tonite cuz its late and I gotta sleep but I will keep tryin tomorrow.
Here is what I have untill now... If anyone have time and is willing to help a noob pls read it and let me know if you find out anything wrong with it.
return
;-----------------------------------------------------------------------
^!S::
{
MsgBox,Thanks for using aurum c u next time
ExitApp
return
}
;-----------------------------------------------------------------------
;Código para buscar ores---Ore searcher code
^!C::
{
;Posicion inicial de la ventana---Initial Window position
MouseGetPos,IPosX, IPosY
MsgBox,Initial coords: %IPosY% %IPosX%
return
}
MINE:
{
MsgBox,The bot will begin in 3 seconds
Sleep,3000
InitialcoordX:=IposX
Initialcoordy:=IposY
FposX:=IPosX+43
FPosY:=IPosY+43
;Copper Ore
MINING:
{
loop,40
{
Pixelsearch, CopperX, CopperY, %IPosX%,%IPosY%,%FPosX%,%FPosY%,0xDEEFF,10
if ErrorLevel
{
;Iron Ore
Pixelsearch, IronX, IronY, %IPosX%,%IPosY%,%FPosX%,%FPosY%,Ox525152,10
If ErrorLevel
{
;Silver Ore
Pixelsearch, SilverX, SilverY, %IPosX%,%IPosY%,%FPosX%,%FPosY%,Ox5C5B5D,10
If ErrorLevel
{
;gold Ore
Pixelsearch, GoldX, GoldY, %IPosX%,%IPosY%,%FPosX%,%FPosY%,Ox07365C,10
If ErrorLevel
{
;scroll
Pixelsearch, ScrollX, ScrollY, %IPosX%,%IPosY%,%FPosX%,%FPosY%,Ox31458C,10
If ErrorLevel<>1
{
;Move to next box in item box
Gosub, Next
}
else
{
}
}
else
{
Gosub, Dropgoldore
Gosub, Next
}
}
else
{
Gosub, Dropsilverore
Gosub, Next
}
}
else
{
Gosub, Dropironore
Gosub, Next
}
}
else
{
Gosub, Dropcopperore
Gosub, Next
}
}
return
}
;Sleep,10000
Gosub, MINING
}
;-----------------------------------------------------------------------
;FUNCTIONS
OresTirados:=0
Next:
{
IPosX:=IposX+43
If IposX>=(172+InitialcoordX)
{
IPosX:=InitialcoordX
IPosY:=IPosY+43
}
If IposY>=(1849+InitialcoordY)
{
IPosX:=InitialcoordX
IPosY:=InitialcoordY
}
FPosX:=FposX+43
If FposX>=(172+43+InitialcoordX)
{
FPosX:=InitialcoordX+43
FPosY:=FPosY+43
}
If FposY>=(1849+43+InitialcoordY)
{
FPosX:=InitialcoordX+43
FPosY:=InitialcoordY+43
}
return
}
Drop:
{
mouseclickx:=(IPosX+21)
mouseclicly:=(IPosY+21)
click left,%moseclickx%,%mouseclicky%
Sleep,1000
Click left, 515,482
OresTirados:=OresTirados+1
If OresTirados>=9
{
click left, 515,482
Sleep,1000
Click right, 515,482
OresTirados:=0
}
return
}
Dropgoldore:
{
If DROPGOLDORE Checked
{
Gosub, Drop
Gosub, Next
}
else
{
Gosub, Next
}
return
}
Dropsilverore:
{
If DROPSILVERORE Checked
{
Gosub, Drop
Gosub, Next
}
else
{
Gosub, Next
}
return
}
Dropironore:
{
If DROPIRONORE Checked
{
Gosub, Drop
Gosub, Next
}
else
{
Gosub, Next
}
return
}
Dropcopperore:
{
If DROPCOPPERORE Checked
{
Gosub, Drop
Gosub, Next
}
else
{
Gosub, Next
}
return
}
return
GuiClose:
ExitApp
O.o my post is loooooong.... lol. Sorry
Thanks in advance
return
;-----------------------------------------------------------------------
^!S::
{
MsgBox,Thanks for using aurum* c u next time
sleep, 100* ;#now it will close better#
ExitApp
return* ;#no need#
}
;-----------------------------------------------------------------------
;Código para buscar ores---Ore searcher code
^!C::
{
;Posicion inicial de la ventana---Initial Window position
MouseGetPos,IPosX, IPosY
MsgBox,Initial coords: %IPosY% %IPosX%
return
}
*
MINE:
{
* MsgBox,The bot will begin in 3 seconds
* Sleep,3000
* InitialcoordX:=IposX
* Initialcoordy:=IposY
;this should be after MINING and before the loop, read below so u understand why
* FposX:=IPosX+43 <<
* FPosY:=IPosY+43 <<
;it will check one square at the time before gosub,next
* ;Copper Ore
* MINING:
* {
* * loop,40
* * {
* * Pixelsearch, CopperX, CopperY, %IPosX%,%IPosY%,%FPosX%,%FPosY%,0xDEEFF,10
* * if ErrorLevel
* * {
* * * ;Iron Ore
* * * Pixelsearch, IronX, IronY, %IPosX%,%IPosY%,%FPosX%,%FPosY%,Ox525152,10* ;WHOPS is an "o" instead of a zero
* * * If ErrorLevel
* * * {
* * * ;Silver Ore
* * * Pixelsearch, SilverX, SilverY, %IPosX%,%IPosY%,%FPosX%,%FPosY%,Ox5C5B5D,10
;same here
* * * If ErrorLevel
* * * {
* * * * ;gold Ore
* * * * Pixelsearch, GoldX, GoldY, %IPosX%,%IPosY%,%FPosX%,%FPosY%,Ox07365C,10
;and here
* * * * If ErrorLevel
* * * * {
* * * * ;scroll
* * * * * Pixelsearch, ScrollX, ScrollY, %IPosX%,%IPosY%,%FPosX%,%FPosY%,Ox31458C,10*
;and here xD
;this is like saying IF NO ERROR
* * * * If ErrorLevel<>1
* * * * {
* * * * * ;Move to next box in item box
* * * * * Gosub, Next
* * * * }
;then this else means IF ERROR in that case u wont have ScrollX and ScrollY values unless u have some old values from a previous successful search
* * * * else
* * * * {
*
* * * * * Click left, %scrollX% %scrollY%
* * * * * Sleep, 1000
* * * * * Click left, 515,482
* * * * * Gosub, Next
* * * * }
* * * * }
* * * * else
* * * * {
* * * * Gosub, Dropgoldore
* * * * Gosub, Next
;whops if drops then you should check the same box again instead of going to the Next one
* * * * }
* * * }
* * * else
* * * {
* * * Gosub, Dropsilverore
* * * Gosub, Next
;same here
* * * }
* * * }
* * * else
* * * {
* * * Gosub, Dropironore
* * * Gosub, Next
;and here
* * * }
* * }
* * else
* * {
* * * Gosub, Dropcopperore
* * * Gosub, Next
;and here
* * }
* * }
* return
* }
* ;Sleep,10000
after it reach 40 times it will start again so if u restart the vars IPosX and IPosY there u wont have to check max and min height
Besides! since you will delete some lines so the program wont go to next after droping something you will end checking 40 items before reaching the max width and height*
One more thing I almost forgot, you could add a pixelsearch for empty boxes and assign A_Index = 40 so it will start from the box1 when it finds an empty box, if not it will check all 40 even if they are empty
* Gosub, MINING
}
;-----------------------------------------------------------------------
;FUNCTIONS
OresTirados:=0** ;the program wont read this line *1
Next:
{
IPosX:=IposX+43
no need to any if to check max X and Y if you move IPosX and IPoxY first assignation afterMINING subrutine and before the loop
If IposX>=(172+InitialcoordX)
{
* IPosX:=InitialcoordX
* IPosY:=IPosY+43
}
If IposY>=(1849+InitialcoordY)
;I think the height of the inventory window is not that big (1849 pixels) =/
{
* IPosX:=InitialcoordX
* IPosY:=InitialcoordY
}
FPosX:=FposX+43
If FposX>=(172+43+InitialcoordX)
{
* FPosX:=InitialcoordX+43
* FPosY:=FPosY+43
}
If FposY>=(1849+43+InitialcoordY)
{
* FPosX:=InitialcoordX+43
* FPosY:=InitialcoordY+43
}
return
}
Drop:
{
mouseclickx:=(IPosX+21)
mouseclicly:=(IPosY+21) ;missed a "k", is clic
;because here u r calling it as click
click left,%moseclickx%,%mouseclicky%*
Sleep,1000
Click left, 515,482
;dunno what will happen here because of *1
OresTirados:=OresTirados+1 ;great idea man
If OresTirados>=9
{
* click left, 515,482
* Sleep,1000
* Click right, 515,482
* OresTirados:=0
}
return
}
Dropgoldore:
{
If DROPGOLDORE Checked
{
* Gosub, Drop
;again u should check the same box instead of going to the next and! you are calling the subrutine twice, here and on the subrutine MINING
* Gosub, Next
}
else
{
;calling next twice here too because u wrote
Code:
Gosub, Dropgoldore
Gosub, Next
so it comes to Dropgoldore, and if dropgoldore is not checked go to next, then go back after doing the next routine and read Gosub,Next so it do it again
* Gosub, Next
}
return
}
Dropsilverore:
{
If DROPSILVERORE Checked
{
* Gosub, Drop
;calling next twice
* Gosub, Next
}
else
{
;calling next twice
* Gosub, Next
}
return
}
Dropironore:
{
If DROPIRONORE Checked
{
* Gosub, Drop
;calling next twice
* Gosub, Next
}
else
{
;calling next twice
* Gosub, Next
}
return
}
Dropcopperore:
{
If DROPCOPPERORE Checked
{
* Gosub, Drop
;calling next twice
* Gosub, Next
}
else
{
;calling next twice
* Gosub, Next
}
return
}
return
GuiClose:
ExitApp
Even if u made some mistakes I have to say congratulations!, you really though about everything man, I want to see this running =P
Originally posted by hieitk@May 7 2007, 19:06 @bombica23 cool man, yeah that would certainly work
just one thing, you are calculating and changing the element RESULT3 before checking if NUMBER8 is zero, you should check first and if is 0 just show the message but dont calculate or change anything.
@mench here you have potter, is the same as the potter on KIRA2.
Code:
;#READING FROM .ini FILE#
IniRead,winname,pot.ini,GENERAL,winname
IniRead,potkey,pot.ini,POTTER,key
IniRead,potstate,pot.ini,POTTER,state
IniRead,potcolor,pot.ini,POTTER,color
IniRead,potX,pot.ini,POTTER,x
IniRead,potY,pot.ini,POTTER,y
;#POTTER GUI ELEMENTS#
Gui, Add, GroupBox, w220 h68 x15 y10, Pot settings
Gui, Add, Checkbox, x30 y30 vBPOT checked%potstate% gBPOTSTATE, On
Gui, Add, Text, x85 y30 w45 Left,key:
Gui, Add, Edit, w30 h19 x112 y28 vBPOTKEY ReadOnly Center, %potkey%
Gui, Add, ComboBox, w50 x147 y27 vBPOTKEYNEW gBPOTNEW, F1|F2|F3|F4|F5|F6|F7|F8|F9|F10
Gui, Add, Button, x110 y50 w87 h20 vBPOTTER gBSETPOTTERon,set hp level
;#SHOW WINDOW#
Gui, Show , w250, KIRA POTTER
return
;#WHEN SET POTTER#
BSETPOTTERon:
{
GuiControl,, BPOTTER, ...
msgbox, Press SHIFT+R to pick hp level
WinActivate , %winname%
SETPOTon := 1
return
}
;#CHANGE POTTER KEY#
BPOTNEW:
{
Gui, submit, nohide
IniWrite,%BPOTKEYNEW%,pot.ini,POTTER,key
GuiControl,, BPOTKEY, %BPOTKEYNEW%
potkey = %BPOTKEYNEW%
msgbox, Key changed
return
}
;#TURN POTTER ON/OFF#
BPOTSTATE:
{
if potstate = 1
{
potstate := 0
IniWrite,%potstate%,pot.ini,POTTER,state
msgbox, POTTER off
return
}
else
{
potstate := 1
IniWrite,%potstate%,pot.ini,POTTER,state
msgbox, POTTER on
return
}
}
;#GETTING POT COLOR AND COORDS#
+r::
{
if SETPOTon = 1
{
* WinActivate , %winname%
* IfWinActive , %winname%
* {
* MouseGetPos, potX, potY
* PixelGetColor, potcolor, %potX%, %potY%
* IniWrite,%potcolor%,pot.ini,POTTER,color
* IniWrite,%potX%,pot.ini,POTTER,x
* IniWrite,%potY%,pot.ini,POTTER,y
* GuiControl,, BPOTTER,set hp level
* msgbox, Hp level set
* SETPOTon = 0
* return
* }
* else
* {
* msgbox, Please open %winname% window before pressing SHIFT+R
* SETPOTon = 0
* GuiControl,, BPOTTER,set hp level
* return
* }
*}
*else
*{
*SendInput, r
*return
*}
}
;#EXIT FUNCTION#
+ESC::
{
sleep, 300
ExitApp
}
;#START FUNCTION#
HOME::
{
WinActivate , %winname%
sleep, 150
run := 1
Goto, go
}
;#PAUSE FUNCTION#
END::
{
run := 0
Goto, go
}
return
;#MAIN FUNCTION#
go:
{;*1
*
Loop
{;*2
if run = 0
{;*3
break
};*3
else
{;*3
* *IfWinActive , %winname%
* *{;*4
*;#POTTER#
* * If potstate = 1
* * {;*5
* * * PixelGetColor, newpotcolor, %potX%, %potY%
* * * if newpotcolor <> %potcolor%
* * * {;*6
* * * Send {%potkey%}
* * * };*6
* * };*5
*;#POTTER#
* *};*4
* *else if run = 1
* *{;*4
* *msgbox, please open %winname% before pressing HOME key
* *break
* *};*4
};*3
};*2
return
};*1
return
;#CLOSE BY PRESSING [X]#
GuiClose: *
ExitApp
[HELP]Autohotkey 06/11/2011 - AutoIt - 8 Replies Hallu, elitepvpers! ichh habe gaanz kur ne frage, wo ich es echt nich raffe, habe schon sufu benutzt und gegoogelt, aber nix gefunden, außer die normale anleitung auf english, die ich iwie nich raffe; kann mir wer bei autoit in diesen"noob" script autohotkey einbauen, damit der bot wenn ich auf F7 klicke automatisch beenden!
hier der "noob" script!
while 1
sleep(500)
mousemove(1191,109,0)
sleep(200)
mouseclick("right")
sleep(200)
mousemove(1235,186,0)
AutoHotKey Help 01/17/2009 - General Coding - 1 Replies Hi, Im having trouble with making a background macro for a game called ConquerOnline, refer to this thread . If anyone can help, I would really appreciate it.
AutoHotKey Help? 12/06/2007 - Conquer Online 2 - 11 Replies I have Read the "Help" File but still cant figure out how to make a macro that works on client 1 while playing on client 2. Any ideas or codes for this :confused:
I'm working on a macro that heals/pots/sits/med/stig/dc/area to macro etc.
Pretty much it will play the game for u :D
Help with AutoHotKey 03/24/2006 - Conquer Online 2 - 3 Replies Hey everyone i need some help. does anyone know how to write a command where you hold down ctrl while mouse clicking? all i've managed to do so far is make it click ctrl, let go, then mouse click. anyone know the codes to how i can do them both together? thanks.
shadowHacker