Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hello Pete

I would use a byte for the status of a ten pushbuttons from several variables like :L:AB_MPL_FD" in order to recover in an FSUIPC offset.

 

So I wrote the following LUA script :

 

if (ipc.readLvar ("L:AB_MPL_FD") == 1 then

   ipc.clearbitsUB(0X66C0,1)

else

   ipc.setbits(0X66C0,1)

end

 

This unfortunately does not work.

 

Can tell me here I am wrong.

I use masks in decimal (1,1,4,8,.....)

 

Tank you for your reply.

Raymond

 

Posted

I would use a byte for the status of a ten pushbuttons from several variables like :L:AB_MPL_FD" in order to recover in an FSUIPC offset.

 

So I wrote the following LUA script :

 

if (ipc.readLvar ("L:AB_MPL_FD") == 1 then

   ipc.clearbitsUB(0X66C0,1)

else

   ipc.setbits(0X66C0,1)

end

 

This unfortunately does not work.

 

Two errors to start with. A byte contains 8 bits, not 10. "UB" means "Unsigned Byte". You need UW (Unsigned Word).

 

   ipc.setbits(0X66C0,1)

 

isn't valid. there's no "ipc.setbits". You forgot to put the size in (UB or UW).

 

Please ALWAYS check the FSUIPC log file when developing a plug in. it would show this error.

 

Can tell me here I am wrong.

I use masks in decimal (1,1,4,8,.....)

 

 

I assume you mean 1, 2, 4, 8 ...?

 

I don't see any other than your test for setting the 1 bit, bit 0.

 

Pete

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.