What we need from Lua

Moderator: Jason Petho

Post Reply
edward77
Posts: 72
Joined: Tue Jul 27, 2010 1:04 pm

What we need from Lua

Post by edward77 »

Having looked at the lua files the prospects for an CSME event engine are bright but we will need a generic template, particularly if direct lua support ("you are on your own")is not going to be available. The template would include generalised sections with variable perameters for set up, messages and the more common types of event thereby enabling the user to insert just a few lines to get what he wants and the learning curve is not so steep. An example of this approach is that used by Richard Bodley Scott(Byzantine,Slitherine)with his .bsf script files in "Pike and Shot". These were a great success but then he did provide direct script support. So, for lua to be successful, the generic template is going to be even more important.
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

RE: What we need from Lua

Post by berto »

ORIGINAL: edward77

Having looked at the lua files the prospects for an CSME event engine are bright but we will need a generic template, particularly if direct lua support ("you are on your own")is not going to be available. The template would include generalised sections with variable perameters for set up, messages and the more common types of event thereby enabling the user to insert just a few lines to get what he wants and the learning curve is not so steep. An example of this approach is that used by Richard Bodley Scott(Byzantine,Slitherine)with his .bsf script files in "Pike and Shot". These were a great success but then he did provide direct script support. So, for lua to be successful, the generic template is going to be even more important.
You mean something like this? [:)]

rober@Rob10rto ~/cslint
$ ./csmklua.pl -a -g vn -f VN_580810_Ben_Cat.scn -o VN_580810_Ben_Cat.lua

csmklua.pl will be included with the game, in the Tools/CSlint folder. (Together with many other development and maintenance and debugging tools and scripts.)

In order to run csmklua.pl (etc.), you will need either to

[*]install Cygwin

or

[*]install Windows Subsystem for Linux

Limited support will be provided to get modders up to speed on installing/using either of those environments.

Not only will csmklua.pl auto-generate a starter, template script for you, it will also -- grabbing info from the scenario .scn, .org files, and other files, such as the OOB files -- customize the script per the scenario in question.

Here for example is the VN_580810_Ben_Cat.lua file resulting from that above csmklua.pl command:

Image

You will note:

[*]It is starter template .lua file, with all of the standard routines and trigger functions already in place.
[*]It provides helpful commentary on things you might want to do (or not want to do) (such as force special optional rules).
[*]Fetching from the .scn file, it sets up OBJECTIVES[] "mnemonics" automatically.
[*]Fetching from the .org file and others, it sets up unit org mnemonics automatically.
[*]Sets up starter templates for inserting in-game message pop-ups.
[*]Establishes a standard for organizing each side's "battle plans", and their execution.

And other stuff besides.

The Tools/CSlint toolkit also includes at least one utility to QA check your .lua file creation:

