Page 1 of 1

ComanndLua functions and License Versions...

Posted: Wed Jun 24, 2020 7:48 pm
by jkgarner
In the documentation of functionality at https://commandlua.github.io,
it would be really useful if the version of software that the function or attribute applied to were included.

For example

The function: ScenEdit_ExportScenarioToXML only applies to the Professional Edition (Full version)

I am running Professional Edition/Student Version.

Thus the code:

Code: Select all

local theXML = ScenEdit_ExportScenarioToXML () 

generates the following error
ERROR: [string "Console"]:6: attempt to call global 'ScenEdit_ExportScenarioToXML' (a nil value)


Same with VP_GetSides, though I am not sure what version it applies to.
ERROR: [string "Console"]:7: attempt to call global 'VP_GetSides' (a nil value)


As I read through the documentation to try to figure out what I can and can not do with the version that I have, I am forced to resort to trial and error on each function to see if it is available to me.

It would be nice if I could simply read that information on the documentation page.



RE: ComanndLua functions and License Versions...

Posted: Thu Jun 25, 2020 5:24 am
by michaelm75au
There is the message and color coded line in the WIKI page:
Functions

Functions marked thus are not available in the base product ScenEdit_ExportScenarioToXML()

Currently this is the only function with a restriction.


As far as what is not in PE, I don't have visibility of.

RE: ComanndLua functions and License Versions...

Posted: Thu Jun 25, 2020 10:43 am
by jkgarner
Mike,

I noticed the coloring of ScenEdit_ExportScenarioToXML() today, but not the statement at the top.

Also, I noticed that they put functions new to 1.14.2 at the top. Such statements are hard to maintain in the long run, and make for a large mess after several iterations or several releases.

I believe a simple statement with the function 'Available since version 1.???' when the function is added is more maintainable and more useful for the end user.

This works for deprication as well...
'Depricated since version 1.???'


Similar statements about license-version availability would be nice:

e.g. in ScenEdit_ExportScenarioToXML section..
Available to P.E. Full version and above.

If this site is intended for Base user consumption only, then please state that somewhere on the site. If that is the case, then additional site for the Professional Users should be developed to support them. These are my thoughts. I believe adding statements as described above is actually the easier solution.

All that said, I decided to test a few functions against my version (P.E. 1.14.2 Student Edition). Time permitting, I may work my way through all the functions and provide similar feedback. What I discovered is that some did not work, and some had omissions in the documentation. Below are my observations for that small set of functions:

Code: Select all

 --works on PE, Student Version 1.14.2
 local result = ScenEdit_InputBox("Enter the guid for the unit to target")
 

Code: Select all

 --works on PE, Student Version 1.14.2
 local result = ScenEdit_MsgBox('press a button...',5)
 print(result)
 --a note on the documentation for this function:
 --RETURNS string with name of button pressed
 -- e.g. 'Ok', 'Cancel', 'Abort', 'Retry', 'Ignore','Yes','No','Retry'
 -- (not localized)
 --the documentation says it returns the button number pressed (which is incorrect)
 

Code: Select all

 --does NOT work on PE, Student Version 1.14.2
 --PRODUCES ERROR: attempt to call global 'ScenEdit_SelectedUnits' (a nil value)
 local units = ScenEdit_SelectedUnits()
 print(units)
 

Code: Select all

 --works on PE, Student Version 1.14.2
 local vp = VP_GetSide({Side="USA"})
 local cp = vp.contacts --List Of contactslocal
 local contact = cp[1]
 local cguid = cp[1].guid -- a specific contactlocal
 local result = VP_GetContact({guid=cguid}) -- details of contact as distinct to unit details
 print(result)
 

Code: Select all

 --works on PE, Student Version 1.14.2
 local result = VP_GetSide({Side ='USA'})
 print(result)
 

Code: Select all

 --does NOT work on PE, Student Version 1.14.2
 --PRODUCES ERROR: attempt to call global 'VP_GetSides' (a nil value)
 local sides = VP_GetSides()
 print(sides)
 

