Pulp has several ways to show dialog: say
, label
, menu
. A specific feature I wanted in our game is an RPG-style avatar of the speaking character.
You can of course embed tiles in text, like so:
say "{embed:person} WITCH: Oh no you don't!"
which would give you something like:
This is cute, but I wanted large, expressive avatars—4 or even 9 tiles in size—plus some additional character info. Like so:
I could draw all this manually using swaps, but that's a lot of swaps. With 5 characters in the game, I needed a more automated system. Here's what I ended up with.
The game logic sets the currently speaking character:
dialogPerson = 5
Then this [dialog] room draws like such:
on drawDialogAvatar do
tell 4,10 to
swap "p{dialogPerson}t1"
end
tell 5,10 to
swap "p{dialogPerson}t2"
end
tell 6,10 to
swap "p{dialogPerson}t3"
end
tell 4,11 to
swap "p{dialogPerson}t4"
end
tell 5,11 to
swap "p{dialogPerson}t5"
end
tell 6,11 to
swap "p{dialogPerson}t6"
end
tell 4,12 to
swap "p{dialogPerson}t7"
end
tell 5,12 to
swap "p{dialogPerson}t8"
end
tell 6,12 to
swap "p{dialogPerson}t9"
end
end
So, 9 draws for 9 tiles. It expects the tiles to be named like p1t3
—person 1, tile 3.
When creating these, I make the first tile (p1t1
) then hit Duplicate 8 times. Note that this automatically increments the number—Shaun made it so that tiles with numbers at the end up the number when duplicated. Super handy!
Adding a new character is now just a matter of defining them and drawing their 9 tiles. I draw those right on the canvas (to see what I'm doing), then remove them from the canvas before running the game.
P.S. The info is drawn like such:
if dialogPerson==5 then
label "CHESTER COOKE JR." at 9,10
label "Assoc. Account Manager" at 9,11
label "Seeks meaning of life" at 9,12
end
I could also set these 3 lines to variables and have one block that draws them all, but I figured this was good enough, so why add extra variables. If the game needed to use these fields elsewhere, I'd use variables.