Simple Toggle but with mouse_status
2 posts
• Page 1 of 1
Simple Toggle but with mouse_status
Hi all,
I wanted to create a simple Toggle :
If i press mouse Button 4 (not mapped in the k&m input translator), it starts to hold down r2 until i press mouse Button 4 again.
I tried it with a simple bool R2=!R2 but it's switching around very quickly and so its Not working.
Thanks for your help
Best regards
I wanted to create a simple Toggle :
If i press mouse Button 4 (not mapped in the k&m input translator), it starts to hold down r2 until i press mouse Button 4 again.
I tried it with a simple bool R2=!R2 but it's switching around very quickly and so its Not working.
Thanks for your help
Best regards
-
A1rookie - Staff Sergeant
- Posts: 13
- Joined: Mon Sep 10, 2018 5:26 pm
Re: Simple Toggle but with mouse_status
Search for "mouse_events" in the online resource
or with custom code: store the current mouse_status result of that button into a flag and change r2 only on a new press.
or with custom code: store the current mouse_status result of that button into a flag and change r2 only on a new press.
- Code: Select all
#include <mouse.gph>
bool mb4 = FALSE;
bool r2 = FALSE;
main {
if (mouse_status(MBUTTON_4) && !mb4)
{
r2 = !r2;
mb4 = TRUE;
printf("toggled: %d", r2);
}
if (!mouse_status(MBUTTON_4)) mb4 = FALSE;
}
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
2 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 131 guests