Page 1 of 1

Sorry nvm

Posted: Wed Feb 17, 2010 11:30 am
by Exempt
Sorry nvm

Re: Mouse position calculation problem

Posted: Wed Feb 17, 2010 1:11 pm
by Administrator

Code: Select all

x = (desX / 800) * 8.95429; -- should work
Basically, just cross multiplication of fractions.

Re: Mouse position calculation problem

Posted: Wed Feb 17, 2010 1:32 pm
by Exempt
That doesn't work because I'm turning mouse coords into ingame coords.

What i was doing is taking my current position - my destination which could be -6 through 6. If it's -4 it's would find the values needed to move my mouse to the coords -4 of my current x position.

Edit: Whats really got me confused right now is the values the mouse is using.

X: 0 - 8.95429718703558E-43
Y: 0 - 1.11671963328117E-37

Y goes from 9.9xxxxxxxxx-38 to 1.11671963328117E-37

I have no idea how to add in he E-37 calculation. I'm not that good at math.. -.-

Re: Mouse position calculation problem

Posted: Wed Feb 17, 2010 4:19 pm
by Administrator
Exempt wrote:That doesn't work because I'm turning mouse coords into ingame coords.
Then reverse what I wrote. You aren't providing ample information for me to have any idea what you're looking for.
I have no idea how to add in he E-37 calculation. I'm not that good at math.. -.-
You don't. Don't worry about it. You really don't need that kind of accuracy.

Re: Mouse position calculation problem

Posted: Wed Feb 17, 2010 5:18 pm
by Exempt
I will try it reversed, I'm not sure what that will do.

All I'm trying to do is move the mouse in sync with the in game coords

The in game coords are like xxx, yyy. If i click myself in the game i can move around 5 step on the in game coord system so if i wanted to walk 5 steps to the left of 555, I would need to walk to 560. The mouse coords use the floats i said in the last post.
Um... 555 would be the center is the screen (my player position).

What other info should i post?

Re: Mouse position calculation problem

Posted: Wed Feb 17, 2010 5:28 pm
by 3cmSailorfuku
Exempt wrote:I will try it reversed, I'm not sure what that will do.
What he did was using a positive multiplicator (To rewrite the values to your wanted value),
now you just multiplicate it with a negative value to get a lesser value of your source.

Basically he originally wrote a calculation to calculate ingame coords to screen coords, you just use a negative number. (That only works though if the screen resolution is bigger than the value you get ingame)

Re: Mouse position calculation problem

Posted: Wed Feb 17, 2010 8:44 pm
by Exempt
Yes but it doesn't even come close to moving the mouse where it should be.

Re: Mouse position calculation problem

Posted: Wed Feb 17, 2010 9:21 pm
by Administrator
Why would 555 be the center of the screen? I thought the game was 800*600. The closest resolution to what you are saying would be 1024*768, with 512 being half the width. Is that what you mean?

In this case, if you wanted to position the mouse in the center of the screen, (512 / 1024)*8.954297 = 4.477. If you write this value to memory, it should position it in the center. What happens?

Re: Mouse position calculation problem

Posted: Wed Feb 17, 2010 9:27 pm
by Exempt
555 being the center of the ingame screen, where my character is standing.

there is both ingame coords and mouse coords here.

Re: Mouse position calculation problem

Posted: Wed Feb 17, 2010 9:47 pm
by Exempt
Holy cow, I hate the maker of this game. I had an issue before with the coords because i searched 4byte for the mouse coords and it was a float. Guess what...now the mouse coords are stored as 4byte. I have it working again using the 4byte values and write to a int -.-. Thanks a bunch for the help.