Jump to content
Sign in to follow this  
arno

struggling with conditional display based on wind speed

Recommended Posts

Guest

Hi gang, please check this code for error. I'm trying to display one of 4 windsock models depending on wind speed. I've tried a bglc version which didn't work...because I'm weak in bglc I can't know if it was my bad bglc coding, so i tried again with scasm. This didn't work either. This scasm example was built around the idea that I'd make library objects of the 4 different cone/pole combinations, and then do a conditional call of the library object based on c74 (acknowledgement to the real brain, Arno!). The following is the api file (Sock.api) in which I make this conditional call:; --- Created by FsRegen v0.31bmif (0)Area( 5 %1 %2 1 )RotatedCall( :symbol 0 0 %5 )Jump( :endsymbl ):symbolRefPoint( 7 : 0.5 %1 %2 )Points( 0-2 0 -8-2 0 01 0 01 0 -8-1 0 -4)Poly( a 0 1 2 3 )Poly( a 0 4 3 )Return:endsymblEndAmifendArea( 5 %1 %2 22 )perspectivecall( :OBJ )shadowcall( :OBJ )jump( : ):OBJmif( %11 )refpoint( 2 :END %4 %1 %2 E= %11 v1= %10 %13 %14 )melserefpoint( 7 :END %4 %1 %2 v1= %10 %13 %14 )mifendrotatedcall( :ROT 0 0 %5 )return:ROTIfVarRange( :A1 C72 0 2 )callLibobj( 0 B0B5568 44444444 AAAAAAAA 5 )Return:A1IfVarRange( :A2 C72 3 7 )callLibobj( 0 B0B5568 44444444 AAAAAAAA 4 )Return:A2IfVarRange( :A3 C72 8 12 )callLibobj( 0 B0B5568 44444444 AAAAAAAA 3 )Return:A3IfVarRange( :A4 C72 13 20 )callLibobj( 0 B0B5568 44444444 AAAAAAAA 2 )Return:A4callLibobj( 0 B0B5568 44444444 AAAAAAAA 2 )Return:ENDreturnEndAI called this api using fssc file as follows:; ************************************************************; Scenery compiled by FS Scenery Creator 1.5.7 by Derek Leung; Scenery compiled on 5/11/03 11:57:41 PM; Scenery created by Bob Bernstein; ************************************************************Set( buf 100 )Set( areamx 64 )Set( linbuf 64 )Set( ppperr 2000 )UVar( $FSSCTEMP1 5 )Header( 1 N47:57:11.0870 N47:51:47.1128 W122:02:17.9495 W122:10:21.2607 )LatRange( N47:51:47.1128 N47:57:11.0870 )Copyright( © 2002 by Bob ); Macro 1Macro( E:FLYINGHARVMO~1GMAXLIBGMAX_ASMWINDTEE2.API N47:54:27.6746 W122:06:16.7693 20 1.0 0.0 0 0 0 0 10000 0.0 0 v2= 100 0 0 0 0 0 0 ); Macro 2Macro( E:FLYINGHARVMO~1GMAXLIBGMAX_ASMSOCK.API N47:54:29.4239 W122:06:17.6755 20 1.0 0.0 0 0 0 0 10000 0.0 0 v2= 100 0 0 0 0 0 0 )Thanks to all in advance.Bob Bernstein

Share this post


Link to post
Share on other sites
Guest

sorry for the typo, just noticed it...c74 is wind direction...c72 is wind speed...still the code looks right to me! can't be of course..B

Share this post


Link to post
Share on other sites
Guest gorchi

Hi Bob,I am doing this from head so I can't guarantee the result but maybe this would do::ROTIfVarRange( :Wind0 0 2 )IfVarRange( :Wind1 3 8 )IfVarRange( :Wind2 9 15 )IfVarRange( :Wind3 16 25 )IfVarRange( :Wind4 25 70 )Return:Wind0CallLibObj( 0 BOB5625 0abcdef 0abcdef 00000001 )Return:Wind1CallLibObj( 0 BOB5625 0abcdef 0abcdef 00000002)Return:Wind2CallLibObj( 0 BOB5625 0abcdef 0abcdef 00000003)Return:Wind3CallLibObj( 0 BOB5625 0abcdef 0abcdef 00000004)Return:Wind4CallLibObj( 0 BOB5625 0abcdef 0abcdef 00000005)ReturnAlso I would advise that You first do not try to display a windsoch but something simpler, let's say a box in different colours depending on wind speed (or library object ID).And when these conditions work properly, then do not forget having at least two objects using variable C74 in same BGL!Best regards,Goran BrumenFS Slovenija 2002 teamhttp://slovenia.avsim.net

Share this post


Link to post
Share on other sites
Guest JoeW

None of my business, Bob......But why not use the BGLPlacer program to do windsocks?Just a thought.Joe Watson

