[FIXED B826] LUA and Regional and Language Options issue

Post bug reports and ask for game support here.

Moderator: MOD_Command

Post Reply
User avatar
ClaudeJ
Posts: 754
Joined: Wed Mar 08, 2006 5:38 pm
Location: Bastogne

[FIXED B826] LUA and Regional and Language Options issue

Post by ClaudeJ »

Playing Coiler12's Best of the West, Worst of the East (1982), I'm facing an issue that's preventing the units to be placed correctly or even placed at all.

Here are the Lua commands involved:
a = math.random(1,2)
if a == 1 then
ScenEdit_AddUnit({type='Sub', side='USSR', name='B-23', dbid='187', latitude='49.3812997111192', longitude='-36.8903957715054'})
elseif a == 2 then
ScenEdit_AddUnit({type='Sub', side='USSR', name='B-25', dbid='147', latitude='49.3812997111192', longitude='-36.8903957715054'})
end
a = math.random(1,3)
if a == 1 then
ScenEdit_AddUnit({type='Sub', side='USSR',name='B-10', dbid='278', latitude='50.52351341355', longitude='-37.177899984719'})
elseif a == 2 then
ScenEdit_AddUnit({type='Sub', side='USSR',name='B-15', dbid='278', latitude='50.52351341355', longitude='-37.177899984719'})
elseif a == 3 then
ScenEdit_AddUnit({type='Sub', side='USSR',name='K-115', dbid='391', latitude='50.52351341355', longitude='-37.177899984719'})
end
a = math.random(1,3)
if a == 1 then
ScenEdit_AddUnit({type='Sub', side='USSR', name='K-18', dbid='159', latitude='49.8531552461574', longitude='-36.2143146634912'})
end
a=math.random(1,2)
if a == 1 then
ScenEdit_AddUnit({type='Sub', side='USSR', name='K-16', dbid='363', latitude='50.1531552461574', longitude='-36.3143146634912'})
elseif a == 2 then
ScenEdit_AddUnit({type='Sub', side='USSR', name='K-5', dbid='363', latitude='50.1531552461574', longitude='-36.3143146634912'})
end
ScenEdit_AddUnit({type='Sub', side='USSR', name='B-8', dbid='287', latitude='48.9941488964394', longitude='-35.8765853708755'})
a= math.random(1,2)
if a == 1 then
ScenEdit_AddUnit({type='Sub', side='USSR', name='B-7', dbid='287', latitude='50.051014008713', longitude='-41.5623833495527'})
end

When I set my OS'"Regional and Language Options" to English (United States) as below, or even Chinese (PRC), it works fine.
Image


However when the is set to French (France), Russian or Polish (potentially others too), I've got that error popping-up and no sub is placed at all:
Image

Now if I set my "Regional and Language Options" to French (Belgium), I've got no error popping-up but subs are scattered around:
ImageImage


Command is at Build 624, OS is Windows 7 64-bit Ultimate Edition.


Hope it helps.
Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz, NVIDIA GeForce GTX 1650 4 Go, Windows 10 64bits, 32 GB RAM, Regional settings = French, Belgium
(Previously known as JanMasters0n)
mikmykWS
Posts: 7185
Joined: Tue Mar 22, 2005 4:34 pm

RE: LUA and Regional and Language Options issue

Post by mikmykWS »

Thanks Jan. We'll take a look

Mike
DeSade
Posts: 155
Joined: Mon Mar 01, 2004 5:08 pm
Contact:

RE: LUA and Regional and Language Options issue

Post by DeSade »

I can confirm, its decimal separator, which in cited examples of Windows settings (French, Russian or Polish) is comma, not period. In coordinates case working format for these Windows regional settings is:

ScenEdit_AddUnit({type='Sub', side='USSR', name='B-23', dbid='187', latitude='49,3812997111192', longitude='-36,8903957715054'})

This affects only CMANO functions, not Lua syntax, so for example code:

if a<0.5 then ....

works in every version.
However print(0.5), while working in affected Windows regional settings, produce 0,5 as a result :)

User avatar
ClaudeJ
Posts: 754
Joined: Wed Mar 08, 2006 5:38 pm
Location: Bastogne

RE: LUA and Regional and Language Options issue

Post by ClaudeJ »

DeSade, weird things is that you input a decimal coordinate without quotes, it will work, try that for example:

