Original Discord Post by mattiavitali | 2024-10-29 15:18:29
Hi, I’m working on creating an application using Convai NPC. I noticed that I can activate functions through the start and end events in narrative design. However, I haven’t found anything about returning a value. Is it possible for the Convai NPC to return one or more values, allowing me to avoid a more hard-coded approach?
Example: I ask the NPC to recommend a place for holidays, and it suggests “LocationVariable”. Right after, I want to trigger a function in the narrative design section end event and use the “LocationVariable” that the NPC returned. I was wondering if there’s a way to determine a variable directly, or if I need to work around the issue by parsing the strings in the NPC’s response.
<@1023671043287699568> Sorry if I’m being too pushy, but I need to know this to structure my next implementation at work. If you can, please respond ASAP.
Reply by mattiavitali | 2024-10-29 16:58:12
hello <@1023671043287699568> sure there it is:
Example: I ask the NPC to recommend a place for holidays, and it suggests “LocationVariable”. Right after, I want to trigger a function in the narrative design section end event and use the “LocationVariable” that the NPC returned. I was wondering if there’s a way to determine a variable directly, or if I need to work around the issue by parsing the strings in the NPC’s response.
Reply by k3kalinix | 2024-10-31 08:33:57
Unfortunately, you have to find it, but if you want to update the variable dynamically you can check our Narrative Design Keys,
Embedded Content: Narrative Design Keys | Documentation
This guide shows how to dynamically pass variables to the Narrative Design section and triggers.
Link: Narrative Design Keys | Documentation