Show Lua variable on screen with UI Textmeshpro
-
- Posts: 9
- Joined: Thu Mar 21, 2024 5:07 pm
Show Lua variable on screen with UI Textmeshpro
Hello.
I'm trying to put my Dialogue Manager variables on the UI screen with Textmeshpro.
But everything I do never works
Would appreciate any feedback on how to get this to work. Thanks.
I'm trying to put my Dialogue Manager variables on the UI screen with Textmeshpro.
But everything I do never works
Would appreciate any feedback on how to get this to work. Thanks.
- Attachments
-
- My C# script
- 20240321_172259 (1).jpg (945.42 KiB) Viewed 540 times
-
- Posts: 9
- Joined: Thu Mar 21, 2024 5:07 pm
Re: Show Lua variable on screen with UI Textmeshpro
I posted that line in (void Update()). And it worked great.
Thank you very much. You saved me a ton of headache.
Thank you very much. You saved me a ton of headache.
Re: Show Lua variable on screen with UI Textmeshpro
Glad to help!
Tip: If you want to optimize, instead of using Update() monitor the variable for changes: Monitor Variable Value Changes
Tip: If you want to optimize, instead of using Update() monitor the variable for changes: Monitor Variable Value Changes
-
- Posts: 9
- Joined: Thu Mar 21, 2024 5:07 pm
Re: Show Lua variable on screen with UI Textmeshpro
Thanks, your the best.
Also, is it possible to do (If Statements) with the lua variables in C# Script?
Also, is it possible to do (If Statements) with the lua variables in C# Script?
Re: Show Lua variable on screen with UI Textmeshpro
Hi,
Yes. In C#:
In Lua Conditions:
Yes. In C#:
Code: Select all
if (DialogueLua.GetVariable("Coin").asInt > 50)
{
CommentText.text = "Wow, you're rich!";
}
- Conditions: Variable["Coin"] < 50
- Dialogue Text: "Sorry, you don't have enough coin to purchase that."
-
- Posts: 9
- Joined: Thu Mar 21, 2024 5:07 pm
Re: Show Lua variable on screen with UI Textmeshpro
I keep getting an error when I type that line of code in?
Operator '>' cannot be applied to operands of type 'Lua.Result' and 'into.
Operator '>' cannot be applied to operands of type 'Lua.Result' and 'into.
- Attachments
-
- 20240323_145111 (1) (1).jpg (900.66 KiB) Viewed 484 times
-
- Posts: 9
- Joined: Thu Mar 21, 2024 5:07 pm
Re: Show Lua variable on screen with UI Textmeshpro
Also I'll take an example of the in-line conditionals as well.
For future references.
For future references.
Re: Show Lua variable on screen with UI Textmeshpro
Sorry, I fixed the typo above. I had forgotten to type ".asInt" at the end.
Please see the Conditional() function for an example of in-line.
Please see the Conditional() function for an example of in-line.
-
- Posts: 9
- Joined: Thu Mar 21, 2024 5:07 pm
Re: Show Lua variable on screen with UI Textmeshpro
Awesome! It worked. Thanks man.
Without your help I would seriously be lost.
Without your help I would seriously be lost.