Results 41 to 50 of 90
Thread: SIOC "IF" Question
-
08-19-2010, 03:14 PM #41
Re: SIOC "IF" Question
Hi,
Jim is right, boolean algebra rules dictates that, read more about that here:
http://en.wikipedia.org/wiki/Introdu...oolean_algebra
NicoLast edited by kiek; 08-22-2010 at 01:30 PM.
-
08-19-2010, 03:16 PM #42
Re: SIOC "IF" Question
Hi Jim,
Is it possible to have a SIOC IF statement without an ELSE statement? This is because, earlier in the script, I have said ELSE &REF=0. So, is there reall a need to repeat the ELSE statement? It just causes unwatned difficulties.
-
08-19-2010, 03:23 PM #43
Re: SIOC "IF" Question
-
08-19-2010, 05:18 PM #44
- Join Date
- Apr 2009
- Location
- Toronto
- Posts
- 125
Re: SIOC "IF" Question
________________________________
-
08-20-2010, 01:02 PM #45
Re: SIOC "IF" Question
Hiya Jim,
Thanks for that post. I have made an amendment to mr original script, look below:
Code:Var 7675, name REF, Link IOCARD_OUT, Output 4 // REF LED Var 7002, name OP, Link IOCARD_OUT, Output 5 // OP LED Var 9991, name OPSW, Link IOCARD_SW, Input 29, Type I // OP SW Var 8881, name REFSW, Link IOCARD_SW, Input 28, Type I // REF SW Var 9090, name Chain5, Link IOCARD_SW, Input 20 // Chain 5 Selector Var 7890, name Chain4, Link IOCARD_SW, Input 26 // Chain 4 Selector Var 7665, name Chain3, Link IOCARD_SW, Input 25 // Chain 3 Selector Var 7605, name Chain2, Link IOCARD_SW, Input 24 // Chain 2 Selector Var 7645, name Chain1, Link IOCARD_SW, Input 23 // Chain 1 Selector Var 9888, Link FSUIPC_IN, Offset $C28D, Length 1 // Cloud Precipitation Rate (1) { C0 = V9991 = 1 C1 = V8881 = 1 IF C0 OR C1 { L0 = V9888 // FSUIPC L0 = v9888 IF L0 <= 3 // First sector { IF L0 > 0 { IF &Chain1 = 1 { &REF = 1 } IF L0 > 3 { &REF = 0 OR 1 &BlinkLed = 500000 &BlinkLed = TIMER 0 -1 40 ELSE { &REF = 0 } } } } } Var 9077, name BlinkLed { L0 = MOD &BlinkLed 2 IF L0 = 0 { &REF = 0 } ELSE { &REF = 0 OR 1 } } }
- LED ONLY Lights if Precipitation is 1-3
- LED ONLY Blinks if Precipitation is MORE than 3
- LED stops blinking if turbulence drops below three
- LED is OFF if there is no Turbulence (=0)
Does my script achieve this? I think yes to all of them, with the exception of the second to last requirement (stop code).
-
08-20-2010, 04:50 PM #46
Re: SIOC "IF" Question
Jack,
Just a tip to help you:
Make sure you indent each line properly. Your scripts are very hard to read because you do not adhere to normal programming practices.
Use a fixed number of spaces to indent each block, do not use tabs. Normally one uses 2 or 4 spaces to indent a block, like this:
Code:IF condition { IF condition // two spaces at the beginning of this line, because this is the first block { statement // 4 spaces at the beginning of this line because this is a block within a block } ELSE { statement } }
Nico
-
08-20-2010, 05:02 PM #47
- Join Date
- Apr 2009
- Location
- Toronto
- Posts
- 125
Re: SIOC "IF" Question
___________________________
-
08-20-2010, 05:03 PM #48
Re: SIOC "IF" Question
Hi Nico,
Yes you are correct, I have made a few tweaks to my script and have noticed that the brackets were messy.
In other news...
I have tried the following SIOC script, and absolutely nothing happens in IOCPConsole Log, whatever the Turbulence is set to. Any ideas?
Code:Var 7675, name REF, Link IOCARD_OUT, Output 4 // REF LED Var 9888, Link FSUIPC_IN, Offset $C28D, Length 1 // Cloud Precipitation Rate (1) { L0 = V9888 // FSUIPC L0 = v9888 IF L0 <= 3 // First sector { IF L0 > 0 { &REF = 1 } IF L0 > 3 { &REF = 0 &BlinkLed = 500000 &BlinkLed = TIMER 0 -1 40 ELSE { &REF = 0 } } } } Var 9077, name BlinkLed { L0 = MOD &BlinkLed 2 IF L0 = 0 { &REF = 0 } ELSE { &REF = 0 } }
-
08-20-2010, 05:52 PM #49
Re: SIOC "IF" Question
Hi Jim,
It may not be correct, but at least I've had a go.
I've produced those three different scripts you asked for, here:
Code:Var 9888, Link FSUIPC_IN, Offset $C28D, Length 1 // Cloud Precipitation Rate (1) Var 222 { IF v9888 >= 3 { &REF = 0 &BlinkLed = 500000 // Begin value of timer &BlinkLed = TIMER 0 -1 40 } } Var 333 name BlinkLed { L0 = MOD &BlinkLed 2 IF L0 = 0 { &REF = 0 } ELSE { &REF = 1 } } Var 13 name REF Link IOCARD_OUT Output 93 // Var 9888, Link FSUIPC_IN, Offset $C28D, Length 1 // Cloud Precipitation Rate (1) Var 222 { IF v9888 <= 3 { &REF = 1 { &BlinkLed = 1 // equal to end value of timer (0) + 1 } } } Var 13 name REF Link IOCARD_OUT Output 93 // Var 222 { IF v9888 = 0 { &REF = 0 } }
-
08-21-2010, 02:07 AM #50
- Join Date
- Apr 2009
- Location
- Toronto
- Posts
- 125
Re: SIOC "IF" Question
____________________________
Similar Threads
-
"Inner Circle" HSI - SIOC DC Motors Card Script
By Boeing 747 Flyer in forum OpenCockpits General DiscussionReplies: 64Last Post: 04-21-2011, 10:59 AM -
Looking for "Below GS" and "Spoilers armed" annunciator light offset
By PeterH in forum PM General Q & AReplies: 17Last Post: 03-05-2008, 12:39 PM -
A question for "Bus Drivers"
By mpl330 in forum General Builder Questions All Aircraft TypesReplies: 2Last Post: 01-31-2008, 06:56 PM -
PM updates and a question for "proof of concept"
By pap in forum PM General Q & AReplies: 4Last Post: 01-27-2008, 06:22 AM