FreePie Basic Mouse ,Basic Value Help(Mouse.getReleased )

Official forum for open source FreePIE discussion and development.
Post Reply
Superseani2
One Eyed Hopeful
Posts: 3
Joined: Tue Jan 16, 2018 6:51 pm

FreePie Basic Mouse ,Basic Value Help(Mouse.getReleased )

Post by Superseani2 »

Hi!, I have been stunned by how much Freepie is good... However i dont speak to it properly yet :(

I am Using TrackIR to Simulate Mouse mouvement, Which Works GREAT
But i would need some specification on a couple hints .

:::PROBLEM 1:::
Right now, In FPS GAME. When i ::hold F7::, the script start perfectly and stops when i ::release F7::
-i can also Toggle it for testing Purposes with ::getPressed F12::.

-- I would like to Make this ::hold F7 ::but Instant , So i would rather just need to Click F7 once , rather then : Holding the hotkey, moving my head(Yaw,pitch,TrackIR) and release the Hotkey.
I TRYED, replacing :

hotkey = keyboard.getKeyDown(Key.F7)
with :
hotkey = keyboard.getPressed(Key.F7)
See Code Down Below
Freepie RUNS the script but it just doesnt seems to work as i intended .

=-=: I would need so when i :: Press F7 ::, the script Starts updating mouse.deltaX/Y, then Briefly after 100Millisecgond, set YAW and PITCH to 0(in my case 2.3 and 3)

::::::::::::::::::


::::PROBLEM 2::::
-- I would like to :: Right Click :: once, when i also hit once the :: F7 Key ::
SO i tryed :

Code: Select all

mouse.rightButton = Keyboard.getKeyUp(Key.F7)
But instead when i RELEASE the ::F7 key::
it seems to right click and hold , until i Re-right click.


:::::The Code :::::

Code: Select all

#Use F12 to toggle on/off Or HOLD right mouse to activate Script 
#(Good for FPS GAMES.)
def update():
    yaw = trackIR.yaw
    pitch = trackIR.pitch

    deltaYaw = filters.delta(yaw)
    deltaPitch = filters.delta(pitch)

    if (enabled or hotkey):
        mouse.deltaX = deltaYaw*multiplyX
        mouse.deltaY = -deltaPitch*multiplyY
        
        
if starting:
    enabled = False
    multiplyX = 4
    multiplyY = 5
    trackIR.update += update


hotkey = keyboard.getKeyDown(Key.F7)
toggle = keyboard.getPressed(Key.F12)
	
if toggle:
    enabled = not enabled
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Jabberwock
Cross Eyed!
Posts: 197
Joined: Mon Mar 02, 2015 3:58 pm

Re: FreePie Basic Mouse ,Basic Value Help(Mouse.getReleased

Post by Jabberwock »

For the first problem you might want to use a timer, as described here:
https://www.mtbs3d.com/phpbb/viewtopic. ... 39&t=22533

As for the second problem, GetKeyUp is not equivalent to GetKeyPressed, but to GetKeyDown. That is, it is always true when the key is released. Unfortunately, there is no function for GetKeyReleased, that would turn it momentarily true when the key is released. So you need to use a global variable - if it is not set to true when the key is up, execute your commands and set it to true (and to false when the key is pressed).
Superseani2
One Eyed Hopeful
Posts: 3
Joined: Tue Jan 16, 2018 6:51 pm

Re: FreePie Basic Mouse ,Basic Value Help(Mouse.getReleased

Post by Superseani2 »

Jabberwock wrote:So you need to use a global variable - if it is not set to true when the key is up, execute your commands and set it to true (and to false when the key is pressed).
So... simply add that Center(yaw/pitch=0) function to the False State , Inverte the True and False, so when i press it = False

Hai Thats GENIUS!
Superseani2
One Eyed Hopeful
Posts: 3
Joined: Tue Jan 16, 2018 6:51 pm

Re: FreePie Basic Mouse ,Basic Value Help(Mouse.getReleased

Post by Superseani2 »

Superseani2 wrote:
Jabberwock wrote:So you need to use a global variable - if it is not set to true when the key is up, execute your commands and set it to true (and to false when the key is pressed).
So... simply add that Center(yaw/pitch=0) function to the False State , Inverte the True and False, so when i press it = False

Hai Thats GENIUS!
Post Reply

Return to “FreePIE”