Bug with the MWHEEL_FORWARD and MWHEEL_BACKWARD maps?

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

Bug with the MWHEEL_FORWARD and MWHEEL_BACKWARD maps?

Postby pablosscripts » Sun Jun 16, 2019 2:06 am

When I run the following script, scrolling up OR down will output "ab". Have I done something wrong or is there a problem with the mappings?

Code: Select all
#include <keyboard.gph>
#include <mouse.gph>
 
init {
    port_connect(PORT_USB_C, PROTOCOL_HID);
    keymapping();
       mousemapping();
}
 
main {
    key_passthru();
    mouse_passthru();
 
    if(mouse_status(MWHEEL_FORWARD)) {
        key_set(KEY_A, TRUE);
    }
 
    if(mouse_status(MWHEEL_BACKWARD)) {
        key_set(KEY_B, TRUE);
    }
}


I wonder if this is the cause - both the middle click and scroll up seems to be mapped to the same index:

Image
Setup: XIM Apex, T2, K780 keyboard, G Pro Wireless mouse, SteelSeries 4HD pad, DXRacer armrest, LucidSound LS30 headset, Netduma router, Ubiquiti UniFi AP LR

My R6 script: https://youtu.be/x-9NtxyySVM
User avatar
pablosscripts
Brigadier General
Brigadier General
 
Posts: 1976
Joined: Tue Nov 24, 2015 6:27 am

Re: Bug with the MWHEEL_FORWARD and MWHEEL_BACKWARD maps?

Postby DontAtMe » Sun Jun 16, 2019 2:24 am

Code: Select all
#include <keyboard.gph>
#include <mouse.gph>
 
init {
  port_connect(PORT_USB_C, PROTOCOL_HID);
  keymapping();
  mousemapping();
}
 
main {
  key_passthru();
  mouse_passthru();
 
  if(mouse_status(MREPORT_UPDATED)){
    if(mouse_status(MWHEEL_FORWARD)  ==  1) key_set(KEY_A, TRUE);
    if(mouse_status(MWHEEL_BACKWARD) == -1) key_set(KEY_B, TRUE);
  }
}


pablosscripts wrote:I wonder if this is the cause - both the middle click and scroll up seems to be mapped to the same index:
The middle mouse button is is mapped as MBUTTON_3 not MOUSE_WHEEL.

MOUSE_WHEEL can be used as an Alternative of MWHEEL_FORWARD and MWHEEL_BACKWARD like this,
Code: Select all
  if(mouse_status(MREPORT_UPDATED)){
      //MWHEEL_FORWARD
    if(mouse_status(MOUSE_WHEEL) ==  1) key_set(KEY_A, TRUE);
      //MWHEEL_BACKWARD
    if(mouse_status(MOUSE_WHEEL) == -1) key_set(KEY_B, TRUE);
  }
User avatar
DontAtMe
Captain
Captain
 
Posts: 502
Joined: Tue Oct 02, 2018 4:49 am

Re: Bug with the MWHEEL_FORWARD and MWHEEL_BACKWARD maps?

Postby pablosscripts » Sun Jun 16, 2019 3:14 am

Thank you!!!!

What is mouse_forward and mouse_backward then? The documentation isn’t super clear
Setup: XIM Apex, T2, K780 keyboard, G Pro Wireless mouse, SteelSeries 4HD pad, DXRacer armrest, LucidSound LS30 headset, Netduma router, Ubiquiti UniFi AP LR

My R6 script: https://youtu.be/x-9NtxyySVM
User avatar
pablosscripts
Brigadier General
Brigadier General
 
Posts: 1976
Joined: Tue Nov 24, 2015 6:27 am

Re: Bug with the MWHEEL_FORWARD and MWHEEL_BACKWARD maps?

Postby DontAtMe » Sun Jun 16, 2019 3:25 am

pablosscripts wrote:Thank you!!!!

What is mouse_forward and mouse_backward then? The documentation isn’t super clear


For use when manually creating a mousemapping() function.
Code: Select all
#include <mouse.gph>
const uint8 mmap[] = {
  MOUSE_X, STICK_1_X,
  MOUSE_Y, STICK_1_Y,
 
  MWHEEL_FORWARD, BUTTON_17,
  MWHEEL_BACKWARD, BUTTON_10,
 
  MBUTTON_1, BUTTON_5,
  MBUTTON_2, BUTTON_8,
};
 
init{
  mousemapping(mmap);
}
User avatar
DontAtMe
Captain
Captain
 
Posts: 502
Joined: Tue Oct 02, 2018 4:49 am

Re: Bug with the MWHEEL_FORWARD and MWHEEL_BACKWARD maps?

Postby pablosscripts » Sun Jun 16, 2019 3:40 am

Makes sense thanks. I thought it was a limitation in the game I was playing until I realized this issue was happening in other games too.
Setup: XIM Apex, T2, K780 keyboard, G Pro Wireless mouse, SteelSeries 4HD pad, DXRacer armrest, LucidSound LS30 headset, Netduma router, Ubiquiti UniFi AP LR

My R6 script: https://youtu.be/x-9NtxyySVM
User avatar
pablosscripts
Brigadier General
Brigadier General
 
Posts: 1976
Joined: Tue Nov 24, 2015 6:27 am


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 218 guests