Possible to Toggle Freepie Script On/Off in-game?

Official forum for open source FreePIE discussion and development.
Post Reply
Blamm-0
One Eyed Hopeful
Posts: 6
Joined: Sat May 30, 2015 4:28 pm

Possible to Toggle Freepie Script On/Off in-game?

Post by Blamm-0 »

I play IL-2 Sturmovik with a Freepie script (to use mouse as joystick). I would like a hotkey to totally disable the mouse-joystick so I can briefly mouselook without steering the plane.

Is there any way to code a Freepie script so as to suspend its operation and then re-enable it, while in-game?

Here's the script I'm using by the way (I have no idea where it came from)

from System import Int16

if starting:
system.setThreadTiming(TimingTypes.HighresSystemTimer)
system.threadExecutionInterval = 5 # loop delay
max = Int16.MaxValue*0.5+2
min = -Int16.MaxValue*0.5+1
x = 0.0
y = 0.0
sen = 58 # sensitivity


x += mouse.deltaX * sen
y += mouse.deltaY * sen

if (x > max):
x = max
elif (x < min):
x = min

if (y > max):
y = max
elif (y < min):
y = min

if keyboard.getKeyDown(Key.LeftControl) and mouse.middleButton: # centering
x = 0
y = 0

vJoy[0].x = x
vJoy[0].y = y
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Possible to Toggle Freepie Script On/Off in-game?

Post by CyberVillain »

Something like this?

Code: Select all

if starting:
	x = 0
	enabled = True
	
if enabled:
	x = x + 1
	diagnostics.watch(x)
	
if keyboard.getPressed(Key.F1):
	enabled = not enabled
Post Reply

Return to “FreePIE”