Sorry, my posted script has the “cms.b2=js1.b1” because I assigned b2 to keystroke " \ " which is 1st detent (shoot laser) which I notice was not in your script.
When I tried your script verbatim (without my added cms.b2=js1.b1) the guns could not shoot, but the laser worked perfectly.
After many attempts, I found a solution!
I programmed a simple:
cms.b2=js1.b1;
cms.b3=js1.b1; which was what I tried originally (making both 1st detent and 2nd detent to be operated by the push of the trigger).
But,
after much playing about, I found that for the laser to stop shooting, the last keystroke it must sense is 1st detent released.
I realised that since I programmed CMS.B2 to " \ " 1st detent and CMS.B3 to " / " 2nd detent, when I checked in the Key Check of CH Ctrl Mgr, on pressing and releasing the trigger it showed:
Pressed:
Pressed: /
Released :
Released: /
That means what it sensed last is " / " 2nd detent release.
Reason being is on a single press of trigger it will ‘press’ CMS.B2 " \ " 1st detent first, then ’ press’ CMS.B3 " / " 2nd detent. Same sequence on release.
So I just swapped the keystroke for CMS.B2 to " / " 2nd detent and CMS.B3 to " \ " 1st detent.
That way, the last keystroke sensed is 1st detent release.
Problem solved!
Thank you very much for your help ewildcat.
Really admire your scripting knowledge.
Reminds me a bit about programming on GWBasic & BasicA back in the old DOS days…