Jump to content
Sign in to follow this  
taguilo

<m:event> question ....kind of

Recommended Posts

Guest ridgell

(L:groupn,enum) 0 == (* COULD HAVE BOOLED IT BUT THERE ARE 1-20 so i left it in for an easier read *) (M:Event) 'Leave' scmp 0 == if{ 0 (>L:BASE1, enum) 1 (>L:nrdw, enum) }(M:Event) 'LeftSingle' scmp 0 == if{ 1 (>L:BASE1, enum) 1 (>L:vclick1,enum) (L:IN_UT,bool) if{ (L:latitude,enum) (>L:ins1_lat,enum) (L:longitude,enum) (>L:ins1_lon,enum) } (L:IN_UT,bool) ! if{ (L:navmas,bool) if { (L:ins1_lat,enum) (>L:waypoint_lat,enum) (L:ins1_lon,enum) (>L:waypoint_lon,enum) } (L:navmas,bool) ! if{ 185(>K:VOR1_SET) 113.20 @radioconvert(>K:NAV2_RADIO_SET)108.10@radioconvert(>K:NAV1_RADIO_SET)405.0 @adfconvert } } since the resident gurus of the moment seem to be 'tom' and 'jan' this question is for them, as part of an ongoing set of posts.re;INS system can i get away with the long 'if'y m:event above? man is it long and ugly! i have noticed alot of code is sloppy about closeing all the '{' that are opened and for the most part with out any ill effects. if the hierachy of '{' & '}' is not crucial then the code above is doomed. in addition to the device that dials in the lat/lon (previous posts)the nav computer has a panel with 10 buttons. ( there is a high and low range which means 20 button functionality) say button 1 is pushed; then if the (L:in_out,bool)switch is '1' the dialed lat/lon are stored as wpt1.if (L:in_out,bool) is '0' then pressing the #1 button will send the wpt1 data to the GPSdll as the active waypoint, or place a pre-set bunch of data into the nav radios and adf. this depends on (L:navmas,enum) another switch determining mode.( INS vs RADIO NAV ) this code is repeated 20 times, to avoid repeating it 60 times i need to nest the conditions, or nest a buch of statements i have never seen an inside of a mouse event so the nested ifs or visibles seem my only optionyour thoughts ?

Share this post


Link to post
Share on other sites

Hi Ridgell,>>re;INS system >can i get away with the long 'if'y m:event above? man is it>long and ugly! i have noticed alot of code is sloppy about>closeing all the '{' that are opened and for the most part>with out any ill effects. if the hierachy of '{' & '}' is not>crucial then the code above is doomed. Many times if{ els{ syntax can be avoided by using "bool maths"; I cannot say this is one of those cases though. You can search the forum for a bunch of posted examples.>>this code is repeated 20 times, to avoid repeating it 60 times>i need to nest the conditions, or nest a buch of >statements >If I was you, I would try to code a set of macros to deal with repetitive code :-)>i have never seen an inside of a mouse event so the>nested ifs or visibles seem my only option>There is no chance to insert an inside a section...>>your thoughts ?>Just posted :-)Saludos,Tom

Share this post


Link to post
Share on other sites

Hi,Cannot test it, but may be a little bit more efficient:(M:Event) 'Leave' scmp 0 == if{ 0 (>L:BASE1, enum) 1 (>L:nrdw, enum) } (M:Event) 'LeftSingle' scmp 0 == if{ 1 (>L:BASE1, enum) 1 (>L:vclick1,enum) (L:IN_UT,bool) if{ (L:latitude,enum) (>L:ins1_lat,enum) (L:longitude,enum) (>L:ins1_lon,enum) } els{ (L:navmas,bool) if{ (L:ins1_lat,enum) (>L:waypoint_lat,enum) (L:ins1_lon,enum) (>L:waypoint_lon,enum) } els{ 185 (>K:VOR1_SET) 113.20 @radioconvert (>K:NAV2_RADIO_SET) 108.10 @radioconvert (>K:NAV1_RADIO_SET) 405.0 @adfconvert (>K:ADF_SET) (?) } } } Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites
Guest ridgell

d 10 * 10000 % int d 10 % r 10 / int d 10 % r 10 / int d 10 % r 10 / int 16 * + 16 * + 16 * + r 1000 < if{ (>K:ADF_LOWRANGE_SET) } els{ (>K:ADF_HIGHRANGE_SET) }} it was in there! just had the > in the macro. cut and pasted from arne's post. thanks jan, ill give it a look see, it is certainly neater.

Share this post


Link to post
Share on other sites
Guest ridgell

jan, can i use an 'els' statement ?it will not trap non qualifiers of the (M:Event) 'Leave' scmp 0 == if{....} or does the 'els' only grab from the preceeding if{} ?I never have been real clear on that.

Share this post


Link to post
Share on other sites
Guest ridgell

while i still would like answer to the 'els' if that answer is no, then i think it might be time to go to a plain and seek a different button animation! the reason for the scamp= m-event.

Share this post


Link to post
Share on other sites

Ridgell, els{ } will execute as long as the last stack's value is 0. No need to have an if{ preceeding, but no really useful without it...For example:els{ 1 2 + } will return 3 Tom

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...