Community Forum

Invalid Class Name - But Registered...?

Forum Overview >> Scripting

CategoryScripting
Created15.06.2020 08:29


Doug Williams (Dougw133) 15.06.2020 08:29
I am trying to load a placeable that has scripts associated. The loader lua script registers the class name. The game log shows loaded

"Register placeable type: FS19_DELTA.objectStoragePlaceable"

However, using defaultItems xml with the class name "objectStoragePlaceable" results in an error:

Error: Corrupt savegame, item 41 has invalid className 'objectStoragePlaceable'

The classname is also defined in the placeable XML file for the mod/id3.

What am I doing wrong?

Bilbo Beutlin (BBeutlin) 15.06.2020 09:09
You must pay attention that the mod with the script is loaded BEFORE the map (rename the mod or map).

Or you embed the script into the map directly.

Doug Williams (Dougw133) 15.06.2020 10:33
I'm loading the script from the scripts folder in the map. Is that what you mean by embed it into the map?



Doug Williams (Dougw133) 15.06.2020 10:37
Or did you mean via script callback onCreate? I tried that but I don't know the right parameters of the process to find them. I call the script and the xmlFile but it didn't work.

Bilbo Beutlin (BBeutlin) 15.06.2020 12:11
If the script is in the map folder it 'should' work.
But most probably the script is intended for placeables which you buy and place later. So the initializing procedure which registers the new objectClass is called too late.
I don't know the script, perhaps contact the author. He should know at best what must be changed.

Doug Williams (Dougw133) 16.06.2020 03:52
Thank you for the reply. This is what I suspected appreciate the feedback. I have tried to contact the dev. It's ok to use the mod/script but not alter it according to the script documentation so perhaps I'll have to write/adapt something.

Thank you

Doug Williams (Dougw133) 17.06.2020 00:33
So, I was actually able to sort this out and it was how i called the class name In the DefaultItems XML

Was doing: <item mapBoundId="liquidFertilizer" className="BuyingStationPlaceable" filename=

What worked since this is a peaceable MOD loading a script via Modesc is:

<item className="FS19_DELTA.ObjectStorage" id="5" modName="FS19_DELTA" filename="$moddir$FS19_DELTA/

I had been calling $mapdir$ instead of $moddir$ and not putting the map mod name before.




Note: Log in to post. Create a new account here.