|
Post by leutnantwerner on Jan 15, 2017 12:34:27 GMT -5
Beautiful! If the texture mapping for the outside is the same as the others you can include the paints I did for Caribair in the release. I can't remember if I did them just for Aaharon or if I did a general release. Just let me know and I'll send them to you. Otherwise, just let me know and I'll redo them for you guys! This is just amazing! Jorge Thank you Jorge! As I wrote, the standard textures for the 440 will fit, with a little extra work around the cockpit windows and the lenghted vertical stabilizer. Cheers Bernie
|
|
|
Post by Tom/CalClassic on Jan 15, 2017 13:57:04 GMT -5
Hi,
You can't use the code used in the gauge to simply display 3 bitmaps when you are going to move a lever instead. Just won't work.
Also, in the gauge G:Var1 and G:Var2 are just placeholders for a Macro defined later in the gauge. I don't know if G: variables work in 3D code, so you probably should replace them with L: variables. Finally, you have to expand the mouse code to include the macro code (you currently have nothing happening when you click the mouse).
Something like:
<part> <Name>switch_cv340_prop1_govern</Name> <animation> <parameter> <code>(L:Prop_1_govern, number) if{ (L:Prop_1_govern, number) d 0 > if{ -- (>L:Prop_1_govern, number) 2 } els{ ++ (>L:Prop_1_govern, number) 1 } } (L:Prop_1_govern, number) if{ 50 } els{ 0 }</code> <lag>100</lag> </parameter> </animation> <mouserect> <cursor>Hand</cursor> <Tooltip_Text>PROP 1 ELECTRIC ADJUST</Tooltip_Text> <mouse_flags>LeftSingle+RightSingle</mouse_flags> <Callback_Code> (M:Event) 'LeftSingle' scmp 0 == 15 (>L:Prop_1_govern, number) (A:General eng propeller lever position:@1, part) 16384 * 500 + 16384 min (>K:PROP_PITCH@1_SET) (M:Event) 'RightSingle' scmp 0 == -15 (>L:Prop_1_govern, number) (A:General eng propeller lever position:@1, part) 16384 * 500 - 0 max (>K:PROP_PITCH@1_SET) </Callback_Code> </mouserect> </part>
This will increase using the left mouse button and decrease using the right mouse button.
Hope this provides a starting point,
|
|
|
Post by Bjoern on Jan 15, 2017 14:03:07 GMT -5
I guess I meant an OnKey statement using an L: variable, since he wants to avoid the water rudder altogether. Possible? Yup, but you're entirely dependent on the key combination being available for all users. Events have the advantage that it doesn't matter what key a user has them assigned to. No, you can't. But you're supposed to fly from the cockpit anyway. MSFS isn't a RC aircraft sim.
|
|
|
Post by leutnantwerner on Jan 16, 2017 17:32:24 GMT -5
Thanks Tom.
After some modifications (pls. see below) and houres of testing I have a good news and a bad news...
The good news is, it works, the switch is moving the propeller rev is decreasing.
The bad news is it can't execute the increment code. If I change the function order in the "Callback_Code" it only increase the rev, no decrease possible then.
Cheers Bernie
|
|
|
Post by Tom/CalClassic on Jan 16, 2017 17:40:55 GMT -5
I don't know. Perhaps remove the empty line between the two?
|
|
|
Post by Bjoern on Jan 17, 2017 12:09:24 GMT -5
The unit and animation code look weird. Is the keyframe range supposed to be 0 to 100 with 100 being "up"?
<part> <Name>switch_cv340_prop1_govern</Name> <animation> <parameter> <code>(L:Prop_1_govern, number) 50 +</code> <lag>100</lag> </parameter> </animation> <mouserect> <cursor>Hand</cursor> <!-- just for debug reason --> <Tooltip_Text>PROP 1 ELECTRIC ADJUST Percent:% %((A:General eng propeller lever position:1, percent))%!1d! </Tooltip_Text> <mouse_flags>LeftSingle+LeftRelease+RightSingle+RightRelease+Wheel</mouse_flags> <Callback_Code> (M:Event) 'LeftSingle' scmp 0 == if { 50 (>L:Prop_1_govern, number) (A:GENERAL ENG PROPELLER LEVER POSITION:1, percent) 5 + 100 min 163.83 * (>K:PROP_PITCH1_SET) }
(M:Event) 'LeftRelease' scmp 0 == if{ 0 (>L:Prop_1_govern, number) }
(M:Event) 'RightSingle' scmp 0 == if { -50 (>L:Prop_1_govern, number) (A:GENERAL ENG PROPELLER LEVER POSITION:1, percent) 5 - 0 max 163.83 * (>K:PROP_PITCH1_SET) }
(M:Event) 'RightRelease' scmp 0 == if{ 0 (>L:Prop_1_govern, number) } </Callback_Code> </mouserect> </part>
|
|
|
Post by Tom/CalClassic on Jan 17, 2017 12:20:34 GMT -5
The code is designed so that when you throw the switch to the increase or decrease position, it comes back to the center after a second or so, simulating it's spring loaded.
|
|
|
Post by leutnantwerner on Jan 18, 2017 5:28:33 GMT -5
Hi, Bjoern: That is nearly the code I tried also over the weekend. The disadvantage of the mouseflags "LeftRelease" or "RightRelease" is, that if you release the mouse while the switch is not "below" the cursor, the switch will stay in the end posions and not slide back into the middle position. I studied even Tom's writings about a similar problem years ago in the developer forum. Bjoern, I will try your code with the "percent" units tonight. Thanks Bernie
|
|
|
Post by Bjoern on Jan 18, 2017 17:34:57 GMT -5
Bernie: Try "Leave" as a mouse flag declaration and condition for the "release" event. Like this:
<part> <Name>switch_cv340_prop1_govern</Name> <animation> <parameter> <code>(L:Prop_1_govern, number) 50 +</code> <lag>100</lag> </parameter> </animation> <mouserect> <cursor>Hand</cursor> <!-- just for debug reason --> <Tooltip_Text>PROP 1 ELECTRIC ADJUST Percent:% %((A:General eng propeller lever position:1, percent))%!1d! </Tooltip_Text> <mouse_flags>LeftSingle+LeftRelease+RightSingle+RightRelease+Wheel+Leave</mouse_flags> <Callback_Code> (M:Event) 'LeftSingle' scmp 0 == if { 50 (>L:Prop_1_govern, number) (A:GENERAL ENG PROPELLER LEVER POSITION:1, percent) 5 + 100 min 163.83 * (>K:PROP_PITCH1_SET) }
(M:Event) 'RightSingle' scmp 0 == if { -50 (>L:Prop_1_govern, number) (A:GENERAL ENG PROPELLER LEVER POSITION:1, percent) 5 - 0 max 163.83 * (>K:PROP_PITCH1_SET) }
(M:Event) 'LeftRelease' scmp 0 == (M:Event) 'RightRelease' scmp 0 == or (M:Event) 'Leave' scmp 0 == or if{ 0 (>L:Prop_1_govern, number) } </Callback_Code> </mouserect> </part>
Tom: I know.
|
|
|
Post by leutnantwerner on Jan 20, 2017 4:01:08 GMT -5
Hi Bjoern,
I modified the coding like this, as you suggest:
I changed the order of the callback code, LeftSingle vs. RightSingle.
It still ends up with the execution of "RightSingle" either you press left or right mouse key.
Thanks for the kind help, but I will postpone this and use a gauge instead.
Cheers Bernie
|
|
|
Post by Bjoern on Jan 20, 2017 12:28:45 GMT -5
This should not be. Do other switches work as they're supposed to?
|
|
|
Post by Tom/CalClassic on Jan 20, 2017 19:01:39 GMT -5
Hi,
The problem is that some of the lines include if {
These should be changed to if{
(remove the space)
Hope this helps,
|
|
|
Post by Tom/CalClassic on Jan 20, 2017 19:21:50 GMT -5
Here's the code I came up with:
<part> <name>switch_cv340_prop1_govern</name> <animation> <parameter> <code>(L:Prop_1_govern, number) 50 + </code> <lag>100</lag> </parameter> </animation> <mouserect> <cursor>Hand</cursor> <!-- just for debug reason --> <Tooltip_Text>PROP 1 ADJUST (Left Click=Increase Right Click=Decrease) Percent: %((A:General eng propeller lever position:1, percent))%!1d! </Tooltip_Text> <mouse_flags>LeftSingle+LeftRelease+RightSingle+RightRelease+Wheel+Leave</mouse_flags> <Callback_Code> (M:Event) 'LeftSingle' scmp 0 == if{ -50 (>L:Prop_1_govern, number) (A:GENERAL ENG PROPELLER LEVER POSITION:1, percent) 5 + 100 min 163.83 * (>K:PROP_PITCH1_SET) }
(M:Event) 'LeftRelease' scmp 0 == if{ 0 (>L:Prop_1_govern, number) }
(M:Event) 'RightSingle' scmp 0 == if{ 50 (>L:Prop_1_govern, number) (A:GENERAL ENG PROPELLER LEVER POSITION:1, percent) 5 - 0 max 163.83 * (>K:PROP_PITCH1_SET) }
(M:Event) 'RightRelease' scmp 0 == if{ 0 (>L:Prop_1_govern, number) }
(M:Event) 'Leave' scmp 0 == if{ 0 (>L:Prop_1_govern, number) } </Callback_Code> </mouserect> </part>
|
|
|
Post by Tom/CalClassic on Jan 20, 2017 21:05:07 GMT -5
For engine 2:
<part> <name>switch_cv340_prop2_govern</name> <animation> <parameter> <code>(L:Prop_2_govern, number) 50 + </code> <lag>100</lag> </parameter> </animation> <mouserect> <cursor>Hand</cursor> <!-- just for debug reason --> <Tooltip_Text>PROP 2 ADJUST (Left Click=Increase Right Click=Decrease) Percent: %((A:General eng propeller lever position:2, percent))%!1d! </Tooltip_Text> <mouse_flags>LeftSingle+LeftRelease+RightSingle+RightRelease+Wheel+Leave</mouse_flags> <Callback_Code> (M:Event) 'LeftSingle' scmp 0 == if{ -50 (>L:Prop_2_govern, number) (A:GENERAL ENG PROPELLER LEVER POSITION:2, percent) 5 + 100 min 163.83 * (>K:PROP_PITCH2_SET) }
(M:Event) 'LeftRelease' scmp 0 == if{ 0 (>L:Prop_2_govern, number) }
(M:Event) 'RightSingle' scmp 0 == if{ 50 (>L:Prop_2_govern, number) (A:GENERAL ENG PROPELLER LEVER POSITION:2, percent) 5 - 0 max 163.83 * (>K:PROP_PITCH2_SET) }
(M:Event) 'RightRelease' scmp 0 == if{ 0 (>L:Prop_2_govern, number) }
(M:Event) 'Leave' scmp 0 == if{ 0 (>L:Prop_2_govern, number) } </Callback_Code> </mouserect> </part>
|
|
|
Post by Bjoern on Jan 21, 2017 9:41:58 GMT -5
Well spotted, Tom!
|
|