Hello !
i'm stuck with some compatibility issues with Ork & Playmaker.
i think it may be just me writing Lua command the wrong way but i tried severals thing without success.
Does anyone have a clue ?
Ork question :
1) Is there a way to sub or add a currency quantity ? (smthg like : orkSetCurrency("Player", "Gold", -30) )
Playmaker questions :
2) What would be the correct syntax for FSMEvent(eventName:string, objectName:string, fsmName:string)
i tried this without success :
- FSMEvent("eventName","","")
- FSMEvent("eventName","objectname","fsmname")
The only way i got it to work was with the Sequencer (FSMEvent(EventName, objectName) )
3) i tried GetFsmInt(variableName:string) with the Lua Console but got no return.
i also tried writing it as GetFsmInt(variableName)
Ork & Playmaker Lua questions
Re: Ork & Playmaker Lua questions
Hi,
If the Door GameObject has more than one FSM, you can specify it in the third parameter instead of the blank "" string.
The ORK Lua Functions don't include a built-in function to increment or decrement currency. If you don't want to write your own, you can use a combination of Get and Set:
Code: Select all
orkSetCurrency("Player", "Gold", orkGetCurrency("Player", "Gold") - 30)
Say you have a GameObject named "Door" with a single FSM, and that FSM responds to an event "Open". Then you can use this Lua command:Wiik wrote: ↑Sat Jul 29, 2023 11:33 am2) What would be the correct syntax for FSMEvent(eventName:string, objectName:string, fsmName:string)
i tried this without success :
- FSMEvent("eventName","","")
- FSMEvent("eventName","objectname","fsmname")
The only way i got it to work was with the Sequencer (FSMEvent(EventName, objectName) )
Code: Select all
FSMEvent("Open", "Door", "")
Say you have a PlayMaker global int variable named "Score". You should be able to get it like this:
Code: Select all
ShowAlert("Your score: " .. GetFsmInt("Score"))
Re: Ork & Playmaker Lua questions
Thanks Tony,
1) Works like a charm
2 & 3 ) i thinks this may not work in my project.
I have a "Map" GameObject in my scene with one FSM and a global event named "WorldMap TP" in it.
What i wrote in the Lua Console : FSMEvent("TP Gold Cost", "Map", "")
The result :
3)i got the same error as 2)
4) Also i tried using this solution to randomize my dialogue https://www.pixelcrushers.com/phpbb/viewtopic.php?t=374
But the Script randomValue=math.random(3) gives me this :
1) Works like a charm
2 & 3 ) i thinks this may not work in my project.
I have a "Map" GameObject in my scene with one FSM and a global event named "WorldMap TP" in it.
What i wrote in the Lua Console : FSMEvent("TP Gold Cost", "Map", "")
The result :
Code: Select all
Dialogue System: Lua code 'FSMEvent("WorldMap TP", "Map", "")' threw exception 'Tried to invoke a function call on a non-function value. If you're calling a function, is it registered with Lua?'
UnityEngine.Debug:LogError (object)
PixelCrushers.DialogueSystem.Lua:RunRaw (string,bool,bool) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:250)
PixelCrushers.DialogueSystem.Lua:Run (string,bool,bool) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:129)
PixelCrushers.DialogueSystem.Lua:Run (string,bool) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:139)
PixelCrushers.DialogueSystem.LuaConsole:RunLuaCommand () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Utility/LuaConsole.cs:177)
PixelCrushers.DialogueSystem.LuaConsole:DrawConsoleWindow (int) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Utility/LuaConsole.cs:135)
UnityEngine.GUI:CallWindowDelegate (UnityEngine.GUI/WindowFunction,int,int,UnityEngine.GUISkin,int,single,single,UnityEngine.GUIStyle)
4) Also i tried using this solution to randomize my dialogue https://www.pixelcrushers.com/phpbb/viewtopic.php?t=374
But the Script randomValue=math.random(3) gives me this :
Code: Select all
Dialogue System: Lua code 'return Conditions: randomValue==3' threw exception 'Code has syntax errors:
Line 1, Col 18 ':': Failed to parse Letter of Name.
Line 1, Col 18 ':': Failed to parse Name of VarName.
Line 1, Col 18 ':': Failed to parse 'nil' of NilLiteral.
Line 1, Col 18 ':': Failed to parse Text of BoolLiteral.
Line 1, Col 18 ':': Failed to parse '0'...'9' of Digit.
Line 1, Col 18 ':': Failed to parse (Digit)+ of FloatNumber.
Line 1, Col 18 ':': Failed to parse Name of VariableArg.
Line 1, Col 18 ':': Failed to parse firstTerm of OperatorExpr.
Line 1, Col 18 ':': Failed to parse Expr of ExprStmt.
Line 1, Col 18 ':': Failed to parse remaining input.
Re: Ork & Playmaker Lua questions
Hi,
Make sure you've added the "Dialogue System PlayMaker Lua" component to your Dialogue Manager. This will make the FSMEvent() Lua function available.
For the random stuff, use this format in your Script field:
And format your Conditions fields like this:
(No "Conditions:" in your Script field or Conditions field.)
Make sure you've added the "Dialogue System PlayMaker Lua" component to your Dialogue Manager. This will make the FSMEvent() Lua function available.
For the random stuff, use this format in your Script field:
Code: Select all
randomValue = math.random(3)
Code: Select all
randomValue == 3
Re: Ork & Playmaker Lua questions
Thanks a lot Tony.
Can't believe i didn't notice the Playmaker Lua was missing
Everything works fine now.
Just to let you know : Leaving an empty objectName for a Script: FSMevent doesn't work
i had to write the objectName or write All
Can't believe i didn't notice the Playmaker Lua was missing
Everything works fine now.
Just to let you know : Leaving an empty objectName for a Script: FSMevent doesn't work
i had to write the objectName or write All
Re: Ork & Playmaker Lua questions
Thanks. I've fixed the the FSMEvent() docs for the next release.