ScenEdit_AddUnit({side = 'PlayerSide', type = 'Facility', dbid = 430, name = 'Florennes', latitude = 50.243611, longitude = 4.648611, heading = 080})
ScenEdit_AddUnit({side = 'PlayerSide', type = 'Facility', dbid = 1714, name = 'Beauvechain', latitude = 50.758611, longitude = 4.768333, heading = 220})
Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz, NVIDIA GeForce GTX 1650 4 Go, Windows 10 64bits, 32 GB RAM, Regional settings = French, Belgium
(Previously known as JanMasters0n)
DeSade
Posts: 155
Joined: Mon Mar 01, 2004 5:08 pm
Contact:

RE: LUA and Regional and Language Options issue

Post by DeSade »

ORIGINAL: Jan Masterson

DeSade, weird things is that you input a decimal coordinate without quotes, it will work, try that for example:

ScenEdit_AddUnit({side = 'PlayerSide', type = 'Facility', dbid = 430, name = 'Florennes', latitude = 50.243611, longitude = 4.648611, heading = 080})
ScenEdit_AddUnit({side = 'PlayerSide', type = 'Facility', dbid = 1714, name = 'Beauvechain', latitude = 50.758611, longitude = 4.768333, heading = 220})

ahh, indeed, good catch :) So the problem lies in conversion from string to number, and you just found workaround :)
Dimitris
Posts: 14771
Joined: Sun Jul 31, 2005 10:29 am
Contact:

RE: LUA and Regional and Language Options issue

Post by Dimitris »

Fixed in Build 639.
Rongor
Posts: 451
Joined: Tue Mar 25, 2014 7:35 am
Contact:

RE: LUA and Regional and Language Options issue

Post by Rongor »

Hey there,
I can report this issue has resurfaced. Luckily I stumbled over this thread, Jan Masterson's workaround also helped out.

I did a
ScenEdit_AddShip('SideNameOrID', 'ShipName', DBID, 'DEC', 'Lat', 'Lon') in the console

with drawing Lat and Lon from math.random functions. This always generated a "ERROR: Input string was not in a correct format." situation. Went into my OS language settings as described by Jan, set it to english (US), now it worked. Other workaround was to use "tostring(Lat), tostring(Lon)", which Bal helped me out with.

Build 825
mikmykWS
Posts: 7185
Joined: Tue Mar 22, 2005 4:34 pm

RE: LUA and Regional and Language Options issue

Post by mikmykWS »

Could you post the actual script you used?

Thanks!

Mike
Rongor
Posts: 451
Joined: Tue Mar 25, 2014 7:35 am
Contact:

RE: LUA and Regional and Language Options issue

Post by Rongor »

here it is:

Code: Select all

RLat = (math.random ()+math.random (31,34))
 RLon = ((math.random(10,15)+math.random ())*(-1))
 ScenEdit_AddShip('Morocco', 'F611 Mohammed V', 2363, 'DEC', RLat, RLon)
mikmykWS
Posts: 7185
Joined: Tue Mar 22, 2005 4:34 pm

RE: LUA and Regional and Language Options issue

Post by mikmykWS »

Ah never mind see you posted it in chat. Thanks and somebody will update this when they get a change to take a look!

Mike
User avatar
michaelm75au
Posts: 12455
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: LUA and Regional and Language Options issue

Post by michaelm75au »

ORIGINAL: Rongor

here it is:

Code: Select all

RLat = (math.random ()+math.random (31,34))
 RLon = ((math.random(10,15)+math.random ())*(-1))
 ScenEdit_AddShip('Morocco', 'F611 Mohammed V', 2363, 'DEC', RLat, RLon)

Out of curiosity, does this work ..

Code: Select all

RLat = (math.random ()+math.random (31,34))
 RLon = ((math.random(10,15)+math.random ())*(-1))
 --ScenEdit_AddShip('Morocco', 'F611 Mohammed V', 2363, 'DEC', RLat, RLon)
 unit = ScenEdit_AddUnit({type = 'ship', name = 'F611 Mohammed V', 
  heading = 0, dbid = 2363, side = 'Morocco', lat=RLat, lon=RLon, proficiency=2})
 print(unit)

When I changed to FR, it still worked okay.
The ScenEdit_AddUnit() is the preferred/best method to add units from what I understand.
Michael
User avatar
michaelm75au
Posts: 12455
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: LUA and Regional and Language Options issue

Post by michaelm75au »

Did the suggested method work?
Michael
Dimitris
Posts: 14771
Joined: Sun Jul 31, 2005 10:29 am
Contact:

RE: LUA and Regional and Language Options issue

Post by Dimitris »

Fixed in Build 826.
Post Reply

Return to “Tech Support”