Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

I found a Mouse Script, But I need it converted. (RGSS conversion)

Hi, I don't know if this is possible, but I found this script, that looked swell.

Code:
{
var mm,dX,dY,dZ,uX,uY,uZ,vX,vY,vZ,mX,mY,mZ, width, height, tFOV;
dX = argument3-argument0;
dY = argument4-argument1;
dZ = argument5-argument2;
mm = sqrt(dX*dX+dY*dY+dZ*dZ);
dX /= mm;
dY /= mm;
dZ /= mm;
uX = argument6;
uY = argument7;
uZ = argument8;
mm = uX*dX+uY*dY+uZ*dZ;
uX -= mm*dX;
uY -= mm*dY;
uZ -= mm*dZ
mm = sqrt(uX*uX+uY*uY+uZ*uZ);
uX /= mm;
uY /= mm;
uZ /= mm;
// v = u x d
vX = uY*dZ-dY*uZ;
vY = uZ*dX-dZ*uX;
vZ = uX*dY-dX*uY;
tFOV = tan(argument9*pi/360);
uX *= tFOV;
uY *= tFOV;
uZ *= tFOV;
vX *= tFOV*argument10;
vY *= tFOV*argument10;
vZ *= tFOV*argument10;
width = window_get_width();
height = window_get_height();
mX = dX+uX*(1-2*mouse_y/height)+vX*(2*mouse_x/width-1);
mY = dY+uY*(1-2*mouse_y/height)+vY*(2*mouse_x/width-1);
mZ = dZ+uZ*(1-2*mouse_y/height)+vZ*(2*mouse_x/width-1);
mm = sqrt(mX*mX+mY*mY+mZ*mZ);
global.mouse_dx = mX/mm;
global.mouse_dy = mY/mm;
global.mouse_dz = mZ/mm;
}

Is it possible to convert this to RGSS(2?)
Its a Mouse system.
(If this is placed wrong, please move it. I couldn't find the right spot to place it  :dead:)
#Credits to The Ultimate Pronoun on yoyogames.com
 

poccil

Sponsor

There's little clue on what this script does.  It apparently takes 10 arguments ("argument1", "argument2", etc.) but there is no clue on what they do.

The result appears to be saved in "global.mouse_dx", "global.mouse_dy", and "global.mouse_dz".  I would guess that they are the 3D position of the mouse on the screen.

The call "window_get_width()" corresponds to 640 in RGSS, and "Graphics.width" in RGSS 2.
The call "window_get_height()" corresponds to 480 in RGSS, and "Graphics.height" in RGSS 2.

"mouse_x" and "mouse_y" refer to the mouse's current position on the game window.

And that's all I can guess about the script.  Without any details on the arguments, however, the script is useless.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top