Page 1 of 1

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

Posted: Tue Jan 16, 2018 7:25 pm
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
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

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

Posted: Wed Jan 17, 2018 10:47 am
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).

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

Posted: Sat Jan 20, 2018 4:14 pm
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!

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

Posted: Sat Jan 20, 2018 4:15 pm
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!