Share this post


Link to post
Share on other sites

That source looks the same to me :), only the place where the commands are is changed a bit, but the logical part (all jumps etc) looks the same to me. Should give the same result.Bob, have you also tried placing two of these macros on your field? I can't remember if the speed has the same problem as the direction. Once I have got the BGLC file back I mailed you about I'll have a second look at it.


Arno

If the world should blow itself up, the last audible voice would be that of an expert saying it can't be done.

FSDeveloper.com | Former Microsoft FS MVP | Blog

Share this post


Link to post
Share on other sites

Hi Joe,With the BGLPlacer program you can indeed place the default windsock, but I think it doesn't look really nice. Bob is trying to make his own windsock from scratch and then animate that so it responds to the wind.


Arno

If the world should blow itself up, the last audible voice would be that of an expert saying it can't be done.

FSDeveloper.com | Former Microsoft FS MVP | Blog

Share this post


Link to post
Share on other sites
Guest

Thanks for the thought, I'll try it. B

Share this post


Link to post
Share on other sites

Hi Bob.I thought I had replied, but the post went to Neverland. :)The rotation of the object(s) can be controlled by a Transformcall( I think ), instead of a RotatedCall:TransformCall( :ROT 0 0 %5 0 0000 0 0000 0 0C74 ).I'm sure Arno has worked out the library object selection within a directional wind range. If not, I'd be happy to give it a try.As we have discussed in the forum before, two objects must be in the visual display, or rotation won't work. I'm partial to using a microscopic ground poly in the same BGL, but in a different Area Structure. It uses the same refpoint as the rotating object:; -----------------------;Area( B N42:37:42.00 W088:35:58.80 22 ); IfVarRange2( : 0346 2 5 ) ; same as your large rotating object LayerCall( :_PlaceGP 8 ) Jump( : );:_PlaceGP ; places a tiny triangular groundpoly right under the rotating object.. it needs no color definition... V1 needs to be same as rotating object's; RefPoint( rel :_PlaceGPFail 0.001953125 N42:37:42.00 W088:35:58.80 V1= 400 V2= 2 ) TransformCall( :_TinyTriangle 0 0 0 0 0000 0 0000 0 0C74 );:_PlaceGPFail Return;;:_TinyTriangle; Points( 0 -1 0 -1 ; 0 1 0 -1 ; 1 0 0 1 ; 2 ); Poly( a 0 1 2 );;:_TinyTriangleReturn Return;;EndA; -----------------------You might want to peek at the default windsock with BGLPlacer, as Joe suggests, even if you decide to build your own. Just drag'n'drop the CSV file on BLGC's icon:http://forums.avsim.com/user_files/9455.jpghttp://forums.avsim.com/user_files/9456.jpgA slight breeze, and a limp sock. :)The default isn't an object.. it's hardcoded in the sim.Dick

Share this post


Link to post
Share on other sites

I think the rotation was no problem here (that's not even in the code at the moment). I have an example of a macro where the animation with the wind speed works. Bob, if it still doesn't work I can send you that macro, so you can test with that as well.


Arno

If the world should blow itself up, the last audible voice would be that of an expert saying it can't be done.

FSDeveloper.com | Former Microsoft FS MVP | Blog

Share this post


Link to post
Share on other sites
Guest

yes, adding the transformcall works fine. I have both my windtee and windsock coded with a transform call, and they rotate properly. The problem is my conditional display of various sock shapes does not work with the c72 variable.Arno, please do send the working code...thats a great way to figure it out.Bob B

Share this post


Link to post
Share on other sites
Guest

It turns out my code was NOT at fault! Its moments like this that make me laugh. I added the transformcall element to the api that I'd posted, and the windsock was changing direction with the wind but changing the windstrength in the weather drop down wasn't making the alternate code objects appear.I decided to go on to other aspects of the project and let this problem sit. After putting in some taxilines, I was just flying a pattern, when I thought to use the "realweather" download thing from Jeppeson. Imagine my surprise when I saw that the sock model was DIFFERENT! LOLFurther testing shows that changing the windstrength with the weather menu on "global" had no affect on my windsock model. BUT, changing the radio button to "local", all of a sudden, the weather windstrength was now being used as I wanted to define the object chosen for the display.Live and Learn...and what a pleasure to know that I can design my own windsock with complete functionality. Thanks again to Arno for his guidance.Bob Bernstein

Share this post


Link to post
Share on other sites

LOL, I hadn't thought of this option (although I have had similar problems myself some time ago :), ussually I do a clear all before I test a windsock and then local and global are linked).Good to hear you have your windsock working now :).


Arno

If the world should blow itself up, the last audible voice would be that of an expert saying it can't be done.

FSDeveloper.com | Former Microsoft FS MVP | Blog

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