Creating dialogue script-wise

Hello,


I tried to create a dialogue using script instead of using "Show Text" feature in GUI. This is needed in my project to create random dialogue that depend on certain stats and variable.


So I tried to use series of scripts call method ... but i the results is nothing like in my mind.


This is expected result:

Spoiler
c1.png


and then ...


c2.png



This is the script that I use in hope to achieve that :


c5.png


$gameMessage.setFaceImage("Actor1", 0);
$gameMessage.setBackground(0);
$gameMessage.setPositionType(2);
$gameMessage.add("Text at bottom");
$gameMessage.newPage();
$gameMessage.setFaceImage("Actor1", 1);
$gameMessage.setBackground(0);
$gameMessage.setPositionType(0);
$gameMessage.add("Text at top");








... but ...unexpectedly ... this is the actual result of that script call :

Spoiler
c3.png


.. and then


c4.png



Please help, Where did i do wrong?
Don't use new page.  You would do that with two event commands, so add ALL the script commands for the first one, and then all the script commands for the second one.  Hint - I think you need a wait_for_message in there somewhere.

Original thread: https://forums.rpgmakerweb.com/threads/creating-dialogue-script-wise.61153/