So...Here goes.
I've been using a div element, a dialog box, where I place all the dialog between characters and the player.
This is what I've been using:
Javascript:
$('<div id="dialogue-bar"></div>').appendTo(document.body);
CSS:
#dialogue-bar {
position: fixed;
z-index: 50;
background-color:white;
border: #fff double 0.4em;
height: 21%;
right: 0.25em;
left: 21%;
bottom: 0.25em;
margin-left:0.75%;
padding: 1.5em;
margin-top:auto;
margin-bottom:auto;
}
In the passage:
<<replace "#dialogue-bar">><<set document.getElementById("dialogue-bar").style.visibility = "visible">>
<<display "dialogue">><</replace>>
PassageReady:
<<set document.getElementById("dialogue-bar").style.visibility = "hidden">>
And this has been working perfectly.
At least so far, as I've had only conversations between the player and 1 npc.
However, in my game, there are now more than 1 npcs interacting with each other and with the player. And this is where it starts getting complicated.
I've bee using things like these to style each character,
@@.player;«The player says something»@@
@@.npc;«The npc responds.»@@
@@.npc1;«And the other one intervenes»@@
@@.player;«so on and on...»@@
But it may get confusing after a while, and you loose track of who's saying what.
My idea, and my question is how to add an area inside the dialogue box (or appended) where I could put the name of the character who's speaking.
I feel like this could get very complicated, specially because I already have so much code going on in the "dialogue" displayed passage, and I have close to no knowledge about javascript, but it seems I would have to link the character speaking, so for example, the class in question (@@.npc, or @@player or whatever...), and create some output in that appended area to show their name...
And my brain just melted... I really have no idea how to make this happen, but it would be an incredible upgrade for my game, which is heavily based in dialog.
If anyone has ANY idea how to make this happen, how to make even part of this happen, I would be very grateful! Thanks :)