Orbiter-Forum  

Go Back   Orbiter-Forum > Orbiter Addons > Orbiter Lua Scripting
Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

Orbiter Lua Scripting Find support, share snippets and general discussion around using the Lua engine in Orbiter.

Reply
 
Thread Tools
Old 10-22-2017, 02:10 PM   #16
kuddel
Donator
Default

Another batch of vessel functions added (slowly but steadily the vessel interface nears completion)
kuddel is offline   Reply With Quote
Thanked by:
Old 10-25-2017, 09:33 PM   #17
kuddel
Donator
Default

Another batch of vessel functions added.

A question to those who have experience in writing Lua C API (martin?):
Do you have any recommendation how to implement "reference types" (I mean structures that can be changed anytime and will immediately effect the Orbiter-Core.)
Like the BEACONLIGHTSPEC structure used with VESSEL::AddBeacon()
I think "metatables" and "__index" and all its voodoo ( ) is the way to go, but I don't feel I could do this at the moment...
A working (AddBeacon) C++ example would be perfect

---------- Post added 25-10-17 at 00:05 ---------- Previous post was 24-10-17 at 23:47 ----------

....aaaand as I wrote a script for myself to clearly overview all missing / not missing VESSEL API methods. Here's the result:
Code:
[+] ActivateNavmode                         set_navmode
[+] AddAnimationComponent                   add_animationcomponent
[-] AddAnimComp                             -- deprecated/obsolete
[-] AddAttExhaustMode                       -- deprecated/obsolete
[-] AddAttExhaustRef                        -- deprecated/obsolete
[ ] AddBeacon
[+] AddExhaust                              add_exhaust
[-] AddExhaustRef                           -- deprecated/obsolete
[+] AddExhaustStream                        add_exhauststream
[+] AddForce                                add_force
[+] AddMesh                                 add_mesh
[ ] AddParticleStream
[+] AddPointLight                           add_pointlight
[ ] AddReentryStream
[+] AddSpotLight                            add_spotlight
[+] AttachChild                             attach_child
[+] AttachmentCount                         get_attachmentcount
[ ] ClearAirfoilDefinitions
[+] ClearAttachments                        clear_attachments
[-] ClearAttExhaustRefs                     -- deprecated/obsolete
[ ] ClearBeacons
[ ] ClearControlSurfaceDefinitions
[ ] ClearDockDefinitions
[-] ClearExhaustRefs                        -- deprecated/obsolete
[+] ClearLightEmitters                      clear_lightemitters
[+] ClearMeshes                             clear_meshes
[+] ClearPropellantResources                clear_propellantresources
[+] ClearThrusterDefinitions                clear_thrusters
[ ] ClearVariableDragElements
[ ] CopyMeshFromTemplate
[ ] Create
[ ] CreateAirfoil
[ ] CreateAirfoil2
[+] CreateAirfoil3                          create_airfoil
[+] CreateAnimation                         create_animation
[+] CreateAttachment                        create_attachment
[ ] CreateControlSurface
[ ] CreateControlSurface2
[+] CreateControlSurface3                   create_controlsurface
[+] CreateDock                              create_dock
[+] CreatePropellantResource                create_propellantresource
[+] CreateThruster                          create_thruster
[+] CreateThrusterGroup                     create_thrustergroup
[ ] CreateVariableDragElement
[+] DeactivateNavmode                       set_navmode
[+] DefSetState                             defset_status
[+] DefSetStateEx                           defset_status
[+] DelAirfoil                              del_airfoil
[+] DelAnimation                            del_animation
[+] DelAnimationComponent                   del_animationcomponent
[+] DelAttachment                           del_attachment
[ ] DelBeacon
[ ] DelControlSurface
[+] DelDock                                 del_dock
[+] DelExhaust                              del_exhaust
[-] DelExhaustRef                           -- deprecated/obsolete
[ ] DelExhaustStream
[+] DelLightEmitter                         del_lightemitter
[+] DelMesh                                 del_mesh
[+] DelPropellantResource                   del_propellantresource
[+] DelThruster                             del_thruster
[-] DelThrusterGroup                        -- deprecated/obsolete
[+] DetachChild                             detach_child
[ ] Dock
[+] DockCount                               get_dockcount
[+] DockingStatus                           dockingstatus
[+] EditAirfoil                             edit_airfoil
[+] EnableIDS                               enable_ids
[+] EnableTransponder                       enable_transponder
[+] GetADCtrlMode                           get_adcmode
[+] GetAirfoilParam                         edit_airfoil
[+] GetAirspeed                             get_airspeed
[+] GetAirspeedVector                       get_airspeedvector
[+] GetAltitude                             get_altitude
[+] GetAngularAcc                           get_angularacc
[+] GetAngularMoment                        get_angularmoment
[+] GetAngularVel                           get_angvel
[+] GetAnimation                            get_animation
[ ] GetAnimPtr
[+] GetAOA                                  get_aoa
[+] GetApDist                               get_apdist
[+] GetArgPer                               get_argper
[+] GetAtmDensity                           get_atmdensity
[+] GetAtmPressure                          get_atmpressure
[+] GetAtmRef                               get_atmref
[+] GetAtmTemperature                       get_atmtemperature
[+] GetAttachmentHandle                     get_attachmenthandle
[+] GetAttachmentId                         get_attachmentid
[+] GetAttachmentIndex                      get_attachmentindex
[+] GetAttachmentParams                     get_attachmentparams
[+] GetAttachmentStatus                     get_attachmentstatus
[ ] GetAttitudeLinLevel
[+] GetAttitudeMode                         get_rcsmode
[ ] GetAttitudeRotLevel
[+] GetBank                                 get_bank
[-] GetBankMomentScale                      -- deprecated/obsolete
[ ] GetBeacon
[ ] GetCameraDefaultDirection
[+] GetCameraOffset                         get_cameraoffset
[+] GetClassName                            get_classname
[+] GetClipRadius                           get_clipradius
[+] GetCOG_elev                             get_COG_elev
[+] GetControlSurfaceLevel                  get_adclevel
[+] GetCrossSections                        get_crosssections
[+] GetCW                                   get_cw
[+] GetDamageModel                          get_damagemodel
[ ] GetDefaultPropellantResource
[ ] GetDevMesh
[+] GetDockHandle                           get_dockhandle
[+] GetDockParams                           get_dockparams
[+] GetDockStatus                           get_dockstatus
[ ] GetDrag
[+] GetDragVector                           get_dragvector
[+] GetDynPressure                          get_dynpressure
[ ] GetEditorModule
[+] GetElements                             get_elements
[+] GetEmptyMass                            get_emptymass
[+] GetEnableFocus                          get_enablefocus
[-] GetEngineLevel                          -- deprecated/obsolete
[ ] GetEquPos
[+] GetExhaustCount                         get_exhaustcount
[ ] GetExhaustLevel
[ ] GetExhaustSpec
[+] GetFlightModel                          get_flightmodel
[+] GetFlightStatus                         is_landed
[+] GetForceVector                          get_forcevector
[ ] GetFuelMass
[ ] GetFuelRate
[+] GetGlobalOrientation                    get_globalorientation
[+] GetGlobalPos                            get_globalpos
[+] GetGlobalVel                            get_globalvel
[+] GetGravityGradientDamping               get_gravitygradientdamping
[+] GetGravityRef                           get_gravityref
[+] GetGroundspeed                          get_groundspeed
[+] GetGroundspeedVector                    get_groundspeedvector
[+] GetGroupThruster                        get_groupthrustercount
[+] GetGroupThrusterCount                   get_groupthrustercount
[+] GetHandle                               get_handle
[-] GetHorizonAirspeedVector                -- deprecated/obsolete
[+] GetHoverHoldAltitude                    get_hoverholdaltitude
[+] GetIDS                                  get_ids
[ ] GetISP
[ ] GetLift
[+] GetLiftVector                           get_liftvector
[+] GetLightEmitter                         get_lightemitter
[+] GetLinearMoment                         get_linearmoment
[+] GetMachNumber                           get_machnumber
[-] GetMainThrustModPtr                     -- deprecated/obsolete
[ ] GetManualControlLevel
[+] GetMass                                 get_mass
[ ] GetMaxFuelMass
[-] GetMaxThrust                            -- deprecated/obsolete
[ ] GetMesh
[+] GetMeshCount                            get_meshcount
[ ] GetMeshName
[+] GetMeshOffset                           get_meshoffset
[ ] GetMeshTemplate
[ ] GetMeshVisibilityMode
[+] GetName                                 get_name
[+] GetNavChannel                           get_navchannel
[+] GetNavCount                             get_navcount
[+] GetNavmodeState                         get_navmode
[-] GetNavRecv                              -- deprecated/obsolete
[ ] GetNavRecvFreq
[+] GetNavSource                            get_navsource
[+] GetNosewheelSteering                    get_nosewheelsteering
[+] GetPeDist                               get_pedist
[+] GetPitch                                get_pitch
[+] GetPitchMomentScale                     get_pitchmomentscale
[+] GetPMI                                  get_pmi
[+] GetPropellantCount                      get_propellantcount
[+] GetPropellantEfficiency                 get_propellantefficiency
[+] GetPropellantFlowrate                   get_propellantflowrate
[+] GetPropellantHandleByIndex              get_propellanthandle
[+] GetPropellantMass                       get_propellantmass
[+] GetPropellantMaxMass                    get_propellantmaxmass
[+] GetRelativePos                          get_relativepos
[+] GetRelativeVel                          get_relativevel
[+] GetRotationMatrix                       get_rotationmatrix
[+] GetRotDrag                              get_rotdrag
[-] GetShipAirspeedVector                   -- deprecated/obsolete
[+] GetSize                                 get_size
[+] GetSlipAngle                            get_slipangle
[+] GetSMi                                  get_smi
[+] GetStatus                               get_status
[+] GetStatusEx                             get_status
[+] GetSuperstructureCG                     get_superstructureCG
[ ] GetSupervessel
[ ] GetSupervesselCG
[+] GetSurfaceElevation                     get_surfaceelevation
[+] GetSurfaceNormal                        get_surfacenormal
[+] GetSurfaceRef                           get_surfaceref
[+] GetThrusterCount                        get_thrustercount
[+] GetThrusterDir                          get_thrusterdir
[+] GetThrusterGroupHandle                  get_thrustergrouphandle
[+] GetThrusterGroupLevel                   get_thrustergrouplevel
[+] GetThrusterHandleByIndex                get_thrusterhandle
[+] GetThrusterIsp                          get_thrusterisp0
[+] GetThrusterIsp0                         get_thrusterisp0
[+] GetThrusterLevel                        get_thrusterlevel
[+] GetThrusterMax                          get_thrustermax0
[+] GetThrusterMax0                         get_thrustermax0
[ ] GetThrusterMoment
[+] GetThrusterRef                          get_thrusterpos
[+] GetThrusterResource                     get_thrusterresource
[+] GetThrustVector                         get_thrustvector
[+] GetTorqueVector                         get_torquevector
[+] GetTotalPropellantFlowrate              get_totalpropellantflowrate
[+] GetTotalPropellantMass                  get_totalpropellantmass
[+] GetTouchdownPoint                       get_touchdownpoints
[+] GetTouchdownPointCount                  get_touchdownpointcount
[+] GetTouchdownPoints                      get_touchdownpoints
[+] GetTransponder                          get_transponder
[+] GetTrimScale                            get_trimscale
[ ] GetUserThrusterGroupCount
[+] GetUserThrusterGroupHandleByIndex       get_thrustergrouphandlebyindex
[+] GetWeightVector                         get_weightvector
[+] GetWheelbrakeLevel                      get_wheelbrakelevel
[+] GetWingAspect                           get_wingaspect
[+] GetWingEffectiveness                    get_wingeffectiveness
[+] GetYaw                                  get_yaw
[+] GetYawMomentScale                       get_yawmomentscale
[+] Global2Local                            global2local
[+] GlobalRot                               globalrot
[+] GroundContact                           get_groundcontact
[+] HorizonInvRot                           horizoninvrot
[+] HorizonRot                              horizonrot
[-] IncEngineLevel                          -- deprecated/obsolete
[+] IncThrusterGroupLevel                   inc_thrustergrouplevel
[+] IncThrusterGroupLevel_SingleStep        inc_thrustergrouplevel_singlestep
[+] IncThrusterLevel                        inc_thrusterlevel
[+] IncThrusterLevel_SingleStep             inc_thrusterlevel_singlestep
[+] InitNavRadios                           init_navradios
[+] InsertMesh                              insert_mesh
[+] LightEmitterCount                       get_lightemittercount
[+] Local2Global                            local2global
[+] Local2Rel                               local2rel
[ ] MeshgroupTransform
[ ] MeshModified
[+] NonsphericalGravityEnabled              is_nonsphericalgravityenabled
[+] OrbitStabilised                         is_orbitstabilised
[-] ParseScenarioLine                       -- deprecated/obsolete
[ ] ParseScenarioLineEx
[ ] Playback
[ ] RecordEvent
[ ] Recording
[+] RegisterAnimation                       register_animation
[-] RegisterAnimSequence                    -- deprecated/obsolete
[-] SaveDefaultState                        -- deprecated/obsolete
[+] SendBufferedKey                         send_bufferedkey
[+] SetADCtrlMode                           set_adcmode
[+] SetAlbedoRGB                            set_albedoRGB
[+] SetAngularVel                           set_angvel
[+] SetAnimation                            set_animation
[-] SetAnimState                            -- deprecated/obsolete
[+] SetAttachmentParams                     set_attachmentparams
[ ] SetAttitudeLinLevel
[+] SetAttitudeMode                         set_rcsmode
[ ] SetAttitudeRotLevel
[-] SetBankMomentScale                      -- deprecated/obsolete
[ ] SetCameraCatchAngle
[+] SetCameraDefaultDirection               set_cameradefaultdirection
[ ] SetCameraMovement
[+] SetCameraOffset                         set_cameraoffset
[ ] SetCameraRotationRange
[ ] SetCameraShiftRange
[+] SetClipRadius                           set_clipradius
[-] SetCOG_elev                             -- deprecated/obsolete
[+] SetControlSurfaceLevel                  set_adclevel
[+] SetCrossSections                        set_crosssections
[+] SetCW                                   set_cw
[ ] SetDefaultPropellantResource
[ ] SetDockMode
[+] SetDockParams                           set_dockparams
[+] SetElements                             set_elements
[+] SetEmptyMass                            set_emptymass
[+] SetEnableFocus                          set_enablefocus
[-] SetEngineLevel                          -- deprecated/obsolete
[-] SetExhaustScales                        -- deprecated/obsolete
[ ] SetFuelMass
[+] SetGlobalOrientation                    set_globalorientation
[+] SetGravityGradientDamping               set_gravitygradientdamping
[+] SetHoverHoldAltitude                    set_hoverholdaltitude
[+] SetIDSChannel                           set_idschannel
[ ] SetISP
[ ] SetLiftCoeffFunc
[ ] SetMaxFuelMass
[-] SetMaxThrust                            -- deprecated/obsolete
[+] SetMaxWheelbrakeForce                   set_maxwheelbrakeforce
[ ] SetMeshVisibilityMode
[-] SetMeshVisibleInternal                  -- deprecated/obsolete
[+] SetNavChannel                           set_navchannel
[-] SetNavRecv                              -- deprecated/obsolete
[+] SetNosewheelSteering                    set_nosewheelsteering
[+] SetPitchMomentScale                     set_pitchmomentscale
[+] SetPMI                                  set_pmi
[+] SetPropellantEfficiency                 set_propellantefficiency
[+] SetPropellantMass                       set_propellantmass
[+] SetPropellantMaxMass                    set_propellantmaxmass
[ ] SetReentryTexture
[+] SetRotationMatrix                       set_rotationmatrix
[+] SetRotDrag                              set_rotdrag
[+] SetSize                                 set_size
[+] SetSurfaceFrictionCoeff                 set_surfacefrictioncoeff
[+] SetThrusterDir                          set_thrusterdir
[+] SetThrusterGroupLevel                   set_thrustergrouplevel
[+] SetThrusterIsp                          set_thrusterisp
[+] SetThrusterLevel                        set_thrusterlevel
[+] SetThrusterLevel_SingleStep             set_thrusterlevel_singlestep
[+] SetThrusterMax0                         set_thrustermax0
[+] SetThrusterRef                          set_thrusterpos
[+] SetThrusterResource                     set_thrusterresource
[+] SetTouchdownPoints                      set_touchdownpoints
[+] SetTransponderChannel                   set_transponderchannel
[+] SetTrimScale                            set_trimscale
[+] SetVisibilityLimit                      set_visibilitylimit
[+] SetWheelbrakeLevel                      set_wheelbrakelevel
[+] SetWingAspect                           set_wingaspect
[+] SetWingEffectiveness                    set_wingeffectiveness
[+] SetYawMomentScale                       set_yawmomentscale
[+] ShiftCentreOfMass                       shift_centreofmass
[+] ShiftCG                                 shiftCG
[+] ShiftMesh                               shift_mesh
[+] ShiftMeshes                             shift_meshes
[ ] ThrusterGroupDefined
[+] ToggleAttitudeMode                      toggle_rcsmode
[+] ToggleNavmode                           toggle_navmode
[+] TriggerPanelRedrawArea                  trigger_panelredrawarea
[+] TriggerRedrawArea                       trigger_redrawarea
[+] Undock                                  undock
[+] UnregisterAnimation                     unregister_animation
[+] Version                                 version
Legend:
1st column:
[ ] not (yet) available in Lua
[x] available in Lua
[-] depricated or obsolete (may or may not be available in Lua)
2nd column:
Orbiter C-Method name
3rd column:
Lua vessel function name


