Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#6433 closed defect (fixed)

[26393] l10n.js Script value conversion check failed: v.isString() || v.isNumber() || v.isBoolean()

Reported by: Langbart Owned by: bb
Priority: Should Have Milestone: Alpha 26
Component: UI – Game setup Keywords:
Cc: Patch: phab:D4492

Description (last modified by Langbart)

to reproduce

  1. Start a game with the autostart command e.g.
    binaries/system/pyrogenesis -conf=mod.enabledmods:"mod public" -autostart="random/unknown" -autostart-seed=-1 -autostart-civ=1:spart -autostart-civ=2:brit -autostart-ai=2:petra
    
  1. Errors appear
    0 A.D. (0.0.26) Main log (warnings and errors only)
    ERROR: JavaScript error: gui/common/l10n.js line 69 Script value conversion check failed: v.isString() || v.isNumber() || v.isBoolean() (got type undefined) translate@gui/common/l10n.js:69:36 TitleDisplay@gui/loading/TitleDisplay.js:11:13 init@gui/loading/loading.js:10:19
    
    ERROR: GUI page 'page_loading.xml': Failed to call init() function
    
    ERROR: JavaScript error: gui/loading/loading.js line 22 g_LoadingPage is undefined reallyStartGame@gui/loading/loading.js:22:2
    

bisect

The issue can be noticed for the first time with changeset [26393]

File causing issues

Line 11 in the file gui/loading/TitleDisplay.js has been changed. If I undo the change, the problem for the autostart command is no longer reproducible, but the normal GUI game setup within the app is broken.

  • ps/trunk/binaries/data/mods/public/gui/loading/TitleDisplay.js

     
    11/**
    22 * This class choses the title of the loading screen page.
    33 */
    44class TitleDisplay
    55{
    66    constructor(data)
    77    {
    88        let loadingMapName = Engine.GetGUIObjectByName("loadingMapName");
    99        loadingMapName.caption = sprintf(
    1010            data.attribs.mapType == "random" ? this.Generating : this.Loading,
    11             { "map": translate(data.attribs.settings.Name) });
     11            { "map": translate(data.attribs.settings.mapName) });
    1212    }
    1313}
    1414
    1515TitleDisplay.prototype.Generating = translate("Generating “%(map)s”");
    1616
    1717TitleDisplay.prototype.Loading = translate("Loading “%(map)s”");

possible Solution:

The addition of || data.attribs.settings.Name solves the problem, but is this the right solution?

Line 
11 { "map": translate(data.attribs.settings.mapName || data.attribs.settings.Name) });
12 }

Attachments (1)

change_26393.jpg (133.8 KB ) - added by Langbart 2 years ago.

Download all attachments as: .zip

Change History (7)

by Langbart, 2 years ago

Attachment: change_26393.jpg added

comment:1 by Langbart, 2 years ago

Description: modified (diff)

additional comment on the file causing the problem

comment:2 by Langbart, 2 years ago

Description: modified (diff)

possible Solution

comment:3 by bb, 2 years ago

Aight autostart. Forgot about those. The issue is that the Autostart engine (Gamesetup.cpp) assumes that the settings as in the map json need to be transferred directly to the settings.

We should pipe the GameSetup.cpp autostart through the GameSettings (use the autostart gui page).

Notice the same issue going on with the map Preview (though it doesn't crash since the preview is not used anywhere outside gamesetup).

comment:4 by bb, 2 years ago

Patch: phab:D4492

comment:5 by bb, 2 years ago

Owner: set to bb
Resolution: fixed
Status: newclosed

In 26584:

Let the Gamesetup.cpp Autostart (starting from cl) use the gamesettings via the autostart gui page.

Comments and testing By: Langbart

Fixes #6433
Differential Revision: D4492
Includes/Obsoletes D4287

comment:6 by Langbart, 2 years ago

Summary: [26393] Errors pop up[26393] l10n.js Script value conversion check failed: v.isString() || v.isNumber() || v.isBoolean()

better title

Note: See TracTickets for help on using tickets.