Need help at updating saved simstatus

Announcements, support questions, and discussion for the Dialogue System.
RX-310
Posts: 22
Joined: Tue Jan 21, 2020 7:50 pm

Need help at updating saved simstatus

Post by RX-310 »

My game's saving the simstatus values to the save data, but when the dialogue database is updated, chances the game encounters
Lookup of field 'SimStatus' in the table element failed because the table element itself isn't in the table.
error until I manually remove the save data. Is there any solution to make the dialogue system automatically update the simstatus values saved in save data when there's a change on dialogue database?
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Need help at updating saved simstatus

Post by Tony Li »

Hi,

Make sure the Dialogue System's Persistent Data Settings > Initialize New Variables is ticked. This also initializes new quests and new dialogue entry SimStatus values that weren't present when the game was saved.
RX-310
Posts: 22
Joined: Tue Jan 21, 2020 7:50 pm

Re: Need help at updating saved simstatus

Post by RX-310 »

I already have it ticked, but the error still persist.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Need help at updating saved simstatus

Post by Tony Li »

Hi,

What version of the Dialogue System are you using?
RX-310
Posts: 22
Joined: Tue Jan 21, 2020 7:50 pm

Re: Need help at updating saved simstatus

Post by RX-310 »

version 2.2.4
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Need help at updating saved simstatus

Post by Tony Li »

Hi,

Can you try backing up your project and updating to version 2.2.7?

The release notes from 2.2.4 to 2.2.7 don't contain anything specific to the issue you're seeing, but that way we'll both be looking at the same version. And maybe there's a different root cause that version 2.2.7 will address.

Would it be possible for you to send a reproduction project and steps to reproduce the issue to tony (at) pixelcrushers.com?
RX-310
Posts: 22
Joined: Tue Jan 21, 2020 7:50 pm

Re: Need help at updating saved simstatus

Post by RX-310 »

Here's the full log of the error I talked about

Code: Select all

Dialogue System: Lua code 'Variable["DialogResult"] = "ChangeAffinity:"..Dialog[4].SimStatus..":";' threw exception 'Lookup of field 'SimStatus' in the table element failed because the table element itself isn't in the table.'
UnityEngine.Debug:LogError(Object)
PixelCrushers.DialogueSystem.Lua:RunRaw(String, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter Wrapper/Lua.cs:226)
PixelCrushers.DialogueSystem.Lua:Run(String, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter Wrapper/Lua.cs:127)
PixelCrushers.DialogueSystem.ConversationModel:GetState(DialogueEntry, Boolean, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Model-View-Controller/Model/Logic/Conversation Model/ConversationModel.cs:233)
PixelCrushers.DialogueSystem.ConversationModel:GetState(DialogueEntry) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Model-View-Controller/Model/Logic/Conversation Model/ConversationModel.cs:297)
PixelCrushers.DialogueSystem.ConversationController:OnFinishedSubtitle(Object, EventArgs) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Model-View-Controller/Controller/ConversationController.cs:224)
PixelCrushers.DialogueSystem.ConversationView:FinishSubtitle() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Model-View-Controller/View/Conversation View/ConversationView.cs:391)
PixelCrushers.DialogueSystem.ConversationView:HandleContinueButtonClick() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Model-View-Controller/View/Conversation View/ConversationView.cs:363)
PixelCrushers.DialogueSystem.ConversationView:OnConversationContinue(IDialogueUI) (at Assets/Plugins/Pixel Crushers/Dialogue Syste
The ChangeAffinity is what triggered the error because the method checks for simStatus value, but it's as if the dialogue system is unable to find the specific table because the loaded simstatus table from before the database is updated/chnaged is different to the one currently used when the error is happening.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Need help at updating saved simstatus

Post by Tony Li »

Are you by any chance loading the saved game while the conversation is active?

If not, would it be possible for you to send me a reproduction project?
RX-310
Posts: 22
Joined: Tue Jan 21, 2020 7:50 pm

Re: Need help at updating saved simstatus

Post by RX-310 »

I'm afraid it's not possible to send a reproduction project since the base project size is very big, but I don't do any loading during the conversation. It's done from a save point.

For saving the simstatus values, I'm using PersistentDataManager.GetSaveData() for saving and PersistentDataManager.ApplySaveData(simStatusString) for loading, is there anything I did wrong at saving/loading the values?


From my tinkering with ApplySaveData it seems the InitializeNewSimStatusFromDatabase isn't being called despite I always have initialize new variables ticked, do I miss anything? Also what is SAFE_SIMSTATUS?
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Need help at updating saved simstatus

Post by Tony Li »

The InitializeNewSimStatus() method isn't used. Instead, as indicated in the method's comment, the ExpandSimStatusForConversation() method also initializes new SimStatus, This method is called diretcly in ApplySaveData().

The SAFE_SIMSTATUS define is mostly a debugging tool. When applying save data, it logs what it's setting SimStatus to. It also does an unoptimized method of initializing new SimStatus values, which is only necessary if you're replacing the built-in LuaInterpreter implementation of Lua with a different Lua implementation.

One other thing occurred to me: Are you using multiple databases?
Post Reply