Solved: Apply Saved Data throws exceptions

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
wysowski_pawel
Posts: 2
Joined: Sun Dec 08, 2019 9:26 am

Solved: Apply Saved Data throws exceptions

Post by wysowski_pawel »

Hello,

I have a problem with loading saved dialogue data from file.
I am using PersistentDataManager.GetSaveData(); to save it to string and then to json file.

To retrieve data I am using method: PersistentDataManager.ApplySavedData(data); but the data isn't loading and the
exception is being thrown.

Am I doing something wrong? :shock:

Code: Select all

'Variable={Alert="", Ego=-2, Actor="Liam", Conversant="John", ActorIndex="Liam", ConversantIndex="John"}; Item["Dinner"]={Name="Dinner", Pictures="[]", Description="", Success_Description="", Failure_Description="", State="active", Is_Item=false, Entry_Count=3, Entry_2_State="success", Entry_2="BuyFood", Entry_3_State="unassigned", Entry_3="Prepare food", Entry_1="Find out what Jerome wants to eat", Entry_1_State="success", }; Item["InventoryShop"]={Name="InventoryShop", Pictures="[]", Description="", Is_Item=true, Tomato=2, Lettuce=3, Cucumber=0, Feta=0, }; Item["Inventory"]={Name="Inventory", Pictures="[]", Description="", Is_Item=true, Tomato=3, Lettuce=0, Cucumber=0, }; Item["DinnerIntro"]={Name="DinnerIntro", Pictures="[]", Description="", Success_Description="", Failure_Description="", State="success", Is_Item=false, }; Item["Cornerstones"]={Name="Cornerstones", Pictures="[]", Description="", Is_Item=true, MailFound=false, JohnConfessed=false, }; Item["LostAndFound"]={Name="LostAndFound", Pictures="[]", Description="", Success_Description="", Failure_Description="", State="unassigned", Is_Item=false, }; Item["Tomato"]={Count=3, }; Item["Cucumber"]={Count=3, }; Item["Lettuce"]={Count=3, }; Item["Feta"]={Count=1, }; Actor={Liam={Name="Liam", Pictures="[]", Description="", IsPlayer=true}, John={Name="John", Pictures="[]", Description="", IsPlayer=false}, Jerome={Name="Jerome", Pictures="[]", Description="", IsPlayer=false}}; Conversation[1]={Title="ShopAssistant", Pictures="[]", Description="", Actor=1, Conversant=2}; Conversation[2]={Title="Jerome_DemoStart", Pictures="[]", Description="", Actor=1, Conversant=3}; Conversation[3]={Title="Jerome", Pictures="[]", Description="", Actor=1, Conversant=3}; Conversation[4]={Title="Dinner/DinnerServed", Pictures="[]", Description="", Actor=1, Conversant=3}; Conversation[5]={Title="Dinner\BarkCooking", Pictures="[]", Description="", Actor=1, Conversant=3}; Conversation[6]={Title="Common/TabletBark", Pictures="[]", Description="", Actor=1, Conversant=3}; Conversation[7]={Title="Common/JeromeHouse/DoorBark", Pictures="[]", Description="", Actor=1, Conversant=3}; Conversation[8]={Title="Common/NoteTipBark", Pictures="[]", Description="", Actor=1, Conversant=3}; Conversation[9]={Title="Common/JeromeHouse/Bear", Pictures="[]", Description="", Actor=1, Conversant=3}; Conversation[10]={Title="Common/JeromeHouse/Bed", Pictures="[]", Description="", Actor=1, Conversant=3}; Conversation[11]={Title="Common/JeromeHouse/Wardrobe", Pictures="[]", Description="", Actor=1, Conversant=3}; Conversation[12]={Title="Common/JeromeHouse/BookShelf", Pictures="[]", Description="", Actor=1, Conversant=3}; Conversation[13]={Title="Common/BlockOfFlats/RandomDoors", Pictures="[]", Description="", Actor=1, Conversant=3}; Conversation[14]={Title="LostAndFound/RobPhoneCall", Pictures="[]", Description="", Actor=1, Conversant=3}; Conversation[15]={Title="LostAndFound/RobFlat", Pictures="[]", Description="", Actor=1, Conversant=3}; Conversation[16]={Title="New Conversation 16", Pictures="[]", Description="", Actor=1, Conversant=2}; Conversation[17]={Title="Dinner/ServeTip", Pictures="[]", Description="", Actor=1, Conversant=2}; StatusTable = ""; RelationshipTable = ""; ' threw exception 'Code has syntax errors:
Line 1, Col 109 'm': Failed to parse Letter of Name.
Line 1, Col 109 'm': Failed to parse Name of VarName.
Line 1, Col 109 'm': Failed to parse 'nil' of NilLiteral.
Line 1, Col 109 'm': Failed to parse Text of BoolLiteral.
Line 1, Col 109 'm': Failed to parse '0'...'9' of Digit.
Line 1, Col 109 'm': Failed to parse (Digit)+ of FloatNumber.
Line 1, Col 109 'm': Failed to parse Name of VariableArg.
Line 1, Col 109 'm': Failed to parse firstTerm of OperatorExpr.
Line 1, Col 109 'm': Failed to parse Expr of ExprStmt.
Line 1, Col 109 'm': Failed to parse Letter of Name.
Line 1, Col 109 'm': Failed to parse Name of VarName.
Line 1, Col 109 'm': Failed to parse 'nil' of NilLiteral.
Line 1, Col 109 'm': Failed to parse Text of BoolLiteral.
Line 1, Col 109 'm': Failed to parse '0'...'9' of Digit.
Line 1, Col 109 'm': Failed to parse (Digit)+ of FloatNumber.
Line 1, Col 109 'm': Failed to parse Name of VariableArg.
Line 1, Col 109 'm': Failed to parse firstTerm of OperatorExpr.
Line 1, Col 109 'm': Failed to parse Expr of ExprStmt.
Line 1, Col 109 'm': Failed to parse Letter of Name.
Line 1, Col 109 'm': Failed to parse Name of VarName.
Line 1, Col 109 'm': Failed to parse 'nil' of NilLiteral.
Line 1, Col 109 'm': Failed to parse Text of BoolLiteral.
Line 1, Col 109 'm': Failed to parse '0'...'9' of Digit.
Line 1, Col 109 'm': Failed to parse (Digit)+ of FloatNumber.
Line 1, Col 109 'm': Failed to parse Name of VariableArg.
Line 1, Col 109 'm': Failed to parse firstTerm of OperatorExpr.
Line 1, Col 109 'm': Failed to parse Expr of ExprStmt.
Line 1, Col 109 'm': Failed to parse Letter of Name.
Line 1, Col 109 'm': Failed to parse Name of VarName.
Line 1, Col 109 'm': Failed to parse 'nil' of NilLiteral.
Line 1, Col 109 'm': Failed to parse Text of BoolLiteral.
Line 1, Col 109 'm': Failed to parse '0'...'9' of Digit.
Line 1, Col 109 'm': Failed to parse (Digit)+ of FloatNumber.
Line 1, Col 109 'm': Failed to parse Name of VariableArg.
Line 1, Col 109 'm': Failed to parse firstTerm of OperatorExpr.
Line 1, Col 109 'm': Failed to parse Expr of ExprStmt.
Line 1, Col 109 'm': Failed to parse Letter of Name.
Line 1, Col 109 'm': Failed to parse Name of VarName.
Line 1, Col 109 'm': Failed to parse 'nil' of NilLiteral.
Line 1, Col 109 'm': Failed to parse Text of BoolLiteral.
Line 1, Col 109 'm': Failed to parse '0'...'9' of Digit.
Line 1, Col 109 'm': Failed to parse (Digit)+ of FloatNumber.
Line 1, Col 109 'm': Failed to parse Name of VariableArg.
Line 1, Col 109 'm': Failed to parse firstTerm of OperatorExpr.
Line 1, Col 109 'm': Failed to parse Expr of ExprStmt.
Line 1, Col 1849 '=': Failed to parse Letter of Name.
Line 1, Col 1849 '=': Failed to parse Name of VarName.
Line 1, Col 1849 '=': Failed to parse 'nil' of NilLiteral.
Line 1, Col 1849 '=': Failed to parse Text of BoolLiteral.
Line 1, Col 1849 '=': Failed to parse '0'...'9' of Digit.
Line 1, Col 1849 '=': Failed to parse (Digit)+ of FloatNumber.
Line 1, Col 1849 '=': Failed to parse Name of VariableArg.
Line 1, Col 1849 '=': Failed to parse firstTerm of OperatorExpr.
Line 1, Col 1849 '=': Failed to parse Expr of ExprStmt.
Line 1, Col 1849 '=': Failed to parse remaining input.
'
UnityEngine.Debug:LogError(Object)
PixelCrushers.DialogueSystem.Lua:RunRaw(String, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:219)
PixelCrushers.DialogueSystem.Lua:Run(String, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:120)
PixelCrushers.DialogueSystem.Lua:Run(String, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:130)
PixelCrushers.DialogueSystem.PersistentDataManager:ApplySaveData(String, DatabaseResetOptions) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Save System/PersistentDataManager.cs:236)
SaveController:Load() (at Assets/Scripts/Core/Services/SaveController.cs:107)
GameController:StartGame() (at Assets/Scripts/Core/Services/GameController.cs:47)
Last edited by wysowski_pawel on Sun Dec 08, 2019 10:10 am, edited 1 time in total.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Apply Saved Data throws exceptions

Post by Tony Li »

Hi,

This conversation title has a backslash instead of a forward slash: Dinner\BarkCooking. This causes it to think the title has a backslash character (\b) in it, which it doesn't know how to handle.

Can you change it to Dinner/BarkCooking?

In the next update, I'll add code to handle backslash characters properly.
wysowski_pawel
Posts: 2
Joined: Sun Dec 08, 2019 9:26 am

Re: Apply Saved Data throws exceptions

Post by wysowski_pawel »

Hi Tony,

thanks for quick reply.
You are helpful as always!
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Solved: Apply Saved Data throws exceptions

Post by Tony Li »

Happy to help!
Post Reply