Code: Select all

 --works on PE, Student Version 1.14.2
 local uData = VP_GetUnit({side='USA',name='USS BOXER (LHD-4)'})
 print(uData)
 

Code: Select all

 --works on PE, Student Version 1.14.2
 --BUT...Documentation DOES not tell you to put in radius! (nor units of distance for radius)
 local uData = VP_GetUnit({side='USA',name='USS BOXER (LHD-4)'})
 local circle = World_GetCircleFromPoint(
       {latitude=uData.latitude, longitude=uData.longitude, numpoints=20, radius=50})
 print(circle)
 

Code: Select all

 --works on PE, Student Version 1.14.2
 --BUT... a description of location wrapper not anywhere in the documentation..
 local elv = World_GetElevation({latitude='15.1429', longitude='120.3496'})
 print(elv)
 

Code: Select all

 --does NOT work on PE, Student Version 1.14.2
 --PRODUCES ERROR: attempt to call global 'World_GetLocation' (a nil value)
 local loc = World_GetLocation({latitude='15.1429', longitude='120.3496'})
 print(loc)
 

Code: Select all

 --works on PE, Student Version 1.14.2
 --BUT... parameters needed are not clearly specified in documentation
 --(bearing and distance left out)
 --nor units of measure for distance. Miles, KM? NM?
 --To work, the function requires table with the following information:
 --{latitude=start_lat, longidude=start_lon, bearing=number, distance=number}
 --
 --Also, UNLIKE Tool_Brearing function you MUST use lat and lon for start position, not a unit.
 --
 local newPoint = World_GetPointFromBearing(
                  {latitude='15.1429', longitude='120.3496', bearing=45, distance=50})
 print(newPoint)
 
 local uData = VP_GetUnit({side='USA',name='USS BOXER (LHD-4)'})
 local newPoint = World_GetPointFromBearing(
                  {latitude=uData.latitude, longitude=uData.longitude, bearing=45, distance=50})
 print(newPoint)
 

[:)]

RE: ComanndLua functions and License Versions...

Posted: Fri Jun 26, 2020 12:28 pm
by michaelm75au
The new section was so designers could see the (new/upcoming) changes.
The changes should be in the main section also - I haven't really checked so I will verify over weekend.
Apart from the 2 Pro functions, the rest are in the base code. As mentioned, I don't have access to PE code to validate what is/isn't there, but my understanding was that PE was based on the main code. But it would depend on when the builds were made.

RE: ComanndLua functions and License Versions...

Posted: Fri Jun 26, 2020 12:33 pm
by michaelm75au
PE 1.14.2 seems old, so newer Lua functions may not be in it.
And I am not sure of the correlation between the PE and base release numbers.

RE: ComanndLua functions and License Versions...

Posted: Fri Jun 26, 2020 3:24 pm
by jkgarner
Mike,

Command P.E. 1.14.2 is about a year old.
Command P.E. 1.15 was released 7 May 2020)
There have been two minor updates so the latest is 1.15.2.

I will probably be updating to that version within a week.


RE: ComanndLua functions and License Versions...

Posted: Fri Jun 26, 2020 4:27 pm
by jkgarner
Correction: I was running 1.14.5.5 (not 1.14.2)
I am currently updating my software to the latest 1.15.2.

RE: ComanndLua functions and License Versions...

Posted: Fri Jun 26, 2020 11:54 pm
by michaelm75au
I think PE 1.15 has most of the functions now as that would have been built from the current code base.

RE: ComanndLua functions and License Versions...

Posted: Sat Jun 27, 2020 9:34 am
by KnightHawk75
ORIGINAL: jkgarner

Correction: I was running 1.14.5.5 (not 1.14.2)
I am currently updating my software to the latest 1.15.2.
On nice you should finally have some\most of the recent creature comforts then it sounds like!

RE: ComanndLua functions and License Versions...

