Accessing Visual Scripting Variables with the Dialogue System

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
FiveIronFanatic
Posts: 2
Joined: Sun Feb 23, 2025 10:12 pm

Accessing Visual Scripting Variables with the Dialogue System

Post by FiveIronFanatic »

Hello!

I'm trying to figure out how to get the Application Variables from my Visual Scripting code to be recognized in the Dialogue System, and none of the methods I've found are working easily for me. Going one way -- Taking variables from the Dialogue System to the Visual Scripting -- works great with the vsEvent*** commands, but I can't figure out how to make it work the other way with VS.

For an example of what I want: the player character is taking a test and the player gets 7 out of 10 questions right. My Visual Scripting code now has 7 set as the correctAnswers integer Application Variable value. How can I get the Dialogue System to have that 7 as a double variable in its space, so the dialogue can react to it appropriately?

I'm not great at C# (which is one of the reasons why I'm using VS!), but if you point me at a .cs to edit, I can do that much, at least. For example, I think I could poke around with the TemplateCustomLua.cs to cobble together a solution that kinda works, but if there's a more Visual Scripting-friendly method, that'd be great for me! (Alternatively, if that is the only/best solution, that'd also be useful info to have!)

Also, I'm currently using the evaluation version until I can confirm that I can figure out this part, in case that's why this is giving me trouble. Everything else has checked all my boxes so far, so cheers for that!
User avatar
Tony Li
Posts: 23256
Joined: Thu Jul 18, 2013 1:27 pm

Re: Accessing Visual Scripting Variables with the Dialogue System

Post by Tony Li »

Hi,

Here's an updated Visual Scripting Support unitypackage:

DS_VisualScriptingSupport_2025-02-24.unitypackage

It adds these Lua functions, which you can type manually or access in the "..." in Conditions fields:
  • vsGetApplicationString("variable"): Returns the value of a string Application Variable.
  • vsGetApplicationBool("variable"): Returns the value of a bool Application Variable.
  • vsGetApplicationFloat("variable"): Returns the value of a float Application Variable.
  • vsGetApplicationInt("variable"): Returns the value of an int Application Variable.
FiveIronFanatic
Posts: 2
Joined: Sun Feb 23, 2025 10:12 pm

Re: Accessing Visual Scripting Variables with the Dialogue System

Post by FiveIronFanatic »

This works perfectly, thank you so much!
User avatar
Tony Li
Posts: 23256
Joined: Thu Jul 18, 2013 1:27 pm

Re: Accessing Visual Scripting Variables with the Dialogue System

Post by Tony Li »

Glad to help! This updated package will also be in DS version 2.2.51.
Post Reply