Twine Version:
Sugarcube 2.37.3
I’m attempting to create a mob of npcs that give dialog and using the type macro to act as if their saying it. So far I’m perfectly fine getting the dialog to go and where on the page too. But I also kind of wanting to be able to have some type out at the same time. Is there anyway to do that? The main code I’m hoping to get help here is in the Town Mob Display.
Code:
::Player View
<div class= "row">
<div id= "leftcolumn">
<div id= "Choices">> <<include "Choice UI">> <</div>
</div>
<div id= "rightcolumn">
<div id= "StoryBody> <<include "Handling Weak Harvest">> </div>
</div>
</div>
::Choice UI
<<silent>>
<<set $DialogChoice = " ">>
<<set $DialogTiles = ["good choice", "neutral choice", "bad choice"]>>
<</silent>>
<<nobr>>
<<for _i= 0; _i < $DialogTiles.length; _i++>>
<<capture _i>>
<span @id= "'Tile-'+ _i" class= "Tile">
<<link '<h1>$DialogTiles[_i]</h1>'>><<set $DialogChoice = $DialogTiles[_i]>><<replace "#StoryBody">><<include "Handling Weak Harvest">><</replace>><<= setup.SelectedLink("Tile-"+ _i)>><</link>>
</span> <</capture>> <</for>><</nobr>>
::Handling Weak Harvest
<<nobr>>
<<switch $DialogChoice>>
<<case "good choice">>
description of the good dialog choice
<<case "neutral choice">>
description of the neutral dialog choice
<<case "bad choice">>
description of the bad dialog choice
<<default>>
The town stares back at you, an uneasiness washing among the faces of the crowd. As the mayor, it is up to you to how to steer the town to solving the lackluster harvest the season.
<</switch>>
<</nobr>>
<div id= "TownMob"><<include "Town Mob Display">></div>
::Town Mob Display
<<nobr>>
<div class= "containerL">
<div id= "LeftMob01"> </div>
<div id= "LeftMob02"> </div>
</div>
<div class= "containerR">
<div id= "RightMob01"> </div>
<div id= "RightMob02"></div>
</div>
<</nobr>>
<<silent>>
<<set _Hopeful= ["That's a good idea.", "Maybe the hunters can go out more too.", "And all of you were panicking for nothing.", "The mayor's right.", "Let's start right now!"]>>
<<set _Nervous= ["Is that all we can do?", "Anyway we might be able to keep up with everything?", "But what if this doesn't pan out well?", "Well there isn't anything else we can really do.", "Hopefully this works out."]>>
<<set _Upset= ["No way is this going to work.", "How can any of us do that?", "So we basically starve till then?", "And we all wonder why no one wants to move into town anymore.", "Have you lost your mind, Mayor?"]>>
<<set _MobDialog = " ">>
<<switch $DialogChoice>>
<<case "good choice">>
<<set _MobDialog= _Hopeful>>
<<timed 1s>>
<<replace "#LeftMob01">><<type 50ms>><<= _MobDialog.random( )>><</type>><</replace>>
<<replace "#RightMob01">><<type 50ms>><<= _MobDialog.random( )>><</type>><</replace>>
<<next>>
<<replace "#LeftMob02">><<type 50ms>><<= _MobDialog.random( )>><</type>><</replace>>
<<replace "#RightMob02">><<type 50ms>><<= _MobDialog.random( )>><</type>><</replace>>
<</timed>>
<<case "neutral choice">>
<<set _MobDialog= _Nervous>>
<<timed 1s>>
<<replace "#LeftMob01">><<type 50ms>><<= _MobDialog.random( )>><</type>><</replace>>
<<replace "#RightMob01">><<type 50ms>><<= _MobDialog.random( )>><</type>><</replace>>
<<next>>
<<replace "#LeftMob02">><<type 50ms>><<= _MobDialog.random( )>><</type>><</replace>>
<<replace "#RightMob02">><<type 50ms>><<= _MobDialog.random( )>><</type>><</replace>>
<</timed>>
<<case "bad choice">>
<<set _MobDialog= _Upset>>
<<timed 1s>>
<<replace "#LeftMob01">><<type 50ms>><<= _MobDialog.random( )>><</type>><</replace>>
<<replace "#RightMob01">><<type 50ms>><<= _MobDialog.random( )>><</type>><</replace>>
<<next>>
<<replace "#LeftMob02">><<type 50ms>><<= _MobDialog.random( )>><</type>><</replace>>
<<replace "#RightMob02">><<type 50ms>><<= _MobDialog.random( )>><</type>><</replace>>
<</timed>>
<</switch>>
<</silent>>