who can add in this script Mouse Sensetivity on the fly

GPC2 script programming for Titan Two. Code examples, questions, requests.

who can add in this script Mouse Sensetivity on the fly

Postby teddy18 » Sat Jun 20, 2020 5:16 pm

I Need Help i wannt to a adjust the sensetivity when i am in the game on the fly
if i Press A Keybord Buton Like + or Other

for hip Script

and Hip and ads
No one want help ?


Code: Select all
// INCLUDES ====================================================================
#include <keyboard.gph>
#include <mouse.gph>
 
// INITIALIZATION ==============================================================
init{
    keymapping();
    mousemapping();       
}                   
 
// MAIN SCRIPT =================================================================
main {
    key_passthru();           
    mouse_passthru();
 
    if(mouse_status(MREPORT_UPDATED)) {
        mouse_set(MOUSE_X, (int32)((fix32)mouse_status(MOUSE_X) / 95.09));
        mouse_set(MOUSE_Y, (int32)((fix32)mouse_status(MOUSE_Y) / 94.09));
    }
}


Code: Select all
#pragma METAINFO("Mouse Sens ADS", 1, 0, "teddy18")
// INCLUDES ====================================================================
#include <keyboard.gph>
#include <mouse.gph>
 
// INITIALIZATION ==============================================================
init{
    keymapping();
    mousemapping();       
}                   
 
// MAIN SCRIPT =================================================================
main {
    key_passthru();           
    mouse_passthru();
 
    if(mouse_status(MREPORT_UPDATED)) {
        if(key_status(MBUTTON_2)) {
            fix32 mx = (fix32) mouse_status(MOUSE_X);
            fix32 my = (fix32) mouse_status(MOUSE_Y);
            mouse_set(MOUSE_X, (int32) (mx / 93.17));
            mouse_set(MOUSE_Y, (int32) (my / 91.11));
        }
       else{
        mouse_set(MOUSE_X, (int32)((fix32)mouse_status(MOUSE_X) / 95.09));
        mouse_set(MOUSE_Y, (int32)((fix32)mouse_status(MOUSE_Y) / 94.09));
 
        }   
    }
}
User avatar
teddy18
Lieutenant
Lieutenant
 
Posts: 346
Joined: Sun Jul 19, 2015 4:18 pm

Re: who can add in this script Mouse Sensetivity on the fly

Postby teddy18 » Fri Jun 26, 2020 11:21 am

No body can help how have to do it ?
User avatar
teddy18
Lieutenant
Lieutenant
 
Posts: 346
Joined: Sun Jul 19, 2015 4:18 pm

Re: who can add in this script Mouse Sensetivity on the fly

Postby Scachi » Fri Jun 26, 2020 12:19 pm

This should help you with getting the basic function working first: viewtopic.php?f=26&t=15326&p=98529&hilit=pc+sensitivity#p98506

Then you just need to read the key status and alter the values on you key press, so you need to change the defines to variables in order to be able to alter them.

"key_events" from the online resource should help you with detecting the event_active alike for a key press.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany


Return to GPC2 Script Programming

Who is online

Users browsing this forum: midg3t2 and 88 guests