I have started getting a strange error when saving my dungeon in game after an export. It appears to save ok but I get this at the top:
Warning: Game object property not saved: lib_scr.script._userProperties
"lib_scr" is name of a script entity in my dungeon, one I have had from day 1. Now all of a sudden it is having trouble? I have no idea what "_userProperties" is. It is nothing I defined. Anybody seen this one before?
[Solved] Warning saving: "game object property not saved"
[Solved] Warning saving: "game object property not saved"
Last edited by MrChoke on Mon Feb 02, 2015 3:18 pm, edited 1 time in total.
Re: Warning while saving "game object property not saved"
Someone wrote about not using global but local variables as they can give save errors. Have you tried making all variables local?
Re: Warning while saving "game object property not saved"
This literally could not be more wrong. Here's an explanation of saving variables that isn't wrong, but it doesn't touch on this particular issue because I haven't figured out exactly what it is yet.Frenchie wrote:Someone wrote about not using global but local variables as they can give save errors. Have you tried making all variables local?
I am pretty sure that _userProperties is the ScriptComponent's table used for storing its variables; it's why "script_entity_1.script.variable" works. Are you doing anything weird with the ScriptComponent or its parent game object? For example, minimalSaveState would probably prevent that property from being saved.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Warning while saving "game object property not saved"
For sure, it has nothing to do with the all of the pitfalls when global variables are used incorrectly or trying to save a game object, etc... I am painfully aware of these and have fought them throughout my work. When you make this mistake the game crashes upon save. The error I am referring to here is not crashing the game.
I am at a loss right now on this. From what I can tell, the game saves fine. I can reload it and all of the entity states I looked for are correct (doors are open when they should be, party is holding the objects they should be, etc...). I also notice that it only happens upon the first save. Subsequent saves do not give the error. Also, it doesn't matter where I am when I save.
I compared changes in my "lib_scr" script from about a week ago which is when I did the last export and hadn't seen the warning. The changes were trivial. Whatever this is, I do not think it is coming from lib_scr, even though that is script referenced in the error. Note, that all of my scripts are defined as external (in separate LUA files). Not sure if that even matters.
@Minmay, I do use minimalState on some objects but not script_entity. I have no customization whatsoever with any of my script_entity objects. I am certain that variables are being saved in lib_scr as well. If not, my dungeon would crash and burn immediately upon reload.
I guess I will just live with it for now but anybody that ends up playing my dungeon (if I ever finish it!!) will get this warning. This one may need feedback from AH. Ugh.
I am at a loss right now on this. From what I can tell, the game saves fine. I can reload it and all of the entity states I looked for are correct (doors are open when they should be, party is holding the objects they should be, etc...). I also notice that it only happens upon the first save. Subsequent saves do not give the error. Also, it doesn't matter where I am when I save.
I compared changes in my "lib_scr" script from about a week ago which is when I did the last export and hadn't seen the warning. The changes were trivial. Whatever this is, I do not think it is coming from lib_scr, even though that is script referenced in the error. Note, that all of my scripts are defined as external (in separate LUA files). Not sure if that even matters.
@Minmay, I do use minimalState on some objects but not script_entity. I have no customization whatsoever with any of my script_entity objects. I am certain that variables are being saved in lib_scr as well. If not, my dungeon would crash and burn immediately upon reload.
I guess I will just live with it for now but anybody that ends up playing my dungeon (if I ever finish it!!) will get this warning. This one may need feedback from AH. Ugh.
Re: Warning while saving "game object property not saved"
I finally figured this out. It turns out it was code in my lib_scr after all. It was incorrect use of "self" it seems. I had code like this in a function defined in lib_scr:
Because I had moved this code out of a function where self was a function parameter, I should have re-written it to say:
I messed up and used self in the context outside of the function, self now refers to lib_scr. The game does not like me adding new variables to the "self" it gives me for the script_entity. Perhaps I could have done:
I kind of doubt even that would have been ok. The error the game gives upon save was telling me it was going ignore the extra variables I attached directly to lib_scr.
Code: Select all
self.numToKeepOpen = 1
Code: Select all
roomObject.numToKeepOpen = 1
Code: Select all
self.go.numToKeep = 1
Re: [Solved] Warning saving: "game object property not saved
SourceProzail wrote:self.done is a bit of a trick. You can create variables dynamically on the proxy-object, and i use it here to make sure the event only fires once, not for each party-member. Beware though, anything you create like this IS NOT SAVED IN A SAVEGAME. So only use it for temporary storage, where it doesn't matter.
Re: [Solved] Warning saving: "game object property not saved
I looked at that thread. In the example, "self" was passed into a function. So it could have been anything without seeing the calling code. . "self" in my code for certain was referred to the script_entity object. I do agree that storing variables onto the script entity is ok temporarily (if I wasn't I would have caught the problem 2 days earlier) but I question why you would ever want to. You must remember you clear them to nil before you are done using them or you will get the warning I was getting when you save.Batty wrote:SourceProzail wrote:self.done is a bit of a trick. You can create variables dynamically on the proxy-object, and i use it here to make sure the event only fires once, not for each party-member. Beware though, anything you create like this IS NOT SAVED IN A SAVEGAME. So only use it for temporary storage, where it doesn't matter.