Jump to content
Sign in to follow this  
Guest rkruijer

Optimize Element lines

Recommended Posts

Guest rkruijer

Do you think the following can be optimezed if you have many of these lines? (@c:NearestAirportCurrentIdent,string) 'EHAM' scmp ! if{ 1 (>L:String Value, enum) } (@c:NearestAirportCurrentIdent,string) 'EHBK' scmp ! if{ 2 (>L:String Value, enum) } (@c:NearestAirportCurrentIdent,string) 'EHEH' scmp ! if{ 3 (>L:String Value, enum) } Roelof

Share this post


Link to post
Share on other sites

Hi,This could be a good approach: (@c:NearestAirportCurrentIdent,string) sp00 sp1 :0 'EHEH' 'EHBK' 'EHAM' 3 l1 case l0 scmp l1 2 <= and if{ l1 ++ sp1 g0 }l1 2 > ! l1 ++ * (>L:String Value, enum)You can compare as much as 25 different strings with this snippet.Another approach would be neccesary in case more are needed.TomEDIT: Modified to leave (L:String Value, enum) in 0 if none of the strings matchs the varAnd if you find it rather complex, this should work ok too:c(@c:NearestAirportCurrentIdent,string) sp0l0 'EHAM' scmp ! if{ 1 }l0 'EHBK' scmp ! if{ 2 }l0 'EHEH' scmp ! if{ 3 }(>L:String Value, enum)For a few strings this seems to be more appropriate :-)

Share this post


Link to post
Share on other sites
Guest rkruijer

>Hi,>This could be a good approach:>For a few strings this seems to be more appropriate :-)Thanks Tom. I'll have a go at it and report back.c <---------------------------- Has this any meaning?(@c:NearestAirportCurrentIdent,string) sp0l0 'EHAM' scmp ! if{ 1 }l0 'EHBK' scmp ! if{ 2 }l0 'EHEH' scmp ! if{ 3 }(>L:String Value, enum)Roelof

Share this post


Link to post
Share on other sites

Hi,Yes, afaik it clears the stack, so in case of "bad" code, calc's will stop. Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites
Guest rkruijer

>Hi,>>Yes, afaik it clears the stack, so in case of "bad" code,>calc's will stop. >>Jan>>"Beatus ille qui procul negotiis..."Hi Jan,So that is what it is. The last code works really well. Didn't try the first one.Credits to Tom.Roelof

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...