The question is not on topic Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
masheen
Posts: 295
Joined: 06 Dec 2016, 14:10

The question is not on topic

27 Mar 2018, 15:24

Hi. My question is not quite on topic, but I'm sure that someone can help me.
Someone who is well versed in geometry. I tried to draw as clear as possible.
The question is what is equal to "?" from 0 to 255. I need a formula to calculate, can be directly in AHK code.
If there's not enough data to calculate, tell me about it. Sorry for my english.
Image
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: The question is not on topic

27 Mar 2018, 15:58

dfuqamireading.jpg
User avatar
masheen
Posts: 295
Joined: 06 Dec 2016, 14:10

Re: The question is not on topic

27 Mar 2018, 16:43

If something is not clear I can explain more details what I need.
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: The question is not on topic

27 Mar 2018, 23:55

Do you mean you need a number between 0 and 255?

Code: Select all

Random, var, 0, 255
MsgBox %var%
Or do you mean you want to know the Asc value of the character ? -- question mark?

Code: Select all

MsgBox % Asc("?")
Send {ASC 63}
ASC 63 would produce a ? in my system, and it should in all systems. But if not, you can change the ? to whatever number appears in the MsgBox.

If neither of these are what you are looking for, please try to explain with extra details. I am not sure how geometry relates -- geometry is often for shapes like Δ, Ο, □, and ◊.
User avatar
masheen
Posts: 295
Joined: 06 Dec 2016, 14:10

Re: The question is not on topic

28 Mar 2018, 04:47

Code: Select all

Random, var, 0, 255
MsgBox %var%
Or do you mean you want to know the Asc value of the character ? -- question mark?

Code: Select all

MsgBox % Asc("?")
Send {ASC 63}
Last edited by masheen on 29 Mar 2018, 13:00, edited 2 times in total.
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: The question is not on topic  Topic is solved

28 Mar 2018, 05:49

So it sounds like you need to find the angle between 5,10 and 20,20. Then you need to translate that geometric angle into the in-game camera angle -- this part we'd need details on.

There are two different angles you may be working with. It depends on where the origin is. In Autohotkey using ImageSearch or PixelSearch, the origin (0,0) is in the top left corner. But in many maths classes, you learn the origin is in the bottom left corner (so that you work in quadrant I).

Please excuse the terrible Paint grid: https://i.imgur.com/X3SLGpE.png

But our goal is to find θ. Whether that is Red (AutoHotkey coordinates) or Blue (traditional coordinates), the numbers would be the same -- it is the translation into in-game camera angle that differs. If I had to guess, you want the Blue coordinates. But you may have a different coordinate system altogether.

To find θ, also known as Theta, we need to use "Tangent of Opposite / Adjacent". In this case, Tan(θ)=10/15 where 10 is the change in Y (20-10) and 15 is the change in X (20-5). Solving for θ, you would use the the inverse-tangent function, also known as the arctangent, to get θ=Tan[sup]-1[/sup](10/15). In AHK, this would be written as theta:=ATan(10/15). So you could write it as theta:=ATan( (Y2-Y1) / (X2 - X1)), where Y2:=20, X2:=20, Y1:=10, X1:=5.

This will spit out an angle for you. In this case, it is presented in radians (2π to a circle, equal to 360° in a circle) and is 0.588003. Converting it to degrees, we would use degrees := radians * 360/(2*3.14159265) -- you can make the value of π as specific as you need. Anyway, this answer becomes 33.69006753.

I suggest degrees for illustrating this mapping, but you could use radians just fine -- in fact, you could take the radians answer and convert it to this game scale.

0->255 in your game should correspond with 0°->359°. We can take the radians answer, and instead of multiplying by 360, just multiply by 256. This should spit out and answer for the in-game angle you would need. If it does not, try changing the equation to theta:=ATan( (Y1-Y2) / (X1 - X2)) or flipping only the Ys around, or flipping only the Xs around.

Hopefully I am on the right track with what you are asking, and I hope my explanation was not too hard to understand.
gregster
Posts: 9029
Joined: 30 Sep 2013, 06:48

Re: The question is not on topic

28 Mar 2018, 09:46

@masheen: For me, your images are not showing (I assume it is the same for Exaskryz). Try to upload them as attachments to your post or use some image host like imgur.
User avatar
masheen
Posts: 295
Joined: 06 Dec 2016, 14:10

Re: The question is not on topic

29 Mar 2018, 08:10

Exaskryz wrote:So it sounds like you need to find the angle between 5,10 and 20,20. Then you need to translate that geometric angle into the in-game camera angle -- this part we'd need details on.

There are two different angles you may be working with. It depends on where the origin is. In Autohotkey using ImageSearch or PixelSearch, the origin (0,0) is in the top left corner. But in many maths classes, you learn the origin is in the bottom left corner (so that you work in quadrant I).

Please excuse the terrible Paint grid: https://i.imgur.com/X3SLGpE.png

But our goal is to find θ. Whether that is Red (AutoHotkey coordinates) or Blue (traditional coordinates), the numbers would be the same -- it is the translation into in-game camera angle that differs. If I had to guess, you want the Blue coordinates. But you may have a different coordinate system altogether.

To find θ, also known as Theta, we need to use "Tangent of Opposite / Adjacent". In this case, Tan(θ)=10/15 where 10 is the change in Y (20-10) and 15 is the change in X (20-5). Solving for θ, you would use the the inverse-tangent function, also known as the arctangent, to get θ=Tan[sup]-1[/sup](10/15). In AHK, this would be written as theta:=ATan(10/15). So you could write it as theta:=ATan( (Y2-Y1) / (X2 - X1)), where Y2:=20, X2:=20, Y1:=10, X1:=5.

This will spit out an angle for you. In this case, it is presented in radians (2π to a circle, equal to 360° in a circle) and is 0.588003. Converting it to degrees, we would use degrees := radians * 360/(2*3.14159265) -- you can make the value of π as specific as you need. Anyway, this answer becomes 33.69006753.

I suggest degrees for illustrating this mapping, but you could use radians just fine -- in fact, you could take the radians answer and convert it to this game scale.

0->255 in your game should correspond with 0°->359°. We can take the radians answer, and instead of multiplying by 360, just multiply by 256. This should spit out and answer for the in-game angle you would need. If it does not, try changing the equation to theta:=ATan( (Y1-Y2) / (X1 - X2)) or flipping only the Ys around, or flipping only the Xs around.

Hopefully I am on the right track with what you are asking, and I hope my explanation was not too hard to understand.

Code: Select all

Pi := 4 * atan(1)
maxCam / (2 * Pi) * (atan( (y2 - y1) / (x2 - x1) ) + 3 * Pi / 2)  ; - currentCam - vInaccuracy (inaccuracy at the option)   UPD: no need
Right? Its do you mean?
Image
Image

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Rohwedder and 55 guests