

Scene tree and File Dialog properties in case something here matters.
extends VBoxContainer
var block = preload("res://DialogueBlock.tscn")
onready var bar = get_parent().get_v_scrollbar()
var rex = RegEx.new()
var pattern = "(?m)(?:^.*$\\n?){1,3}"
onready var dialog = $"../../FileDialog"
onready var title = $"../../DialogueTitle/Title"
onready var option = $"../../Panel/MarginContainer/VBoxContainer/Lang"
onready var actors = $"../../Panel/MarginContainer/VBoxContainer/ActorList/VBoxContainer"
onready var tree = dialog.get_vbox().get_child(2).get_child(0)
var current = ""
var format = "*%s.txt"
var langs = ['english', 'japanese', 'korean', 'chinesesimplified', 'chinesetraditional']
var langidx = 0
func _ready():
rex.compile(pattern)
bar.share(get_node("/root/Control/VScrollBar"))
tree.focus_next = dialog.get_ok().get_path()
dialog.get_close_button().focus_next = tree.get_path()
option.connect("item_selected", self, "_change_language")
for lang in langs.size():
option.set_item_metadata(lang, format % langs[lang])
I wound up building almost everything on one script (it's a fairly simple program so there's not a lot of moving parts). As far as I can tell, this is the only part of the code that seems to run. The regex pattern is for splitting up edge cases on the dialogue where it contains more than 3 lines. (I have to come up with a different method fr this anyway).
func _on_PanelContainer_pressed():
dialog.popup()
for child in dialog.get_vbox().get_children():
if !child is MarginContainer:
child.visible = false
child.focus_mode = FOCUS_NONE
var line = tree.get_item_at_position(Vector2.ZERO)
while line:
line.set_text(0, line.get_text(0).trim_suffix('_dialog_%s.txt' % langs[langidx]))
var character = ''
var test = line.get_text(0).split('_')
if test[0] == 'char' and not test[1][0] in ['d', 'f']:
character = '%s: ' % TranslationServer.translate(test[1])
line.set_text(0, '%s%s' % [character, TranslationServer.translate(line.get_text(0))])
line = line.get_next()
This pops up the FileDialog and changes all of the text from the TreeItems. I decided to use the Translation system as potentially I could switch the language of the program if necessary. I am only working with English in order to associate the name of the file with the name of the contents here.
This project is setup to work with predefined data pulled from .txt files. I'm working on rebuilding the project to utilize a custom resource rather than trying to create a dictionary from a string pulled from a text file at run time. Mind you - that part of the script is not even reached, which is why I'm not posting it. The FileDialog signal callback just never fires.
func _on_FileDialog_file_selected(path):
print(path)
current = path.get_file().trim_suffix("%s.txt" % langs[langidx])
clear_box()
get_parent().scroll_vertical = 0
yield(get_tree().create_timer(.001),"timeout")
title.text = path.get_file().trim_suffix("_dialog_%s.txt" % langs[langidx])
print(title.text)
eval(get_data(path))
This is supposed to run off of the item_selected signal from the FileDialog. I never get to the point of the FileDialog even printing and it doesn't close and throw an error, so there is nothing beyond this point to really share - it fails before this point.
By Fail I mean that the Open button does nothing. I can click it, I can double click files. The FileDialog doesn't attempt to close, nor does the print at the start of the callback fire. The Close button is fully functional in closing the FileDialog and I can re-open the dialog, so the project is still in full functioning order. I receive no feedback from the Debug Window about the situation.
I've made sure that I have included the *.txt files into the export and even looked into the exported file to see that the data in the files is included into it. You can see from the application screenshot it can see the resource folder that holds those files.
Again, as a reminder - this problem is specific to when I BUILD the project. In editor this program works 100% without issue. I see no reason why between the editor and the BUILD the signal callback would cease to work.