Posted: Mon Jun 29, 2020 1:09 pm
by jkgarner
Update: I now have Professional Edition, Student 1.15.2 loaded.
I ran the some tests as the other day.

In version 1.14.5.5, three (3) methods did not work.
In version 1.15.2, all functions that worked in the previous edition, continue to work.

Of the three (3) functions that failed in the previous version, two (2) now work under 1.15.2.
VP_GetSides still fails.

Code: Select all

--does NOT work on PE, Student Version 1.14.5.5: 
 --        PRODUCES ERROR: attempt to call global 'ScenEdit_SelectedUnits' (a nil value)
 --works on PE, Student Version 1.15.2
 local units = ScenEdit_SelectedUnits()
 print(units)

Code: Select all

--does NOT work on PE, Student Version 1.14.5.5
 --         PRODUCES ERROR: attempt to call global 'VP_GetSides' (a nil value)
 --does NOT work on PE, Student Version 1.15.2
 --         PRODUCES ERROR: attempt to call global 'VP_GetSides' (a nil value)
 local sides = VP_GetSides()
 print(sides)

Code: Select all

--does NOT work on PE, Student Version 1.14.5.5
 --         PRODUCES ERROR: attempt to call global 'World_GetLocation' (a nil value)
 --works on PE, Student Version 1.15.2
 local loc = World_GetLocation({latitude='15.1429', longitude='120.3496'})
 print(loc)



RE: ComanndLua functions and License Versions...

Posted: Mon Jun 29, 2020 8:32 pm
by KnightHawk75
figures the one you really wanted to (I think) doesn't yet. :)

RE: ComanndLua functions and License Versions...

Posted: Mon Jun 29, 2020 8:33 pm
by KnightHawk75
Figures the one you really wanted to work (as I recall) doesn't yet. [:)]

RE: ComanndLua functions and License Versions...

Posted: Tue Jun 30, 2020 3:48 am
by jkgarner
Yeah, I needed the VP_GetSides for a few operations...
but I'll adjust my library to work around the limitation...
(it won't slow me down too much)

Now the ScenEdit_SelectedUnits will come in very handy in building special actions.
[:)]

RE: ComanndLua functions and License Versions...

Posted: Wed Jul 01, 2020 9:36 am
by jkgarner
Another function that does not work in Student P.E.:

Code: Select all

--does NOT work on PE, Student Version 1.14.5.5
 --         PRODUCES ERROR: attempt to call global 'ScenEdit_GetEvents' (a nil value)
 --does NOT work on PE, Student Version 1.15.2
 --         PRODUCES ERROR: attempt to call global 'ScenEdit_GetEvents' (a nil value)
 local events = ScenEdit_GetEvents()
 print(events)

RE: ComanndLua functions and License Versions...

Posted: Wed Jul 01, 2020 11:49 am
by jkgarner
I got a friend to test the two functions:
ScenEdit_GetEvents()
VP_GetSides()
in the Comercial Command (version 1115.3)

both returned the error:
attempt to call global "<function name>' (a nil value)


RE: ComanndLua functions and License Versions...

Posted: Thu Jul 02, 2020 4:54 am
by michaelm75au
I don't recognize that commercial version.
This is the version showing on my Steam copy of CMO


Image


Or are you referring to the old CMANO?

RE: ComanndLua functions and License Versions...

Posted: Thu Jul 02, 2020 6:54 am
by jkgarner
I believe he's running a fairly new steam version, purchased this spring.
I asked what version (build), and he said "1115.3", though I may have mis-heard.
I had him repeat it.

RE: ComanndLua functions and License Versions...

Posted: Thu Jul 02, 2020 11:26 am
by jkgarner
Correction.
My friend has a compact disk version received from the user's group meeting/training held in January of this year. The case says Command Modern Operations
GetBuildNumber() returns 1115.3

RE: ComanndLua functions and License Versions...

Posted: Thu Jul 02, 2020 12:37 pm
by michaelm75au
Yea, that must be a bit behind - we are up to 1147.x