FreeSpace Releases > Scripting Releases
hate how the mouse works? have i got the script for you!
Nuke:
ok youl need WMCoolmon's Pre-Commit build
and this in a scripting.tbl
--- Code: ---#Global Hooks
$GameInit:
[
--all this stuff is for multires support, for getting true width and height, and for generating factors to scale coords by
w = gr.getScreenWidth()
h = gr.getScreenHeight()
if w >= 1024 then
wf = w / 1024
else
wf = w / 640
end
if h >= 768 then
hf = h / 768
else
hf = h / 480
end
dead = 15
--mousejoy function, returns a value from -100 to 100 depending on the mouse's position
mousejoy = function(deadzone)
local X = ((io.getX() * wf) - (w/2)) * (200/w)
local Y = ((io.getY() * hf) - (h/2)) * (200/h)
if X < deadzone and X > -deadzone then X=0 end
if Y < deadzone and Y > -deadzone then Y=0 end
return X, Y
end
--generic crosshair function
crosshair = function(x,y)
gr.setColor(0,255,0,200)
gr.drawGradientLine(x+20,y+20,x+10,y+10)
gr.drawGradientLine(x-20,y+20,x-10,y+10)
gr.drawGradientLine(x+20,y-20,x+10,y-10)
gr.drawGradientLine(x-20,y-20,x-10,y-10)
end
]
$HUD:
[
mX, mY = mousejoy(dead)
gr.setColor(0,255,0,255)
gr.drawCircle(5,mX+200,mY+200)
gr.setColor(100,100,255,100)
gr.drawRectangle(100,100,300,300)
gr.setColor(128,128,0,200)
gr.drawRectangle(200-dead,200-dead,200+dead,200+dead)
mX = mX / 100
mY = -mY / 100
mZ = 0
cornholio = mn.Ships["Alpha 1"]
if cornholio:isValid() then
desrot = cornholio.Physics.RotationalVelocityMax
desrot['1'] = desrot['1'] * mY
desrot['2'] = desrot['2'] * mX
desrot['3'] = desrot['3'] * mZ
cornholio.Physics.RotationalVelocity = desrot
end
]
#End
--- End code ---
enjoy! :D
*edit*
be sure to leave the mouse off in the game settings
Taristin:
cornholio o.'.o
Nuke:
i see you like my var for alpha 1's ship object :D i still got to do a few things, like come up with some better indicaters, roll control on button 2+mousex, and the big one is to throw in some damp calculation, cause right now it ignores it. anyway when its done hopefully it will serve as a good interim solution till they implement it in c. it makes flying with a mouse a hella lot easyer.
DaBrain:
Wow... thanks man.
I told myself to be patient and wait for taylor's new control stuff, but now I don't have to use the crappy mouse control till then. I'll test it and give you some feedback. ;)
Nuke:
mint you thats the wow it worked i cant believe it quick post it version :D il have an updated version later tonight, just got the deadzone feature in, im gonna make a better looking gauge next.
Navigation
[0] Message Index
[#] Next page
Go to full version