AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help with math.
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
yoyowazzup
Guest





PostPosted: Wed Jul 02, 2008 2:28 pm    Post subject: Reply with quote

it does work similarly to what i need
can it hit 4 edges of a square? like in picture?
Back to top
argneo



Joined: 14 Sep 2007
Posts: 136

PostPosted: Wed Jul 02, 2008 2:30 pm    Post subject: Reply with quote

I'm sory... i don't understand what you mean... Can you be more detailed?
_________________
WoW
Back to top
View user's profile Send private message
yoyowazup
Guest





PostPosted: Wed Jul 02, 2008 2:33 pm    Post subject: Reply with quote

it hits the center of each line of square but skips edge of square
Back to top
argneo



Joined: 14 Sep 2007
Posts: 136

PostPosted: Wed Jul 02, 2008 2:37 pm    Post subject: Reply with quote

Are you using Click or Mouse click?
_________________
WoW
Back to top
View user's profile Send private message
yoyowazup
Guest





PostPosted: Wed Jul 02, 2008 2:39 pm    Post subject: Reply with quote

yes
and the problem is, farther the spiral goes (to outer), the difference between each coordinate is getting bigger, i need mouse point to go farther with same difference of coordinates
Back to top
argneo



Joined: 14 Sep 2007
Posts: 136

PostPosted: Wed Jul 02, 2008 2:44 pm    Post subject: Reply with quote

KITRD: Search for "MouseClickDrag" in the AHK help file
_________________
WoW
Back to top
View user's profile Send private message
yoyowazup
Guest





PostPosted: Wed Jul 02, 2008 2:48 pm    Post subject: Reply with quote

nonono, i know drag, here i made pic

i want coordinate to be changed from 1, 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 and so on, with 50x, 50y difference in each, and in that order in the picture
Back to top
argneo



Joined: 14 Sep 2007
Posts: 136

PostPosted: Wed Jul 02, 2008 3:54 pm    Post subject: Reply with quote

Code:
Esc::ExitApp

F1::
{
x:=-50
y:=-50
rdir:=2
udir:=2
ldir:=3
ddir:=3
MsgBox, %x%,%y%
loop
{
loop %rdir%
{
x:=x+50
MsgBox, %x%,%y%
}
rdir:=rdir+2
loop %udir%
{
y:=y+50
MsgBox, %x%,%y%
}
udir:=udir+2
loop %ldir%
{
x:=x-50
MsgBox, %x%,%y%
}
ldir:=ldir+2
loop %ddir%
{
y:=y-50
MsgBox, %x%,%y%
}
ddir:=ddir+2
}
}return


This starts at the lower left... just like your last sketch... hope it helps Smile
_________________
WoW
Back to top
View user's profile Send private message
GodlyMario



Joined: 02 Jul 2008
Posts: 39

PostPosted: Wed Jul 02, 2008 4:07 pm    Post subject: Reply with quote

not working like the sketch, its like other way spiral now Sad
Back to top
View user's profile Send private message
argneo



Joined: 14 Sep 2007
Posts: 136

PostPosted: Wed Jul 02, 2008 4:15 pm    Post subject: Reply with quote

OMG... dude... decide...

NOW I MAKE THE DEMANDS...

I want you to post JUST LIKE MY FOLLOWING EXAMPLE the first 6 coordinates
(-50|+50) ... In order...
_________________
WoW
Back to top
View user's profile Send private message
Razlin



Joined: 05 Nov 2007
Posts: 434
Location: canada

PostPosted: Wed Jul 02, 2008 4:52 pm    Post subject: Reply with quote

lol

I think what he was saying is that your script only did 4 points. he wanted it to do more. (the outer ring as well) and potentially more.
IE a mathematical loop that can do 2 5 10 or 10000 rings. (square rings)


so coord one = -50 -50
coord 2 = coord1 x 2 -coord1 x 2
coord 3 = coord2 x 2 -coord2 x 2

Somethign like that.. but my math IS wrong as you dont always do x2.
I just dont have time to figure it out.
_________________
-=Raz=-
Back to top
View user's profile Send private message
argneo



Joined: 14 Sep 2007
Posts: 136

PostPosted: Wed Jul 02, 2008 5:26 pm    Post subject: Reply with quote

Actually... its an infinite loop... the only issue is that he has to make up his mind as to what is the coordinate system and what direction he wants it to go... For instance... if i put this on paint... it would go to the opposite direction of the first image... but just because the coordinate system he provided is backwards...
_________________
WoW
Back to top
View user's profile Send private message
[VxE]



Joined: 07 Oct 2006
Posts: 1496

PostPosted: Wed Jul 02, 2008 11:31 pm    Post subject: Reply with quote

Code:
Step := 50 ; the distance between one point and the next
X := -1, Y := -1 ; beginning offset (i.e., point '0' but not the middle)
Loop 50 ; stop after this many points
{
   mark := Mod(A_Index,2) ? "X" : "Y" ; unknown
   sign := Mod(A_Index//2,2)*2-1 ; a mystery
   Loop % Ceil(A_Index/2) ; magic spell
   {
      %mark% += sign ; alien technology
      MouseClick, Left, X*Step + A_ScreenWidth//2, Y*Step + A_ScreenHeight//2 ; expelliarmus
      sleep 100 ; unfathomable
   }
}

Bust out M$Paint and see if this code does anything. If this code doesn't do exactly what you want, you can tweak it by putting conditionals within the inner loop. I recommend that you keep all positioning tweaks within the business line (that's the mouseclick in the example).

(I commented nearly every line for your convenience)
_________________
My Home Thread
More Common Answers: [1]. It's in the FAQ [2]. Ternary ( a ? b : c ) guide [3]. Post code inside [code][/code] tags !
Back to top
View user's profile Send private message
GodlyMario



Joined: 02 Jul 2008
Posts: 39

PostPosted: Thu Jul 03, 2008 5:14 am    Post subject: Reply with quote

thanks VxE for understanding my sketch Razz it works PERFECT <3 chuchu
,also thanks to argneo too for reading my ugly texts and trying Smile

i actually forgot to recommend one thing, that is the "center position" to be current mouse position, so first coordinate is offset the current mouse coordinates
Code:
MouseGetPos, PosX, PosY

this in first line
what to change offsets to? sorry i didnt understand half the math calculation Embarassed
Back to top
View user's profile Send private message
[VxE]



Joined: 07 Oct 2006
Posts: 1496

PostPosted: Thu Jul 03, 2008 10:39 am    Post subject: Reply with quote

GodlyMario wrote:
what to change offsets to?
That's why I suggested adding offsets to the line with 'mouseclick' in it. So....
Code:
; ...
MouseClick, Left, X*Step + A_ScreenWidth//2, Y*Step + A_ScreenHeight//2
; ...
is centered on the middle of the screen. Then
Code:
; ...
MouseClick, Left, X*Step + MouseX, Y*Step + MouseY
; ...
Would be centered on the (MouseX, MouseY) coordinate.

And it's not really Math math (no capital 'M'), it's just a procedure. If you want to understand it, just walk through it mentally for a couple steps.
_________________
My Home Thread
More Common Answers: [1]. It's in the FAQ [2]. Ternary ( a ? b : c ) guide [3]. Post code inside [code][/code] tags !
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group