Program Flow Across Multiple If's

I'm not understanding how execution flows through pulp script. I have the following code in a sprite. This is the first occurrence of testVal1 and testVal2. Why does this only trigger the say "test val 2" statement?

on interact do
	if testVal1 == 0 then
	  say "test val 1"
	if testVal2 == 0 then
	  say "test val 2"

Switch out say with log and you'll see both statements are being triggered.

If you say multiple things the last called will immediately replace any others.

If you want both lines to be said sequentially you need to concatenate the strings together into a single say command using string formatting syntax like "{line_1}{line_2}"

You might also find ask better suits some use cases for controlling code/dialogue flow.

1 Like

That makes so much sense, thank you!