|
You last visited: Today at 14:23
Advertisement
GUI + AHK Help
Discussion on GUI + AHK Help within the CO2 Programming forum part of the Conquer Online 2 category.
01/21/2009, 07:16
|
#1
|
elite*gold: 0
Join Date: Jan 2009
Posts: 14
Received Thanks: 6
|
GUI + AHK Help
Hi all, I am having trouble creating a GUI with AutoHotKey.
What I am trying to do is make a simple GUI that says Enter Player Coordinates and it has 2 spots to put the x and the y coordinates of the player. Then I would like to use the entered coordinates and translate them into the position that I want to click on the cowindow, which depends on the initial position entered. I haven't figured out how to convert the coordinates in order for the bot to click at the right spot given the initial coordinates but I have recorded the position on the screen I want to click based on my chars position. Hope This isn't too confusing but here is what I mean:
Code:
pos1:
ConquerChar-360 , 313
COWindow - 163 , 215
pos2:
ConquerChar-351 , 313
COWindow - 456 , 358
pos3:
ConquerChar-360 , 323
COWindow - 490 , 054
per *** = windowx-32 windowy-16
per coy = windowx-32 windowy-16
I tried to figure out how much does the cowindow position changes to where i wana click based on teh change in x and the change in y of the character position relatively. I think i have it figured out up in the code there but I don't know how to make up a formula for it and incorporate into a GUI that will then click on the spot I want. ANy help will be greatly appreciated.
|
|
|
01/21/2009, 12:39
|
#2
|
elite*gold: 20
Join Date: Mar 2007
Posts: 2,444
Received Thanks: 1,067
|
Evan Lim knows more about the Conquer Coord system than myself. Plus I dont really know AHK too well. I can translate a few things through my brain, but not a lot.
Evan Lim is one of the few who keeps in contact with Evanxxxm who made the boundary function. Maybe he could get an explanation of how the coord system works from evanxxxm?!
If I understand how something works, ill be glad to help you out with how the concept could run and how it would look in a script.
Hiyoal
|
|
|
01/21/2009, 13:21
|
#3
|
elite*gold: 0
Join Date: Jul 2006
Posts: 396
Received Thanks: 473
|
Quote:
Originally Posted by Pr3shure
Hi all, I am having trouble creating a GUI with AutoHotKey.
What I am trying to do is make a simple GUI that says Enter Player Coordinates and it has 2 spots to put the x and the y coordinates of the player. Then I would like to use the entered coordinates and translate them into the position that I want to click on the cowindow, which depends on the initial position entered. I haven't figured out how to convert the coordinates in order for the bot to click at the right spot given the initial coordinates but I have recorded the position on the screen I want to click based on my chars position. Hope This isn't too confusing but here is what I mean:
Code:
pos1:
ConquerChar-360 , 313
COWindow - 163 , 215
pos2:
ConquerChar-351 , 313
COWindow - 456 , 358
pos3:
ConquerChar-360 , 323
COWindow - 490 , 054
per cox = windowx-32 windowy-16
per coy = windowx-32 windowy-16
I tried to figure out how much does the cowindow position changes to where i wana click based on teh change in x and the change in y of the character position relatively. I think i have it figured out up in the code there but I don't know how to make up a formula for it and incorporate into a GUI that will then click on the spot I want. ANy help will be greatly appreciated.
|
this is a nice way to make guis
SmartGUI Creator 4.0
and ur trying to make a GUI that u type in co'ords and it sends those co'ords as click on ur co window ? >.> um
what about
Code:
Gui, Add, GroupBox, x-4 y-3 w140 h170 , GroupBox
Gui, Add, Button, x16 y17 w110 h30 , SendClick
Gui, Add, Button, x16 y67 w110 h30 , SendRightClick
Gui, Add, Text, x6 y117 w120 h40 +Center, Ctrl+q to set mouse co'ords
Gui, Show, x255 y131 h173 w141, Clicker
Return
GuiClose:
ExitApp
^q::
MouseGetPos, MouseX, MouseY
return
ButtonSendClick:
Click %MouseX%,%MouseY%
return
ButtonSendRightClick:
Click right %MouseX%,%MouseY%
return
After reading your post again I noticed that what I wrote has nothing to do with what you asked for >.>
|
|
|
01/21/2009, 16:44
|
#4
|
elite*gold: 20
Join Date: Oct 2008
Posts: 976
Received Thanks: 668
|
Pr3shure@
UPS2man figures this out already (before ELSE even exists), hopefully he can see this and lend us a hand
i will check this after class today, it should be related to sin, cos, or tan to convert 45 degrees left back to original x,y plane
as shown in the below image:
but usually to save trouble, we use another coordinate memory address in client which uses the regular x,y plane that we are familiar with:
and if ur main question is not how to produce this function but is really about the GUI problem, draw me the interface in paint or something, i can create it for u
|
|
|
01/21/2009, 21:18
|
#5
|
elite*gold: 20
Join Date: Oct 2008
Posts: 976
Received Thanks: 668
|
modify from ELSE path function, seems correct:
Code:
;character current X,Y
x1=
y1=
;target X,Y
x2=
y2=
gosub, function
return
function:
UnitVector := sqrt((x1-x2)**2 + (y1-y2)**2)
UnitX := (x2-x1) / UnitVector
UnitY := (y2-y1) / UnitVector
if ( UnitX = 0 and UnitY = 0 )
{
msgbox, same coordinate
}
else if ( UnitX > 0 and UnitY > 0 )
{
ShiftX := round( cos( acos(UnitX) - 45 * 3.14159 / 180 ) * 100 ) + 513
ShiftY := round( sin( asin(UnitY) - 45 * 3.14159 / 180 ) * 100 ) + 384
}
else if ( UnitX > 0 and UnitY < 0 )
{
ShiftX := round( cos( acos(UnitX) + 45 * 3.14159 / 180 ) * 100 ) + 513
ShiftY := round( sin( asin(UnitY) - 45 * 3.14159 / 180 ) * 100 ) + 384
}
else if ( UnitX < 0 and UnitY > 0 )
{
ShiftX := round( cos( acos(UnitX) - 45 * 3.14159 / 180 ) * 100 ) + 513
ShiftY := round( sin( asin(UnitY) + 45 * 3.14159 / 180 ) * 100 ) + 384
}
else
{
ShiftX := round( cos( acos(UnitX) + 45 * 3.14159 / 180 ) * 100 ) + 513
ShiftY := round( sin( asin(UnitY) + 45 * 3.14159 / 180 ) * 100 ) + 384
}
click %ShiftX%,%ShiftY%,0
return
|
|
|
01/21/2009, 23:57
|
#6
|
elite*gold: 0
Join Date: Jan 2009
Posts: 14
Received Thanks: 6
|
@Hiyoal thanks for atleast looking at the thread =)
Quote:
|
After reading your post again I noticed that what I wrote has nothing to do with what you asked for >.>
|
@Darkyy lol looks like it eh? No but you did help me get the basic concept for creating a GUI and that gui creator is really nice thanks.
Quote:
Originally Posted by Evan Lim
modify from ELSE path function, seems correct:
|
@Evan Lim Thanks for taking the time to search for this information. Some really nice computations but either I am entering the wrong coordinates or something is flawed in the code. The coords in co that i wana click, that is the ingame position of the spot i want to click is 349, 313. The ingame character position is 360, 313 . When I put those values in for the x1 y1 x2 y2 and try his code which is suposed to move the cursor to my desired position(349,313) based on teh character position(360,313), It doesnt point to the right spot for some reason. Can you try it on your conquer and see if it works?
@All Thanks for the help. What Im trying to do now is make it easier and make it so that when ct+q is pressed the position of the mouse is recorded and then when ctr+d is pressed a loop continues to control click in that spot. here is what i got so far but there seems to be a flaw somewhere or soemthing is wrong because i do not think its working properly:
Code:
WinGet,id, ID,[Conquer2.0]
WinActivate, ahk_id %id%
^q::
{
MouseGetPos, ShiftX, ShiftY
return
}
^d::
{
loop
{
ControlClick, x%ShiftX% y%ShiftY%,ahk_id %id%,,left,2,D
ControlClick, x%ShiftX% y%ShiftY%,ahk_id %id%,,left,,U
}
}
^r::Pause
^e::ExitApp
|
|
|
01/22/2009, 00:29
|
#7
|
elite*gold: 20
Join Date: Mar 2007
Posts: 2,444
Received Thanks: 1,067
|
One thing though...Why are you using ControlClick??
Conquer.exe has a check to detect fake clicks which then sends you to bot jail.
Hiyoal
|
|
|
01/22/2009, 01:11
|
#8
|
elite*gold: 0
Join Date: Jan 2009
Posts: 14
Received Thanks: 6
|
Quote:
Originally Posted by Hiyoal
One thing though...Why are you using ControlClick??
Conquer.exe has a check to detect fake clicks which then sends you to bot jail.
Hiyoal
|
1. Want to be able to use comp while bot runing.
2. Can just delete char and make a new one.
3. Heard that it only sends you to botjail if your controlclick in the background and it makes your character move.
|
|
|
01/22/2009, 02:06
|
#9
|
elite*gold: 20
Join Date: Oct 2008
Posts: 976
Received Thanks: 668
|
Pr3shure@
its vector direction, so even the next path point is far far away, it will keep going at that direction just like ELSE path function works
for the data u provide, the position should be at 135 degrees of ur character
and left controlclick will send u to jail within few minutes whether ur client is background or top-most active
|
|
|
01/23/2009, 06:19
|
#10
|
elite*gold: 0
Join Date: Jan 2009
Posts: 14
Received Thanks: 6
|
Quote:
Originally Posted by Evan Lim
Pr3shure@
its vector direction, so even the next path point is far far away, it will keep going at that direction just like ELSE path function works
for the data u provide, the position should be at 135 degrees of ur character
and left controlclick will send u to jail within few minutes whether ur client is background or top-most active
|
how can you get around w/o using control clicks ? i dont like the whole MouseClick function =(
|
|
|
All times are GMT +1. The time now is 14:26.
|
|