Deleting a Side

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
User avatar
Randomizer
Posts: 1535
Joined: Sat Jun 28, 2008 8:31 pm

Deleting a Side

Post by Randomizer »

Is there a Lua script for deleting an entire side? Thanks in advance.

-C

Edit: Tried:
ScenEdit_DeleteSide({side='DPRK Navy'})
ERROR: [string "Console"]:1: attempt to call global 'ScenEdit_DeleteSide' (a nil value)

Also where does one find the GUID for a side? Checking both *.ini and Delta *.ini generated in the SBR do not seem to display this info.
User avatar
michaelm75au
Posts: 12464
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Deleting a Side

Post by michaelm75au »

From Lua Doc
ScenEdit_RemoveSide (table)
Remove side from play. This removes ALL units and contacts.
Michael
User avatar
kevinkins
Posts: 2465
Joined: Wed Mar 08, 2006 11:54 am

RE: Deleting a Side

Post by kevinkins »

Hi ... The lua doc does not give an example, but I tried these two below and they throw and syntax error: ERROR: [string "Console"]:1: unexpected symbol near char(148)

IDF does exist as a side.

Kevin

ScenEdit_RemoveSide({name=”IDF”})
ScenEdit_RemoveSide({side=”IDF”})
“The study of history lies at the foundation of all sound military conclusions and practice.”
Alfred Thayer Mahan
Whicker
Posts: 665
Joined: Tue Jun 19, 2018 9:54 pm

RE: Deleting a Side

Post by Whicker »

somehow you are using the wrong kind of quote marks - that is why it says unexpected symbol I think.
make sure it is a non curly quote mark.

Sometimes I see the curly quotes when copying from the internet.

ScenEdit_RemoveSide({name='IDF'}) --should work
User avatar
kevinkins
Posts: 2465
Joined: Wed Mar 08, 2006 11:54 am

RE: Deleting a Side

Post by kevinkins »

Yep it works ... I see in the documentation that the symbols " and ' are both used. I think lua treats them the same. But there must be some rule that I don't know related to tables.

For example this is right out of the manual:

ScenEdit_SetReferencePoint({side="United States", name="Downed Pilot", lat=0.5})

but then there is:

ScenEdit_KillUnit({side='SideA',unitname='ship'})

Edit - Nevermind: this worked as well ScenEdit_RemoveSide({name="China"}). So either quotations work and that makes sense based on lua in general. I must have had something else off in the syntax.

Thanks!

“The study of history lies at the foundation of all sound military conclusions and practice.”
Alfred Thayer Mahan
Whicker
Posts: 665
Joined: Tue Jun 19, 2018 9:54 pm

RE: Deleting a Side

Post by Whicker »

this is an illegal quote mark - not even sure how to get it - a curly quote: ”
which is different than this - the normal quote mark: "

it may be hard to see in the browser, but your original example is fairly obvious in the lua console that the quote marks are curly.

doesn't matter whether they are single or double as long as you do them in pairs and they are not curly- that makes it so you can do name = "IDF's" or mystring = 'use double quotes like " when enclosing stuff'. If you had to use one or the other it would be hard to enclose some things.
User avatar
Randomizer
Posts: 1535
Joined: Sat Jun 28, 2008 8:31 pm

RE: Deleting a Side

Post by Randomizer »

Of course, I looked through the Command Lua page but failed to see ScenEdit_RemoveSide and instead tried the non-existent DeleteSide. D'oh!

Thanks for setting me straight.

-C
User avatar
kevinkins
Posts: 2465
Joined: Wed Mar 08, 2006 11:54 am

RE: Deleting a Side

Post by kevinkins »

Curly quotes ... never knew they existed and can't seem to reproduce them on my keyboard. Anyway, Whicker has strong eyes and now I know why I why could never hit that darn slider.

Kevin
“The study of history lies at the foundation of all sound military conclusions and practice.”
Alfred Thayer Mahan
User avatar
stilesw
Posts: 1572
Joined: Wed Jun 25, 2014 10:08 pm
Location: Hansville, WA, USA

RE: Deleting a Side

Post by stilesw »

Hey Kevin,

I believe that the "curly quotes" are really quote marks that have been italicized as in "curly quotes" instead of "normal quotes".

Could be wrong though.

-Wayne

For anyone interested here are the Unicode and ISO 10646 standards define the following characters:
(https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html)





Image
Attachments
Quotes.jpg
Quotes.jpg (150.3 KiB) Viewed 279 times
“There is no limit to what a man can do so long as he does not care a straw who gets the credit for it.”

Charles Edward Montague, English novelist and essayist
~Disenchantment, ch. 15 (1922)
Post Reply

Return to “Lua Legion”