Page 1 of 1
Deleting a Side
Posted: Sat May 25, 2019 2:23 pm
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.
RE: Deleting a Side
Posted: Sat May 25, 2019 6:30 pm
by michaelm75au
From Lua Doc
ScenEdit_RemoveSide (table)
Remove side from play. This removes ALL units and contacts.
RE: Deleting a Side
Posted: Sat May 25, 2019 7:19 pm
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”})
RE: Deleting a Side
Posted: Sat May 25, 2019 7:28 pm
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
RE: Deleting a Side
Posted: Sat May 25, 2019 7:47 pm
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!
RE: Deleting a Side
Posted: Sat May 25, 2019 8:22 pm
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.
RE: Deleting a Side
Posted: Sat May 25, 2019 11:07 pm
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
RE: Deleting a Side
Posted: Sun May 26, 2019 9:13 am
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
RE: Deleting a Side
Posted: Sun May 26, 2019 10:30 am
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)