rober@Rob10rto ~/cslint
$ ./csluachk.pl -n +w +e -g vn -f CSLUACHK1.lua
ERROR: /usr/bin/luac: ...mes/Matrix Games/Vietnam/vietnam/Scenarios/CSLUACHK1.lua:12: ')' expected near '|'
ERROR: for CSLUACHK1.lua:12: mistaken OPT: OPTNONESUCH
ERROR: for CSLUACHK1.lua:237: mistaken LOG: LINCOLNLOG
ERROR: for CSLUACHK1.lua:245: mistaken LOG: LOG_ARITHM
ERROR: for CSLUACHK1.lua:253: mistaken LOG: LOG_LOG
ERROR: for CSLUACHK1.lua:253: mistaken LOG: LOG_LOG
ERROR: for CSLUACHK1.lua:458: mistaken DIR: UPRDIR
ERROR: for CSLUACHK1.lua:481: mistaken DIR: UPRDIR
ERROR: for CSLUACHK1.lua:528: mistaken DIR: LEFTDOWNDIR
ERROR: for CSLUACHK1.lua:223: illegal space in luav index: " _6E_BATAILLON_DE_PARACHUTISTES_COLONIAUX_1ER_COMPAGNIE_STATUS"
ERROR: for CSLUACHK1.lua:232: illegal space in luav index: "_II_1ER_RCP_BATAILLON_DE_CHASSEURS_PARACHUTISTES_5E_COMPAGNIE_STATUS "
ERROR: for CSLUACHK1.lua:235: illegal space in luav index: "_II_1ER_RCP_BATAILLON_DE_CHASSEURS_PARACHUTISTES _8E_CIP_STATUS"
ERROR: for CSLUACHK1.lua:450: malformed objective hex coordinates: "18, 24"
ERROR: for CSLUACHK1.lua:458: malformed objective hex coordinates: "18, 24"
ERROR: for CSLUACHK1.lua:473: malformed objective hex coordinates: "18 ,24"
ERROR: for CSLUACHK1.lua:481: malformed objective hex coordinates: "18 ,24"
ERROR: for CSLUACHK1.lua:496: malformed objective hex coordinates: " 16,23"
ERROR: for CSLUACHK1.lua:500: malformed objective hex coordinates: " 16, 23"
ERROR: for CSLUACHK1.lua:519: malformed objective hex coordinates: "15,33 "
ERROR: for CSLUACHK1.lua:528: malformed objective hex coordinates: "15, 33 "
ERROR: for IC_511209_Tu_Vu.lua:308: duplicate org name: _TIEU_DOAN_PHAO_BINH_DAI_DOI_SUNG_COI_50_120MM_TRUCKS
ERROR: for IC_511209_Tu_Vu.lua:318: duplicate org name: _TRUNG_DOAN_HQ
ERROR: for IC_511209_Tu_Vu.lua:446: duplicate org name: _TIEU_DOAN_PHAO_BINH_DAI_DOI_PHAO_BINH_50_105MM_TRUCKS
ERROR: for IC_511209_Tu_Vu.lua:447: duplicate org name: _TIEU_DOAN_PHAO_BINH_DAI_DOI_PHAO_BINH_50_105MM_TRUCKS
ERROR: for IC_511209_Tu_Vu.lua:448: duplicate org name: _TIEU_DOAN_PHAO_BINH_DAI_DOI_PHAO_BINH_50_105MM_TRUCKS
ERROR: for IC_511209_Tu_Vu.lua:449: duplicate org name: _TIEU_DOAN_PHAO_BINH
ERROR: for IC_511209_Tu_Vu.lua:455: duplicate org name: _TIEU_DOAN_PHAO_BINH_DAI_DOI_DAC_CONG
...

(The above is from QA checking a standard test .lua file.)

So not only will Tools/CSlint make your standard starter .lua file templates, it will even QA check them for you! [:)]

Will there be a CSEE HOW-TO tutorial, and doc? Yes, although maybe not ready for the initial 1.0 release. (Sorry about the delay.)

Is there already a LUA_FUNCTIONS_REFERENCE.txt, documenting use of the 400+ CSEE functions? Why, yes there is!

Will there be on-line user support for all of this? Within reason, yes there will be. (Continuing the active participation and responsiveness that we, the Campaign Series Legion, are well known for.)

Does all of this answer your questions, set your mind at ease? [;)]
Attachments
csmklua6.jpg
csmklua6.jpg (1.07 MiB) Viewed 709 times
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
edward77
Posts: 72
Joined: Tue Jul 27, 2010 1:04 pm

RE: What we need from Lua

Post by edward77 »

Wow, Very impressive. You are well on the way. Thank you
User avatar
Jason Petho
Posts: 17684
Joined: Tue Jun 22, 2004 10:31 am
Location: Terrace, BC, Canada
Contact:

RE: What we need from Lua

Post by Jason Petho »

Of course, all these goodies will be included in the next UPDATE for Middle East.

That will come out after Vietnam though, as Vietnam is our primary focus.
User avatar
Crossroads
Posts: 18547
Joined: Sun Jul 05, 2009 8:57 am

RE: What we need from Lua

Post by Crossroads »

I've wanted to begin a blog series on our lua CS Event Engine together with all the latest and greatest. Need to get it started, right. 25th hour to each day, anyone?
Visit us at: Campaign Series Legion
---
CS: Vietnam 1948-1967 < v2.10.20 Available Now (Dec 03, 2025)
CS: Middle East 1948-1985 < v3.10.20 Available Now (Dec 03, 2025)
User avatar
Jason Petho
Posts: 17684
Joined: Tue Jun 22, 2004 10:31 am
Location: Terrace, BC, Canada
Contact:

RE: What we need from Lua

Post by Jason Petho »

25th hour to each day, anyone?

+1 YES PLEASE!
Post Reply

Return to “Mods and Scenarios”