Results 1 to 5 of 5
-
05-17-2011, 12:13 PM #1
First SIOC script worked only once ?
Hi,
I wrote a very simple (not for me) script to toggle the VOR1 button on the audio panel by means of a pushbutton connected to a USB_KEYS card by shamelessly copying a script from Nico's site and adjusting it to my own needs.
var 1 name KEY Link USB_KEYS device 5
{
L0 = &KEY
IF L0 = 4
{
&FO_JoyStick64 = CHANGEBIT 0 v1 // toggle bit 0 of joystick 64
}
}
Var 2 name FO_JoyStick64 Link FSUIPC_OUT Offset $3340 Length 4
I checked in FSUIPS buttons and switches and Strange and Wonderful thing, it worked, but only once !
I could not get it to send this key again.
What have I done wrong ?
thanks
Martin
-
05-17-2011, 04:14 PM #2
Re: First SIOC script worked only once ?
Hi Martin,
That's because your code always sets bit 0 of joystick 64 to the same value, it does not toggle ( 0 -> 1 - 0 -> 1 - ...)
Try this:
Code:var 1 name KEY Link USB_KEYS device 5 { L0 = &KEY IF L0 = 4 { L1 = &X_JoyStick64 L1 = MOD L1 2 // take current value of bit 0 of joystick 64 &X_JoyStick64 = CHANGEBITN 0 L1 // toggle bit 0 of joystick 64 } } Var 2 name X_JoyStick64 Link FSUIPC_INOUT Offset $3340 Length 4
-
05-18-2011, 10:04 AM #3
Re: First SIOC script worked only once ?
ha Nico,
Thanks again. Thing is...It only works when I press the button twice...Why is that ?
martin
-
05-18-2011, 01:23 PM #4
Re: First SIOC script worked only once ?
Hi Martin,
That's defined by you in FSUIPC... Either change it over there or use this:
Code:var 1 name KEY Link USB_KEYS device 5 { L0 = &KEY IF L0 = 4 { &FO_JoyStick64 = TOGGLE 0 // toggle bit 0 of joystick 64 } } Var 2 name FO_JoyStick64 Link FSUIPC_OUT Offset $3340 Length 4
Programming is a skill, you have to start from scratch with small examples...
groeten,
NicoLast edited by kiek; 05-18-2011 at 03:30 PM.
-
05-18-2011, 01:51 PM #5
Re: First SIOC script worked only once ?
That's weird. I just defined some mouse macro's in FSUIPC.Done it many times. I can't imagine what would cause this behavior.
Undoubtedly you're right about SIOC and rest assured that I'm studying like crazy but it's tempting to start using some code in my cockpit, even though I'm not always sure how it all comes together. Don't worry, I'll get there.
I just finished the OC powerpoint presentation about SIOC and I've started on part 2 although that one is so badly translated that I'm going to do my own translation from the original Spanish.
vriendelijke groet
Martin
Hi...realize this has been a long time, but I'm heading down the path of building my own 777...
B777 Overhead Panel Design