#asumiendo que el dataref es un flotante (ratio) de 0 a 1; con pasos de 0.1valorDataref = dataref()#incrementoif botonXpulsado: if valorDataref < 1: valorDataref += 0.1 escribeDataref(dataref(valorDataref))#disminucionif botonYpulsado: if valorDataref > 0: valorDataref -= 0.1 escribeDataref(dataref(valorDataref))
-- test commands.luagHeadPositionXDataRef = XPLMFindDataRef("sim/aircraft/view/acf_peX")create_command( "FlyWithLua/ViewPoint/MoveRight", "Move Right", "", "XPLMSetDataf(gHeadPositionXDataRef, XPLMGetDataf(gHeadPositionXDataRef) + .1)", "XPLMSetDataf(gHeadPositionXDataRef, XPLMGetDataf(gHeadPositionXDataRef) + .1)")create_command( "FlyWithLua/ViewPoint/MoveLeft", "Move Left", "", "XPLMSetDataf(gHeadPositionXDataRef, XPLMGetDataf(gHeadPositionXDataRef) - .1)", "XPLMSetDataf(gHeadPositionXDataRef, XPLMGetDataf(gHeadPositionXDataRef) - .1)")