So i have most system set up im just at loss on make it so that the player has to click through the dialog. Currently all the dialog is stored in text files that are read into dictionary's like so.

var dic = {}

func test():
    var index = 1
    var line = dic[str(index)]

#loads file into dictionary
func load_file(filepath):
    dic = {}
    var file = File.new()
    file.open(filepath, 1)
    var index = 1
    while not file.eof_reached():
        var line = file.get_line()
        print("the line:")
        dic[str(index)] = line
    index += 1

Where the test function is like i said above i want the code to wait for the players input and print the next line in the dictionary and then close when the dictionary is empty. Being new to Godot i dont know if there is a simple way to do this. Any help is appreciated and thank you in advance.

Also aside, i know there are a lot of plug-ins for Godot that can handle dialog if i download them, but i want to build this myself so i can learn, so please don't just say use a plug in.


1 Answer 1


Figured out a solution, Godot has built in functions that catch inputs that you can use. In this case its _input(). Example as follows;

func _input(event):
if event.is_action_released("left_mouse") and active:
    print("left mouse clicked yay!")
    index += 1

It pays to read the documentation.

  • \$\begingroup\$ "It pays to read the documentation." is the pro tip here! The next level is to read the engine's source code when necessary ;) \$\endgroup\$
    – Vaillancourt
    Aug 12, 2020 at 10:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .