Hi, I am trying to send strings of text from one script to another using events in order to implement a dialogue system, but the destination script only receives 0. How can I fix this? Thanks!
Hi @eggs!
Maybe you can share how you currently do it?
That will make it easier for other users to help.
This is the event which sends the line, lineToSend
is a class that holds the line and related data for the UI to generate the correct layout. Everything else sends fine except for lineToSend.line
this.app.fire('ui:nextLine', (lineToSend.line, lineToSend.number, lineToSend.button1, lineToSend.button2, lineToSend.nextline1, lineToSend.nextline2));
This is the receiving code
this.app.on('ui:nextLine', (line, number, button1, button2, nextline1, nextline2) => {
this.line = line; //instead of the correct line, it receives 0/null
this.number = number;
this.button1 = button1;
this.button2 = button2;
this.nextline1 = nextline1;
this.nextline2 = nextline2;
this.showNewLine();
// }
});
Remove the parentheses to the input arguments by changing:
this.app.fire('ui:nextLine', (lineToSend.line, lineToSend.number, lineToSend.button1, lineToSend.button2, lineToSend.nextline1, lineToSend.nextline2));
to:
this.app.fire('ui:nextLine', lineToSend.line, lineToSend.number, lineToSend.button1, lineToSend.button2, lineToSend.nextline1, lineToSend.nextline2);