function main()WindSpeed = 10 -- Wind Speed que quieres escribir en la DATAREFendfunction OnDraw_Windows()dr_sim_Windspeed = xp.getDataref("wind_speed_kt[0]") - Aqui no estoy muy seguro por que también esta wind_speed_kt[1]wind_speed_kt[2]wind_direction_degt[0]wind_direction_degt[1]wind_direction_degt[2]get_dr_sim_Windspeed = xp.getFloat(dr_sim_Windspeed )-- The direction the wind is blowing from in degrees from true 0rth c lockwise. from 0 to 360 xp.setFloat(dr_sim_Windspeed ,WindSpeed) -- escribo la DATAREF con el Windspeed que declaro en main, en este caso 10 knots o mas facil solo hago xp.setFloat(dr_sim_Windspeed ,10)--muestro en la pantalla la DATA REF para verificar width,height = gfx.getScreenSize()gfx.setColor(0,0,0,0)gfx.drawString(string.format("Win Speed : %0.2f",get_dr_sim_Windspeed),10, height-400 ) -- Muestro con dos decimales.end
/*************************************************** Project Name: Seamax Plugin ** Version: 1.0 ** Date: (dd/mm/yyyy): 03/08/2009 ** Programmer: kha29096335 ** Plane project: Seamax plane ** Plane project developper: Javier Rollon ** Plane project web site: http://www.jrollon.com ** Compilation target: Windows ***************************************************//**************************************************//Global Constants declarationconst char * CfgFileName = "seamax.cfg";//Global Variables declarationint DelayForContinuousClickVar = 0;int DelayForContinuousClickForFlapsVar = 0;PLUGIN_API int XPluginStart( char * outName, char * outSig, char * outDesc){ XPLMPluginID ourpluginID = 0; char pluginname[255] = ""; char filepath[255] = ""; char signature[255] = ""; char description[255] = ""; char fullfilepath[255] = ""; ifstream cfgfile;//Variable input stream for read the config file char fileline[255];//Buffer to read from config file //char str[128];//Variable for debug to log purposes strcpy(outName, "Seamax_custom_controls"); strcpy(outSig, "Carlos_Esteban.plugins.seamax"); strcpy(outDesc, "The plugin manages Seamax custom controls"); //Reading of configuration parameters from file seamax,cfg //First we get our current plugin path (trough get plugin information) ourpluginID = XPLMGetMyID(); //Debug to X-Plane log //sprintf(str,"seamax.pluginID=%d\n", ourpluginID); //XPLMDebugString(str); XPLMGetPluginInfo(ourpluginID, pluginname, filepath, signature, description); //Debug to X-Plane log //sprintf(str,"seamax.filepath=%s\n", filepath); //XPLMDebugString(str); if(strcmp(filepath,"") != 0) { strncpy(fullfilepath, filepath, strlen(filepath)-7); strcat(fullfilepath, CfgFileName); cfgfile.open(fullfilepath, ifstream::in); if (!cfgfile) { //Error in file aperture. The values are set to default values from constants DelayForContinuousClickVar = DelayForContinuousClick; DelayForContinuousClickForFlapsVar = DelayForContinuousClickForFlaps; } else { //Values from config file. //First line delay for COM1 Stdby frequencies continous action cfgfile.getline(fileline,sizeof(fileline)); DelayForContinuousClickVar = atoi(fileline); //Second line delay for flaps deployment continous action cfgfile.getline(fileline,sizeof(fileline)); DelayForContinuousClickForFlapsVar = atoi(fileline); //The config file is closed cfgfile.close(); } } else { //Error in path. The values are set to default values from constants }}