Jump to content

Carlos Garcia

X-Plane.org Vendor
  • Posts

    786
  • Joined

  • Last visited

  • Days Won

    82

Everything posted by Carlos Garcia

  1. Thanks for the link, reading right now.... Lets use Wikipedia in Spanish a lot of better for me ...
  2. Thanks for you answer Ben.... Then How I convert this number to Nautical Miles.... Sorry I not good using Lat... and Long... or I have to give the Function another Input ( other type of measure) ... Sorry I dont know how to tell in english... Regards ... Carlos
  3. Ok here is part of the code the basic Calculation code ... function OnDraw_Windows() plane_actual_position = string.format("Posicion Actual %0.2f/%0.2f", acf.getLat(), acf.getLon()) --Posicion Latitud Y longitud Actual del Avion destination = fmc.getCount() -1 -- Mira Cuantos Way points Hay en el Plan de Vuelo navaid_type, NavAid_ID_String, navaid_id, Latitude, Longitude, Altitude = fmc.getInfo(destination) plane_destination_waypoint = string.format("Posicion de Destino %0.2f/%0.2f", Latitude, Longitude) --Posicion Latitud Y longitud Del destino del avion distance = trig.distanceBetweenWorldPoints( acf.getLat(),acf.getLon(),Latitude,Longitude) * 60.1 gfx.drawString(plane_actual_position ,pc.left+10,pc.top -160) gfx.drawString(string.format("Numero de Waypoints %0.0f",destination),pc.left+10,pc.top -170) gfx.drawString(plane_destination_waypoint,pc.left+10,pc.top -180) gfx.drawString(string.format("Distancia %0.2f",distance),pc.left+10,pc.top -190) end Ok I use this Fly plan I 3 version 1 8 1 SKBO 0.000000 4.703213 -74.138626 3 BOG 11000.000000 4.846639 -74.323555 3 MQU 15000.000000 5.207222 -74.924164 3 OTU 20000.000000 7.019861 -74.709831 3 MGN 15000.000000 9.287222 -74.846947 11 KOMPI 6000.000000 9.720834 -75.156380 3 CTG 2200.000000 10.208361 -75.506081 1 SKCG 0.000000 10.443446 -75.512802 On screen Results Actual position : 4.69 / -74.12 --- > Ok SKBO Lat and long Number of waypoints : 7 -- > Ok The Number 7 is the Destination Waypoint Destination position : 10.44/-75.51 --> Ok SKCG Lat and long Distance : 0.55 -- ??? 0.55 What ..... Well the tning left if that i have to find why this Function trig.distanceBetweenWorldPoints( acf.getLat(),acf.getLon(),Latitude,Longitude) give me a 0.55 result.... Thanks Edited: to chage the Fucntion thas calculates the distanc I use 60.1; but is not right at all. have to find a better way to calculate this distance
  4. Thanks Again Mr Jim. Ok I will develop (Write) the script Code then I post the source code and test in X plane and post the results. I hope this Works. Again thanks Carlos
  5. Thanks for your answer Mr Jim. The Idea of the script is to calculate the distance between the actual plane position and the destination ( last waypoint in the Standar FMS) : When you load a Fly plan in the X plane FMS : 1) I need to count how many entries there are in the FMS. Then I have to use fmc.getCount() local destination = fmc.getCount() 2) Based on how many entries are in the FMS, now I know which is the last one so I can have the information of the last way point, LAT2 and LON2 Here I think I have to use fmc.getInfo(destination) Here I dont know how to extrac from the fmc.getInfo(destination) function only the LAT and LON I dont need the other info.... ;D HELP HERE ... ??? \ Lets say that I want to assign Latitude to a local variable do I have to do navaid_type, NavAid_ID_String, navaid_id, Latitude, Longitude, Altitude = fmc.getInfo(destination) lat1 = Latitude (i dont thnik so...) or fmc.getInfo(destination,1,5) like we do on xp.getFloatV( dataref_id, start_at, number_to_fetch )... Can you please show me the way I have to do this ??? /END HELP HERE Then I draw this info on the screen, as you show me in the last post. gfx.drawString(navaid_type .. NavAid_ID_String .. navaid_id.. Latitude .. Longitude .. Altitude, 210, 210) 3) Based on the actual position of the Plane. LAN1 and LON1. I have to calculate if a dynamic way the distance between the plane and the last WAYPOINT, Called Destination. To draw this info on the screen then I can do local plane_actual_position = string.format("%0.2f/%0.2f", acf.getLat(), acf.getLon()) gfx.drawString( plane_actual_position , 200, 200 ) LAT1 = acf.getLat() --Returns: latitude of aircraft as decimal number. LON1 = acf.getLon() --Returns: longitude of aircraft as decimal number. Then If I have LAT1, LON1, LAT2, and LON2, then i can calculte the distance between this points. Using : local distance = trig.distanceBetweenWorldPoints( lat1,lon1, lat2,lon2) I dont know about this one but If I have The Distance and the Plane Speed, then I can Calculate the ETA (Estimated Time Arrive)... Well now that I think I have the Idea, lets try to make this script Please take a look.... Thanks for Answer.... Regards Carlos Garcia
  6. Thanks Cameron, I take a look of your code. Nice I wait for the next version.
  7. Thanks For your Answer. But... Take into accunt That Im really very noob in GIZMO and Programer word. So be patience... So please can you take One minute of your time and help me with this : If this Fuction give me this Info fmc.getInfo() Returns: navaid_type, NavAid ID String(ICAO?), navaid_id, Latitude, Longitude, Altitude Eg: navaid_type, NavAid_ID_String, navaid_id, Latitude, Longitude, Altitude = fmc.getInfo( 1 ) Lets say I have this Fly Plan SKBQ to SKBO SKBQ 0 0 N10°53'22.06" W074°46'50.44" BARRANQUILLA-ARP BAQ 113.7 224 7 N10°47'48.00" W074°51'37.00" BARRANQUILLA MGN 114.1 184 91 N09°17'14.00" W074°50'49.00" MAGANGUE BAGRE 181 98 N07°39'00.00" W074°45'06.00" BAGRE OTU 115.4 180 38 N07°01'26.00" W074°42'44.00" OTU MQU 116.1 190 110 N05°12'26.00" W074°55'27.00" MARIQUITA SKBO 126 56 N04°42'05.96" W074°08'49.01" BOGOTA-ELDORADO And I want to show (print on the screen) the info From SKBO I have to use fmc.getCount() -- Number of steps programmed into the FMC. ans use the count for this STEP lets say is Step 6. or maybe if I want the current step I have to use fmc.getDisplayed() So if i use : local step = fmc.getCount() or local step = fmc.getDisplayed() -- Integer telling us which item the user is currently displaying on the FMC. Then How I can see this Info in the screen ?? Do I have to use this ? I know this is Wrong, but here is where I need your HELP ;D... local info = string.format("%0.2f",fmc.getInfo() ) gfx.drawString(local, 200, 200 ) Remeber : Im learning, making basic BABY Steps... And If This Is not a EASY task then please Tell me And When I can learn more About GIZMO I will return to try make this Script work later when I have the Knowledge. Kinds Regard... Carlos
  8. Where I can find More info about this API function: fmc.getInfo() Returns: navaid_type, NavAid ID String(ICAO?), navaid_id, Latitude, Longitude, Altitude Eg: navaid_type, NavAid_ID_String, navaid_id, Latitude, Longitude, Altitude = fmc.getInfo( 1 ) How can I print this info in the screen.... ? so I can see the info in the First and last fmc Waypoint in the FMS (here I think I have to use fmc.getCount() ) The Idea, is to show the distance between two ways points maybe the Departure Point and The Arrive point thats its programed in the GPS of the plane. I have this formula in PHP thanks to Paul Glanville, http://www.gkpnet.net/x-plane/Resources/xpwp.php to calculate distance betwen 2 POINTS $lat, $lon, $lat1, $lon1. $rlat = deg2rad( $lat ); $rlon = deg2rad( $lon ); $rlat1 = deg2rad( $lat1 ); $rlon1 = deg2rad( $lon1 ); $drad = acos( ( sin($rlat)*sin($rlat1) ) + ( cos($rlat)*cos($rlat1)*cos($rlon-$rlon1) ) ); $dist = rad2deg( $drad ) * 60.0; print "\n lat=$lat lon=$lon lat1=$lat1 lon1=$lon1 dist=$dist <br>"; But have to find how to take this way point lat and lon from the GPS. Then when have this distance and based on actual plane Speed ( not sure what speed to use IAS, TAS, GS) maybe the ground Speed is the better choice. We can Calculate the ETA ( estimated time Arrive) Thanks Carlos
  9. "Bug fixed. timer.reset( timer_handle ) now works - the interval is reset and the code starts to run again" Hi Ben, is the "Bug" (I don say is a "BUG" Im using your words in the post, I can not tell the difference between an bug and a lion) is fixed, do I have to re download Again GIZMO or is Fixed in the next Version... Sorry to ask but I not very clear about it... How this BUG fixes work... And maybe please a little Example how this timer Works... for Noobs like me.... Thanks Carlos
  10. BEN, sorry I know this is Out of Topic and GIZMO related... Ok I download and test it, The software is very good Track my Face very good, even that you say "the face detection is limited by seeing both eyes at once" (I only have One Eye :'( Pirate Stuff) LOL Joking... ;D Even If I get out of the camera Scope, then return and the track is Ok again. But I have to use Pilot view to work... What X Plane Configuration do I have to make to this work without using pilot view ? Thanks Carlos
  11. Good morning Arnaud, and Ben. Are you talking about FACETRACKNOIR ? , http://facetracknoir.sourceforge.net/home/default.htm TrackIr needs Sandy Plug In, does this one needs this plug in too ? I use FACETRACK V2.2 (needs Sandy Plug In) but this LED thing its going to make me MORE crazy.... ;D Thanks Carlos
  12. Right ??? after a few minutes ( 5 to 8 Minutes ) X Plane Crash... Says something about Visual C or something error... LOL this particles are Good Ben ... have many possibilities for future development.... Maybe in next Build.....
  13. Hi arno Try this example ( I dont know this is what you want) Work good. Is from Mr Ben Rusell look Here http://forums.x-plane.org/index.php?showtopic=48592 map_texture = gfx.newTexture() puff_texture = gfx.newTexture() gfx.loadTga( puff_texture, xp.getAircraftFolder() .. "puff.tga" ) gfx.setTerrainMapMode_Topographic() function main() speed = acf.getIAS() -- get speed in meters per second if( speed < 10 )then speed = 10 elseif( speed > 1000 )then speed = 1000 end gfx.setTerrainMapOption_Range( speed ) --map will now zoom with speed gfx.bakeTerrainMap( map_texture ) end function OnDraw_Gauges() gl.PushMatrix() --gl.Translate( 735, 60, 0 ) --move across the panel texture, 735 px right, 60 up gl.Translate( 735, 300, 0 ) --turn texturing on gfx.setState( 0, --fog off 1, --1 tex unit 0, --no lighting 1, --alpha test on 1, --alpha blend on 0, --depth test off 0 --depth write off ) gfx.useTexture( map_texture ) gl.Color( 0.75, 0.75, 0.75, 0.75 ) --gray, 75% opaque gl.Begin('QUADS') gl.TexCoord(0,1); gl.Vertex(0,0,0) gl.TexCoord(0,0); gl.Vertex(0,128,0) gl.TexCoord(1,0); gl.Vertex(128,128,0) gl.TexCoord(1,1); gl.Vertex(128,0,0) gl.End() gl.PopMatrix() end function init_particles() local mist_count = 2000 local mist_life = 10 local mist_birth_rate = 1 local texture = puff_sprite local size=1 local color = {1, 0, 0, 0.5} local scale_rate = 1 local emax = 2 local emin = 0.1 local gravity = 0 local left_tip_particles_enabled = true if(left_tip_particles_enabled)then ph_left = particles.new() particles.setCount( ph_left, mist_count ) particles.setLife( ph_left, mist_life ) --life span in seconds particles.setBirthRate( ph_left, mist_birth_rate ) particles.setTexture( ph_left, puff_texture ) --212 = black particle, 224 aurora, particles.setSize( ph_left, size ) --size at birth along an edge particles.setColor( ph_left, color[1],color[2],color[3],color[4] ) particles.setScaleRate( ph_left, scale_rate ) particles.setEnergyMin( ph_left, emin ) particles.setEnergyMax( ph_left, emax ) particles.setGravity( ph_left, gravity ) particles.setType_Spherical( ph_left ) particles.start( ph_left ) --particles.setDisabled( ph_left ) logging.debug("Started particles: ph_left") end end init_particles() function OnDraw_World() --logging.debug("Drawing particles..") x,y,z,p,r,h = gfx.getAircraftPositionGL() if( not xp.getPaused() )then if( ph_left ~= nil )then particles.setColor( ph_left, math.random(),math.random(),math.random(),math.random() ) particles.setOrigin(ph_left, x, y+1, z ) end end end Carlos Garcia
  14. Hi pete, Hi Arno, hi Mr Ben Rusell.... Sorry... I will try again... Well .... here is My first complete Gizmo Script, uses part of the code from Ben Rusell Mini map. Im walking ... then Run.... When Everything is All right then to my FLARE plug in .... I have to read a lot about Airplane Aerodynamics.... and learn basic X plane Stuff. About this script what I have to learn... how to display every engine N1, N2 and display in the screen.... I think is a vector.... Have to read more about it.. and how to display each value. The code popupMiniMap_coords = { top = 150, left = 50, width = 200, height = 128, testClick = function( self, x, y ) if( ( x > self.left) and ( x < (self.left + self.width)) and ( y < self.top) and ( y > (self.top - self.height)) )then return true else return false end end } function main() -- nothing here end function OnDraw_Windows() dr_sim_total_weight = xp.getDataref("sim/flightmodel/weight/m_total") g_total_weight = xp.getFloat(dr_sim_total_weight) * 2.20462262 get_ALTG_ft = acf.getAltAgl() * 3.28 -- Aircraft altitude above ground level in meters. Then meter to Ft get_altA_ft = acf.getAltMsl() * 3.28 -- Aircraft altitude above mean-sea-level in meters. Then meter to Ft get_IAS=acf.getKIAS() -- Aircraft Indicated Air Speed in Knots. VSI = xp.getDataref("sim/cockpit2/gauges/indicators/vvi_fpm_pilot") get_VSI = xp.getFloat(VSI) get_heading = acf.getHeading() temperature = xp.getDataref("sim/weather/temperature_le_c") -- The air temperature at the leading edge of the wings in degrees C. get_temperature = xp.getFloat(temperature) N1 = xp.getDataref("sim/cockpit2/engine/indicators/N1_percent") get_N1 = xp.getFloatV(N1,1,4) N2 = xp.getDataref("sim/cockpit2/engine/indicators/N2_percent") get_N2 = xp.getFloatV(N2,1,4) fuel = xp.getDataref("sim/flightmodel/weight/m_fuel_total") get_fuel = xp.getFloat(fuel) * 2.20462262 way_point_distance = xp.getDataref("sim/cockpit2/radios/indicators/gps_dme_distance_nm") get_way_point_distance = xp.getFloat(way_point_distance) local pc = popupMiniMap_coords gfx.texOff() gfx.setColor(1,0,0,1) --draw a box, coordinates are left, top, width, height gfx.drawBox( pc.left, pc.top-pc.height, pc.width, pc.height ) gfx.setColor(0,0.1,0,0.5) gfx.drawFilledBox( pc.left, pc.top-pc.height, pc.width, pc.height ) width,height = gfx.getScreenSize() gfx.setColor(1,1,1,1) gfx.drawString(string.format("IAS Knots: %0.0f",get_IAS),pc.left+10,pc.top -10 ) gfx.drawString(string.format("Heading: %0.0f",get_heading),pc.left+10,pc.top -20) gfx.drawString(string.format("Altitude Ft AGL: %0.0f",get_ALTG_ft),pc.left+10,pc.top -30 ) gfx.drawString(string.format("Altitude Ft AMSL: %0.0f",get_altA_ft),pc.left+10,pc.top -40 ) gfx.drawString(string.format("Vertical Speed Ft/min: %0.0f",get_VSI),pc.left+10,pc.top -50 ) gfx.drawString(string.format("Total Weight Lbs: %0.0f",g_total_weight),pc.left+10,pc.top -60) gfx.drawString(string.format("Temperature C: %0.0f",get_temperature),pc.left+10,pc.top -70) gfx.drawString(string.format("N1: %0.1f",get_N1 ),pc.left+10,pc.top -80) gfx.drawString(string.format("N2: %0.1f",get_N2),pc.left+10,pc.top -90) gfx.drawString(string.format("Fuel: %0.0f",get_fuel),pc.left+10,pc.top -100 ) gfx.drawString(string.format("Way Point nm: %0.1f",get_way_point_distance),pc.left+10,pc.top -110 ) end last_mx = -1 last_my = -1 drag_in_progress = false function OnMouseClick() --sound.say("click: " .. mouse.click.x .. " / " .. mouse.click.y .. " / " .. mouse.click.e ) --sound.say( popupMiniMap_coords:testClick(mouse.click.x,mouse.click.y) ) --events; 1 = Down 2 = Drag 3 = Up if( popupMiniMap_coords:testClick(mouse.click.x,mouse.click.y) or drag_in_progress )then if( last_mx == -1 )then last_mx = mouse.click.x last_my = mouse.click.y end --sound.say("eat click" .. mouse.click.e) --test to see if the user is dragging if( mouse.click.e == 2 )then drag_in_progress = true --the user is mouse dragging inside our bounds. --calculate the mouse movement deltas and apply them to our origin point if( mouse.click.x ~= last_mx )then local mxd = mouse.click.x - last_mx popupMiniMap_coords.left = popupMiniMap_coords.left + mxd end if( mouse.click.y ~= last_my )then local myd = mouse.click.y - last_my popupMiniMap_coords.top = popupMiniMap_coords.top + myd end --store the last known mouse location last_mx = mouse.click.x last_my = mouse.click.y else drag_in_progress = false if( mouse.click.e == 3 )then --mouse was released, reset vars last_mx = -1 last_my = -1 end end return 1 else --sound.say("ignore click") end end Carlos Garcia
×
×
  • Create New...