Making dialogue system use Code

I just tried to make a simple dialogue system like Ren’py and I wonder if something like this is possible?.

my idea is to change the text in every frame with code

You can use “project.currentFrameNumber” to return the value of the current frame of the project.

Try to use this code in the update script instead:

if(project.currentFrameNumber===1){
dialogtext.setText("Hello World!");
}
if(project.currentFrameNumber===5){
dialogtext.setText("Programmed to work and not to feel");
}

Thank kind sir, let me try it.

It kind of works, but I need to split the frame to make it work. I would like the frame to be still in one piece, so I don’t need to split the frame manually and just need to type the code to make more dialogue. But anyway, thank you very much for helping me.

That’s because you have the code in the default script. I’d recommend adding an update script to the frame, and putting the code there instead.

You can do this by selecting the frame, clicking the blue “+ add script” button on the right, then click the “Timeline” button, and select “Update.” Paste the code there and it should work perfectly

I see. Thank you kindly, sir. It worked flawlessly.

1 Like