Should this maybe added to the 1st post?

---------- Post added at 23:33 ---------- Previous post was at 00:05 ----------

Hi Martin,

I have a question about your ASSERT_xxx macros.

Am I right, that the ASSERT_xxx macros and the ASSERT_MTDxxx macros only differ in the presentation of the parameter index (in case the assertion fails)?
I assume that 'MTD' stands for "method"?
If that is true, I have to check that I use the ASSERT_MTDxxx macros in the vessel methods, so that they report any parameter failure with the correct index...

Last edited by kuddel; 10-27-2017 at 10:57 PM.
kuddel is offline   Reply With Quote
Thanked by:
Old 10-26-2017, 12:13 AM   #18
martins
Orbiter Founder
Default

Quote:
Originally Posted by kuddel View Post
 I have a question about your ASSERT_xxx macros.

Am I right, that the ASSERT_xxx macros and the ASSERT_MTDxxx macros only differ in the presentation of the parameter index (in case the assertion fails)?
I assume that 'MTD' stands for "method"?
If that is true, I have to check that I use the ASSERT_MTDxxx macros in the vessel methods, so that they report any parameter failure with the correct index...
Yes, that's correct. Since methods (with ':' syntax) have a hidden first parameter self that appears in the Lua stack of the C++ interface function but not in the Lua call, I introduced the ASSERT_MTDxxx calls to avoid confusion when reporting the parameter index. And yes, MTD stands for method.
martins is offline   Reply With Quote
Thanked by:
Old 10-26-2017, 01:53 PM   #19
kuddel
Donator
Question

Thanks for the clarification Martin,

but since you are here ( ) you could maybe clarify something else, too:

Some vessel methods exit with an assertion, others return nil --in case of an invalid vessel.
Is there any reason behind this, or did you just changed your mind in between?

And in case there's no real reason for the different behavior, what behavior should I prefer.


Asserting method:
PHP Code:
int Interpreter::v_get_gravitygradientdamping (lua_State *L)
{
    
VESSEL *lua_tovessel (L,1);
    
ASSERT_SYNTAX(v"Invalid vessel object");
    
double ggd v->GetGravityGradientDamping();
    
lua_pushnumber(L,ggd);
    return 
1;

Nil returning method:
PHP Code:
int Interpreter::v_get_emptymass (lua_State *L)
{
    
VESSEL *lua_tovessel(L);
    if (
v) {
        
lua_pushnumber (Lv->GetEmptyMass());
        
GetInterpreter(L)->term_echo(L);
    } else 
lua_pushnil (L);
    return 
1;

kuddel is offline   Reply With Quote
Old 10-27-2017, 09:03 PM   #20
kuddel
Donator
Default

Another batch of vessel functions added
kuddel is offline   Reply With Quote
Old 11-01-2017, 12:59 AM   #21
kuddel
Donator
Default LuaScript 2017-10-30 DLLs

Hi folks,

another small increment in providing full Vessel API in Lua (see 1st post for source and new methods)

And it seems that I completely missed the whole point of this development, providing just the sources
People interested in Lua might not have fun in compiling C++ code, so I've attached the compiled DLLs here.

Make a backup of your original files if you like, 'cause the ZIP will overwrite these 4 files:
- \LuaInline.dll
- \LuaInterpreter.dll
- \Modules\Plugin\LuaConsole.dll
- \Modules\Plugin\LuaMFD.dll

Strictly speaking only LuaInterpreter.dll is needed, but the others have some minor bugfixes and enhancements (DEL Key in console... yeah!) as well.

These are compiled and linked against Orbiter BETA (rev. 71), so don't expect them to work with 2016.

Have fun,
Kuddel
Attached Files
File Type: zip LuaScript 2017-10-30(dlls).zip (109.5 KB, 5 views)
kuddel is offline   Reply With Quote
Old 11-02-2017, 11:06 AM   #22
4throck
Enthusiast !
 
4throck's Avatar
Default

Great! Yes, the .dlls are useful for many people.
4throck is offline   Reply With Quote
Old 11-10-2017, 09:38 PM   #23
kuddel
Donator
Question

Hello again,

here's a question to all the Lua users (I am not ):
While documenting all the new features I asked myself whether the OAPI function get_viewport_size should really return a table, or if a Lua developer would expect it to return distinct values?

The difference in usage would be:
Code:
-- table ---
data = oapi.get_viewport_size() -- data.w, data.h & data.bpp

-- individual ---
w = oapi.get_viewport_size() -- just the width
w,h = oapi.get_viewport_size() -- width & height
w,h,bpp = oapi.get_viewport_size() -- width, height & (optional) bits per pixel
So here's your chance of influencing your API!
kuddel is offline   Reply With Quote
Thanked by:
Old 11-25-2017, 06:49 PM   #24
BEEP
Addon Developer
Default

Kuddel,

Thanks a lot for all you have done.I did a quick try but none of my codes worked so I have to do it more thoroughly when I have more time. Hope it is a deprecated function or something easy I'm able to solve.

By now I'd like to show my personal wishlist.

1. When used for a while and entered lines accumulate the terminal behaves erratically. This is a problem that the new version didn't solve. I'd like also to have a kind of 'cls' or 'term.out( string.char(12))' to clear the buffer and declutter the screen.

2. I'd like to have a mesh (or meshes) exclusively for pilot view, with their own animations, in order to be possible to do virtual 3D cockpits in Lua vessels.

3. We need a keyboard input callback for the Lua vessels as well so that we can activate animations ( gear, flaps ) and functions for these vessels.

With 2 and 3 above we're in the path for a 'scriptcraft' open source vessel that could use the legacy meshes and descriptors available and avoid obsolescence for this valuable material.

Beep

---------- Post added at 06:49 PM ---------- Previous post was at 09:03 AM ----------

Quote:
Originally Posted by kuddel View Post
 Hello again,

... OAPI function get_viewport_size should really return a table, or if a Lua developer would expect it to return distinct values?


So here's your chance of influencing your API!

I'd say the better option is the one that more closely resembles the original C++ API. But any available (thanks) and documented (thanks thanks) one would be nice.

Last edited by BEEP; 11-25-2017 at 06:44 PM.
BEEP is offline   Reply With Quote
Old 11-26-2017, 03:34 PM   #25
kuddel
Donator
Default

Quote:
Originally Posted by BEEP View Post
 1. When used for a while and entered lines accumulate the terminal behaves erratically. This is a problem that the new version didn't solve. I'd like also to have a kind of 'cls' or 'term.out( string.char(12))' to clear the buffer and declutter the screen.
I think my notes on oapi.get_annotations (see first post) are exactly what you need.
kuddel is offline   Reply With Quote
Old 11-26-2017, 06:11 PM   #26
BEEP
Addon Developer
Default Lua Console Window

Quote:
Originally Posted by kuddel View Post
 I think my notes on oapi.get_annotations (see first post) are exactly what you need.
I think my reference to "declutter the screen" had you misleaded. Sorry!

I'm not talking about simulation onscreen messages ( the so called "annotations" ) but the lines and cluttering in the Lua Console Window itself.

This seems to be a problem related to keyboard input command lines and does not affect output lines generated by a term.out(XXXX) command. Try to type some lines and press <Enter> several times ( at least 30). You can type anything as receiving an 'Execution Error' response does not make any difference. You'll reach a point when the input line and cursor cannot be seen anymore and the terminal is useless. Then you press <Enter> dozens of times more and it appears again only to disappear after a line or two has been typed. What I'd like to clear is the memory of typed lines and reset its index ( and clear the display of earlier lines in the Lua Console Window). Or better still have an adequate console terminal behaviour. Also there's a point where the previous entered commands sequence memory disappears and cannot be called back with the 'arrow up' key which stands without action.

Last edited by BEEP; 11-27-2017 at 10:36 AM.
BEEP is offline   Reply With Quote
Old 11-27-2017, 08:18 PM   #27
kuddel
Donator
Default

Quote:
Originally Posted by BEEP View Post
 I think my reference to "declutter the screen" had you misleaded. Sorry!
Yes it did

The issue you've described never came to me as I don't program Lua
I'll take a look at the terminal (LuaConsole) code and see what can be done.

something like the build-in 'help' command might be the way to go. But I would suggest something like 'clear-history' & 'clear-terminal' instead of 'CLS' (which would confuse not only me but many others as being CLear Screen).

When executed in a non-terminal context, these might perform as NO OPERATION.

Let's see what I come along with...
kuddel is offline   Reply With Quote
Thanked by:
Old 11-29-2017, 12:29 AM   #28
kuddel
Donator
Default LuaScript 2017-11-29 DLLs

Here's a test release.
Only change:
- added term.clear() function.

This is just a quick proof-of-concept build to see if you (BEEP) can use this.

Have fun,
Kuddel

Last edited by kuddel; 11-29-2017 at 09:59 PM.
kuddel is offline   Reply With Quote
Old 11-29-2017, 09:58 PM   #29
kuddel
Donator
Default

Sorry, but the last attachment contained a wrong LuaConsole.dll
I've exchanged it in this new attached pack.
Attached Files
File Type: zip LuaScript 2017-11-29(dlls).zip (109.8 KB, 8 views)

Last edited by kuddel; 11-29-2017 at 10:00 PM.
kuddel is offline   Reply With Quote
Old 11-30-2017, 08:41 AM   #30
BEEP
Addon Developer
Default

Thanks a lot, Kuddel.

I tested it ( the LuaConsole.dll only ) and the 'term.clear()' command works like a dream and helps a lot if you remember to enter it BEFORE the amount of entered lines lead to the problem I described ( cannot see the input line anymore , the vertical scroll becomes erractic a.s.o.).

If you enter the 'term.clear()' command AFTER your terminal is cluttered and the input line and cursor cannot be seen anymore it makes the whole sim crash and return to Windows.

If the input line is hidden how do you do it? Well,I typed 'term.clear()' carefully despite I could not see it. I repeated this procedure several times with the same result.

I hope this experience brings some light and leads to the solution of the bug.


Anyway, we are in a much better situation than the one we had before. Thanks!


Beep

Last edited by BEEP; 11-30-2017 at 08:44 AM.
BEEP is offline   Reply With Quote
Reply

  Orbiter-Forum > Orbiter Addons > Orbiter Lua Scripting


Thread Tools

Posting Rules
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


All times are GMT. The time now is 03:03 AM.

Quick Links Need Help?


About Us | Rules & Guidelines | TOS Policy | Privacy Policy

Orbiter-Forum is hosted at Orbithangar.com
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright 2007 - 2017, Orbiter-Forum.com. All rights reserved.