Constant Syntax Errors

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
bluebuttongames
Posts: 91
Joined: Tue Jul 14, 2015 8:22 am

Constant Syntax Errors

Post by bluebuttongames »

Hi there,

I'm having a lot of issues with syntax errors being thrown, when the code is seemingly squeaky clean.

Here's an example (goes on for way longer than this):


In Editor:
["Quest_Sloth_KillRabbits"].MoralityChoice = 1;
SetQuestState("Quest_Sloth_KillRabbits", "active");
SetQuestEntryState("Quest_Sloth_KillRabbits", 1, "active")

Debug log:
Dialogue System: Lua code '["Quest_Sloth_KillRabbits"].MoralityChoice = 1;
SetQuestState("Quest_Sloth_KillRabbits", "active");
SetQuestEntryState("Quest_Sloth_KillRabbits", 1, "active")' threw exception 'Code has syntax errors:
Line 3, Col 9 'E': Failed to parse Letter of Name.
Line 3, Col 9 'E': Failed to parse Name of VarName.
Line 3, Col 9 'E': Failed to parse 'nil' of NilLiteral.
Line 3, Col 9 'E': Failed to parse Text of BoolLiteral.
Line 3, Col 9 'E': Failed to parse '0'...'9' of Digit.
Line 3, Col 9 'E': Failed to parse (Digit)+ of FloatNumber.
Line 3, Col 9 'E': Failed to parse Name of VariableArg.
Line 3, Col 9 'E': Failed to parse firstTerm of OperatorExpr.
Line 3, Col 9 'E': Failed to parse Expr of ExprStmt.
Line 3, Col 9 'E': Failed to parse Letter of Name.
Line 3, Col 9 'E': Failed to parse Name of VarName.
Line 3, Col 9 'E': Failed to parse 'nil' of NilLiteral.
Line 3, Col 9 'E': Failed to parse Text of BoolLiteral.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Constant Syntax Errors

Post by Tony Li »

Hi,

It's strange that it's complaining about the "E" of SetQuestEntryState("Quest_Sloth_KillRabbits", 1, "active"). Maybe there's a blank space character between SetQuest and Entry. However, I do see one issue that may have just been a copy-paste issue in your post. Please try this:

Code: Select all

Quest["Quest_Sloth_KillRabbits"].MoralityChoice = 1;
SetQuestState("Quest_Sloth_KillRabbits", "active");
SetQuestEntryState("Quest_Sloth_KillRabbits", 1, "active")
The first line was missing "Quest" at the beginning.
bluebuttongames
Posts: 91
Joined: Tue Jul 14, 2015 8:22 am

Re: Constant Syntax Errors

Post by bluebuttongames »

It was the space between , and "active". I wasn't aware that would be such an issue,

SetQuestState("Quest_Sloth_KillRabbits", "active");
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Constant Syntax Errors

Post by Tony Li »

Hmm, that shouldn't have been a problem. Maybe it was a strange space character and not the normal space character. Anyway, glad it's working now.
bluebuttongames
Posts: 91
Joined: Tue Jul 14, 2015 8:22 am

Re: Constant Syntax Errors

Post by bluebuttongames »

So new problem!

Dialogue System: Lua code 'mugFight(1);' threw exception 'Invoke function call on non function value.'
0x00000001417A7BEB (Unity) StackWalker::GetCurrentCallstack
0x00000001417A98CF (Unity) StackWalker::ShowCallstack
0x0000000141783D10 (Unity) GetStacktrace
0x0000000140D40EEB (Unity) DebugStringToFile
0x0000000140D416CC (Unity) DebugStringToFile
0x0000000141403892 (Unity) DebugLogHandler_CUSTOM_Internal_Log
0x00000000387D640B (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,string,UnityEngine.Object)
0x00000000387D62F4 (Mono JIT Code) [DebugLogHandler.cs:9] UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
0x00000000387D5C6F (Mono JIT Code) [Logger.cs:41] UnityEngine.Logger:Log (UnityEngine.LogType,object)
0x000000004B11F907 (Mono JIT Code) [DebugBindings.gen.cs:124] UnityEngine.Debug:LogError (object)
0x00000000387911C9 (Mono JIT Code) PixelCrushers.DialogueSystem.Lua:RunRaw (string,bool,bool)
0x0000000038790C62 (Mono JIT Code) PixelCrushers.DialogueSystem.Lua:Run (string,bool,bool)
0x000000004B0B3211 (Mono JIT Code) PixelCrushers.DialogueSystem.ConversationModel:GetState (PixelCrushers.DialogueSystem.DialogueEntry,bool,bool,bool)
0x000000004B0DE745 (Mono JIT Code) PixelCrushers.DialogueSystem.ConversationModel:GetState (PixelCrushers.DialogueSystem.DialogueEntry)
0x000000004B0DE29F (Mono JIT Code) PixelCrushers.DialogueSystem.ConversationController:OnFinishedSubtitle (object,System.EventArgs)
0x000000004B0DD465 (Mono JIT Code) PixelCrushers.DialogueSystem.ConversationView:FinishSubtitle ()
0x000000004B0DD1BD (Mono JIT Code) PixelCrushers.DialogueSystem.ConversationView:OnFinishedSubtitle ()
0x000000004B0DD045 (Mono JIT Code) PixelCrushers.DialogueSystem.Sequencer:FinishSequence ()
0x000000004B0DC17B (Mono JIT Code) PixelCrushers.DialogueSystem.Sequencer:Update ()
0x0000000000718262 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007FFE966D5737 (mono) [mini.c:4937] mono_jit_runtime_invoke
0x00007FFE96628435 (mono) [object.c:2623] mono_runtime_invoke
0x00000001410688B5 (Unity) scripting_method_invoke
0x000000014105E1A1 (Unity) ScriptingInvocation::Invoke
0x00000001414A24EB (Unity) MonoBehaviour::CallMethodIfAvailable
0x00000001414A65EF (Unity) MonoBehaviour::CallUpdateMethod
0x0000000140AC5C06 (Unity) BaseBehaviourManager::CommonUpdate<BehaviourManager>
0x0000000140AC67FF (Unity) BehaviourManager::Update
0x0000000140D75EC7 (Unity) PlayerLoop
0x000000014172338E (Unity) Application::UpdateScene
0x0000000141724B5F (Unity) Application::UpdateSceneIfNeeded
0x000000014172D3DA (Unity) Application::TickTimer
0x00000001417F94DC (Unity) CrashCallback
0x00000001417FB124 (Unity) WinMain
0x0000000141AE063C (Unity) strnlen
0x00007FFEED9F4034 (KERNEL32) BaseThreadInitThunk
0x00007FFEEDB43691 (ntdll) RtlUserThreadStart

Here's how that looks in the editor:
Attachments
editor.PNG
editor.PNG (7.42 KiB) Viewed 923 times
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Constant Syntax Errors

Post by Tony Li »

Hi,

That means mugFight isn't currently registered as a Lua function.
Post Reply