Darkdiz Posted September 15, 2021 Posted September 15, 2021 HI: When trying to import a TARGET Macro file into TARGET, I'm having an issue with the KP+ key. It comes up as "Null Null", and is the only key to do this. The actual script line is: define Camera_Zoom_In KP+ There is nothing in the manual for this, I CAN use the USB code ([0x57]) but it seems weird that the KP+ key won't parse properly. I suspect it has something to do with the + sign, as that usually indicates a second key (such as L_CTL+x indicating simultaneous activation of both keys, in this case L_CTL and the x key). Of note is that KP- works fine, and in the manual, the keypad keys / * - + are not listed as special. Any ideas? Talent hits a target no one else can hit, genius hits a target no one else can detect AMD Ryzen 9 3900x CPU@4.5Ghz, ASUS ROG Crosshair VIII Dark Hero Motherboard, 64GB Corsair Venegence DDR 3200 RAM, MSI Rtx 3060 12GB GPU, MSI Rtx 4060 8GB GPU, 40" and 37" 1920x1080 Samsung Monitor, 40" 1920x1080 Sony Monitor, 1TB Seagate Firecuda M2 PCIe 4 OS SSD, 2TB Western Digital Blue M2 PCIe 3 storage SSD, 8TB Samsung 870QVO storage SSD, Western Digital Blue 1TB storage SATA, 2x Thrustmaster T16000 (LH and RH), Warthog Joy/Throttle/TPRS, 6 x Cougar MFDs (4 with Generic VGA 800x600 displays), Track IR 5 with IR Trackstar V3, Logitech G915 Tactile Keyboard, Logitech G502 Lightspeed Mouse, Logitech G935 Headset, Next Level Racing HF8 Haptic Gaming Pad, Windows 10 Pro 64-bit Soul: None (sold long ago to the MGOMU, also known as Princess)
sedenion Posted September 16, 2021 Posted September 16, 2021 (edited) 12 hours ago, Darkdiz said: HI: When trying to import a TARGET Macro file into TARGET, I'm having an issue with the KP+ key. It comes up as "Null Null", and is the only key to do this. The actual script line is: define Camera_Zoom_In KP+ There is nothing in the manual for this, I CAN use the USB code ([0x57]) but it seems weird that the KP+ key won't parse properly. The "KP+" Macro is not defined in defines.tmh, and anyway it cannot be... 12 hours ago, Darkdiz said: I suspect it has something to do with the + sign, as that usually indicates a second key (such as L_CTL+x indicating simultaneous activation of both keys, in this case L_CTL and the x key). Of note is that KP- works fine, and in the manual, the keypad keys / * - + are not listed as special. Any ideas? That's it, the "+" is an arithmetic operator, parsed as this by the interpreter/compiler. You can define the name "KP+" (the compiler shoud warn you, but it seem devs did not handled this exception), but using the name itself will cause a compile error: define KP+ USB[87] //< compile pass (but should not...) // ... MapKey(&Throttle, LTB, KP+); //< Error, the "+" is parsed as an operator and expect a right operand Notice that, the "+" indeed act as "arithmetic add", the fact that the "+" act as simultaneous activation is due to how the background program itself parse the resulting number via binary masks operations. So the LCTL+'x' expression actualy ADD numbers/numerical values (the 'x' is parsed as byte value corresponding to its ASCII value), wich result in a particular number that is later "parsed" using bit masks. The "-" character is also interpreted as "arithmetic subtract", the "KP-" does not work better than "KP+" once you actually use it. You can "define" it, but using it throw same error as with the "+". This is perfectly valid: define KPPLUS USB[87] // perfectly OK Also notice that USB is what we call an array in programmation, it simply hold numerical value that you access in order by index ( [index] )... The USB[0x57] is exactly the same as USB[87], 0x57 is simply the hexadecimal while 87 is the decimal value. Finally, the index N° 87 of the USB[] array hold the numerical value 1087, so you can shortcut all by writing this: define KPPLUS 1087 // same as USB[0x57] or USB[87] To "play" with this, you can use the "printf" function with your "main()" function tu see what variables and macro really stand for (as numerical values): printf("The value of KPPLUS actualy is : %i", KPPUS); Edited September 16, 2021 by sedenion
Darkdiz Posted September 16, 2021 Author Posted September 16, 2021 That's what I figured, the "+" sign being the progamming language for "and this key". Interesting though that the KP- function in my macro file parses correctly. I'll add the definition of KPPLUS into the file, should work then. define KPPLUS 1087 etc Thankyou for such a detailed reply Talent hits a target no one else can hit, genius hits a target no one else can detect AMD Ryzen 9 3900x CPU@4.5Ghz, ASUS ROG Crosshair VIII Dark Hero Motherboard, 64GB Corsair Venegence DDR 3200 RAM, MSI Rtx 3060 12GB GPU, MSI Rtx 4060 8GB GPU, 40" and 37" 1920x1080 Samsung Monitor, 40" 1920x1080 Sony Monitor, 1TB Seagate Firecuda M2 PCIe 4 OS SSD, 2TB Western Digital Blue M2 PCIe 3 storage SSD, 8TB Samsung 870QVO storage SSD, Western Digital Blue 1TB storage SATA, 2x Thrustmaster T16000 (LH and RH), Warthog Joy/Throttle/TPRS, 6 x Cougar MFDs (4 with Generic VGA 800x600 displays), Track IR 5 with IR Trackstar V3, Logitech G915 Tactile Keyboard, Logitech G502 Lightspeed Mouse, Logitech G935 Headset, Next Level Racing HF8 Haptic Gaming Pad, Windows 10 Pro 64-bit Soul: None (sold long ago to the MGOMU, also known as Princess)
Recommended Posts