Page MenuHomeFeedback Tracker

Using invalid classnames with addXcargo/global commands causes config error and blocks mission loading
Feedback, NormalPublic

Description

At some point in the past, if you used an invalid classname with an addXcargo/global command (e.g. addMagazineCargoGlobal), the command would simply fail silently.
Now, the command causes a config error and, on DS, prevents the mission from loading.

Such commands also don't seem to have complete type validation. While most incorrect types are caught by a script error, type Any (nil, or variable initialised by private but not defined) is not, and also causes a config error.

Although people should not have been using invalid classes before, this change is not very backwards-compatible, as missions that encounter it cannot be played on DS, when they could before. If possible, it should be changed to either fail silently again (probably with RPT error), or display a script error, rather than crashing the whole mission.

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Scripting
Steps To Reproduce

Place a crate and a man to play as.
In the crate's init field, add this addMagazineCargo ["aaa",2].
Start the mission and observe the config error.
Load the mission on DS and repeat. Note that the server immediately returns to the mission select screen rather than continuing with the mission.

Now change "aaa" to nil and repeat. Note the config error instead of a script error.

Event Timeline

NikkoJT created this task.Dec 4 2023, 12:40 AM
NikkoJT added a comment.EditedDec 5 2023, 8:22 AM

Further investigation:

It's possible that the config error on nonexistent (but valid string) classnames is not new, and that the loss of type validation against type Any is the only change. I can't confirm this. If that is the case, then better handling for incorrect classnames becomes nice-to-have but not essential for back-compat, while protection against type Any is the back-compat issue.

Relevant commands:

addBackpackCargo/Global - config error for type Any and for wrong string
addMagazineCargo/Global - config error for type Any and for wrong string
addItemCargo/Global - fails with no error or RPT log for type Any and for wrong string. "Safe" but should probably have a type validation script error for type Any.
addWeaponCargo/Global - config error for type Any and for wrong string
addWeaponWithAttachmentsCargo/Global - this is a weird one. Fails with config error for wrong string, but if given nil, does not error, and instead creates a broken invisible item in the inventory. (see pic at bottom)
addItem/Global - safely handles wrong string with an RPT error. Fails silently when given type Any. "Safe" but should probably have a type validation script error for type Any.
addMagazine/Global - as above
addWeapon/Global - as above

BIS_fnc_KK set Ref Ticket to AIII-56149.Dec 18 2023, 8:54 PM

Revision: 151233 addMagazineCargo, addMagazineCargoGlobal, addMagazineAmmoCargo, addMagazineTurret, addMagazine, addMagazineGlobal, addMagazines

Revision: 151234 addBackpackCargo, AddBackpackCargoGlobal

Revision: 151235 addWeaponTurret, addWeaponCargo, addWeaponCargoGlobal, addWeaponWithAttachmentsCargo, addWeaponWithAttachmentsCargoGlobal

BIS_fnc_KK removed BIS_fnc_KK as the assignee of this task.Dec 19 2023, 10:27 PM
BIS_fnc_KK changed the task status from New to Feedback.
BIS_fnc_KK added a subscriber: BIS_fnc_KK.