hello, I'm like the editor being nice and simple to get a dialogue typing but getting confused about how each "label" communicates in JSON. what I mean by this is after you export to JSON and try to get it to write the logic (I use construct 3 ) I can't see how I go from one dialogue label to another without adding my own key(next) in the JSON to tell the JSON where to go after the dialogue is finished and I want another character to talk and since every single label goes into it own uh brackets I can't have the text and name change at the same time because of needing a next.
Thanks for getting the tool, I'm glad you're liking it!
The way I intended the data to be used is (if you're using one file for all the dialogue) to use the dialogue key (the dialogue name) to get to the correct point in the dialogue file. If it's separate files then just open the correct file. From there you'll notice the exports use numbers that then store a dictionary within it. I'd use a makeshift for loop to go through all the numbers. For each number I'd first check the LABEL and call the corresponding function that matches the label. So a dialogue label would call the dialogue function that takes in the VARIABLES as parameters as well as the array of DATA. How you'd go through the data will vary on how you want the label to work in game, but an example for multi-line dialogue would be to use a makeshift for loop, showing one line of dialogue at a time, and whenever the player presses next it continues through the makeshift for loop until it reaches the end and moves onto the next number until it eventually reaches the end of the dialogue. When you run into a label it'll store the number that corresponds to where that label starts. So you'd just jump ahead in the makeshift for loop with that number.
Currently Godot and Unity addons are my top priority since I use them the most and I imagine they'd be the most popular, although if another engine has more popularity I'll look into doing it first. Construct will probably take me some time as I've never used the engine personally and have limited experience with Javascript :)
I included a screenshot of an example of the JSON output with numbers to indicate the order you'd go through it as well as some quick pseudo code. Hope this helps clear it up, feel free to ask if it's still confusing!
// Pseudo Code
variables
- spotInFile = 0
- spotInDialogueLines = 0
- dialogueKey : String
--- (this is for formatting purposes)
start_dialogue function that initializes a new dialogue with the key/dialogue file as a parameter
spotInFile = 0
dialogueKey = _key
play_dialogue(dialogueKey)
---
play_dialogue function
switch statement to call the corresponding function based on the label (ie. switch dialogueFile[dialogueKey][str(spotInFile)])
ex. DIALOGUE: call_dialogue()
---
finish_dialogue function that adds to the spot in file and ends the dialogue if it's completed or continues it
spotInFile += 1
if spotInFile > dialogueFile[dialogueKey].size():
finish dialogue
else:
play_dialogue
---
call_dialogue function that takes the variables and data as a parameter (ie. func dialogue_label(_typeOn : bool, _lines : Array[String]))
set a global variable that says dialogue is currently playing
call the specific line you need from the data array, starting at 0
wait for input from player to move on with the dialogue
once gotten input, add to the spotInDialogueLines and check if reached end of DATA array (ie. spotInDialogueLines += 1 > _lines.size())
if no then play this function again
if yes then go back to the finish_dialogue()
ok thank you for the reply I'll try to apply what you said to construct js since event sheet is not compatible with with looping and getting key values
← Return to tool
Comments
Log in with itch.io to leave a comment.
hello, I'm like the editor being nice and simple to get a dialogue typing but getting confused about how each "label" communicates in JSON. what I mean by this is after you export to JSON and try to get it to write the logic (I use construct 3 ) I can't see how I go from one dialogue label to another without adding my own key(next) in the JSON to tell the JSON where to go after the dialogue is finished and I want another character to talk and since every single label goes into it own uh brackets I can't have the text and name change at the same time because of needing a next.
an example of this can be seen here: https://www.construct.net/en/tutorials/branching-dialogue-using-json-2395?vic=36
for a dialogue designer example which is where I found you can be found :
https://www.construct.net/en/tutorials/dialogue-designer-construct-2624
if you are making a Construct 3 plugin soon then you can ignore this thanks for the program
Thanks for getting the tool, I'm glad you're liking it!
The way I intended the data to be used is (if you're using one file for all the dialogue) to use the dialogue key (the dialogue name) to get to the correct point in the dialogue file. If it's separate files then just open the correct file. From there you'll notice the exports use numbers that then store a dictionary within it. I'd use a makeshift for loop to go through all the numbers. For each number I'd first check the LABEL and call the corresponding function that matches the label. So a dialogue label would call the dialogue function that takes in the VARIABLES as parameters as well as the array of DATA. How you'd go through the data will vary on how you want the label to work in game, but an example for multi-line dialogue would be to use a makeshift for loop, showing one line of dialogue at a time, and whenever the player presses next it continues through the makeshift for loop until it reaches the end and moves onto the next number until it eventually reaches the end of the dialogue. When you run into a label it'll store the number that corresponds to where that label starts. So you'd just jump ahead in the makeshift for loop with that number.
Currently Godot and Unity addons are my top priority since I use them the most and I imagine they'd be the most popular, although if another engine has more popularity I'll look into doing it first. Construct will probably take me some time as I've never used the engine personally and have limited experience with Javascript :)
I included a screenshot of an example of the JSON output with numbers to indicate the order you'd go through it as well as some quick pseudo code. Hope this helps clear it up, feel free to ask if it's still confusing!
ok thank you for the reply I'll try to apply what you said to construct js since event sheet is not compatible with with looping and getting key values