To describe my problem, I have a spinal cord injury (paralysed fingers) and so I have a bit of a problem with WASD or arrow keys.
But my real problem is, I suck at coding.
I bought Rage and I am stuck at racing. So I tried a few glovepie scripts. The one below works best but it runs continously and I would need it to be toggled by key.
I am too stupid to add the toggle code (from the second code below) to the first glovepie script. I've tried to add it but my script refused to run.
The glovepie forum seems to be dead so I googled and found freepie.
I found freepie scripts for mouse to vjoy. But I would need mouse to wasd. And since I know next to nothing about phyton coding, I can't alter the code myself. I have to plee for help.
Could somebody point me to a freepie script (I found nothing suitable) or would be so nice to write a script similar to the first code?
I would love to stick with freepie because it is in active development.
Or could somebody alter the first code to be toggled by F12?
Thx in advance.
Code: Select all
// Mouse to WASD
// by lednerg
var.Speed = 1
var.MouseX = delta(mouse.x)
var.MouseY = delta(mouse.y)
var.WASD_Amount = sqrt((abs(var.MouseX))^2 + (abs(var.MouseY))^2) * var.Speed
var.WASD_xAng = int(MapEnsureRange(abs(arcsin(var.MouseX / var.WASD_Amount)),0,85,0,200))
var.WASD_yAng = int(MapEnsureRange(abs(arcsin(var.MouseY / var.WASD_Amount)),0,85,0,200))
if var.WASD_xAng > var.WASD_yAng {
var.WASD_a = var.WASD_xAng
var.WASD_b = var.WASD_yAng
var.WASD_abSwitch = false
else
var.WASD_a = var.WASD_yAng
var.WASD_b = var.WASD_xAng
var.WASD_abSwitch = true
}
if var.WASD_Init = false and var.WASD_Amount > 0 {
var.WASD_aC = var.WASD_a
var.WASD_bC = var.WASD_b
var.WASD_Init = true
}
if var.WASD_Amount = 0 {
var.WASD_Init = false
}
if var.WASD_bC > var.WASD_a and var.WASD_Init = true and var.WASD_AD_key = false and var.WASD_WS_key = false {
if var.WASD_aC < var.WASD_a then var.WASD_aC = var.WASD_a
var.WASD_bC = abs(var.WASD_bC - var.WASD_aC)
if var.WASD_abSwitch = false then var.WASD_WS_key = true else var.WASD_AD_key = true
}
if var.WASD_bC <= var.WASD_a and var.WASD_Init = true and var.WASD_AD_key = false and var.WASD_WS_key = false {
if var.WASD_abSwitch = false then var.WASD_AD_key = true else var.WASD_WS_key = true
var.WASD_aC = abs(var.WASD_aC - var.WASD_bC)
var.WASD_bC = var.WASD_b + var.WASD_bC
}
var.WASD_Pause = int(MapEnsureRange( 200 - var.WASD_Amount * 5000 ,125,250,0,200))
if var.WASD_AD_key = true {
key.a = var.MouseX < -.0005
key.d = var.MouseX > .0005
wait 10 ms
if var.MouseX > -.05 then key.a = false
if var.MouseX < .05 then key.d = false
wait var.WASD_Pause ms
var.WASD_AD_key = false
}
if var.WASD_WS_key = true {
key.w = var.MouseY < -.0005
key.s = var.MouseY > .0005
wait 10 ms
if var.MouseY > -.05 then key.w = false
if var.MouseY < .05 then key.s = false
wait var.WASD_Pause ms
var.WASD_WS_key = false
}
Code: Select all
////////////////////////////////////////
//Toggle from mouse to steering wheel.//
////////////////////////////////////////
if key.space then
var.mouse ++
wait 2s
endif
///////////////////
//Unlocking Mouse//
///////////////////
if var.mouse > 1 then
var.mouse = 0
Say("Mouse Unlocked")
endif
////////////////////////////////////////
//So it only works when it is toggled.//
////////////////////////////////////////
if var.mouse = true then
mouse.swallow = true
if delta(smooth(mouse.DirectInputX))<0 then
key.A=1
else key.A=0
if delta(smooth(mouse.DirectInputX))>0 then
key.D=1
else key.D=0
if delta(smooth(mouse.DirectInputY))<0
key.W=1
else key.W=0
if delta(smooth(mouse.DirectInputY))>0
key.S=1
else key.S=0
else mouse.swallow = false
endif