Wait function with Label function

This is maddening, hopefully someone can help. I'm trying to use the Label function on a death screen for the game I'm creating. I'd like 4 separate lines to show up one after the other after about a second apart. The Label function seemed the easiest way to do this, but for some reason it doesn't work with the Wait function. Here's what I have:

on draw do
if event.room=="dead" then
tell event.room to
call "death"
end
end
end

Then in the "dead" room:

on death do
wait 1 then
label "text..." at 1,9
end
wait 2 then
label "text..." at 1,10
end
wait 3 then
label "text..." at 1,11
end
wait 4 then
label "text..." at 1,12
end
end

Since Label only works in the Player Draw event I had it Call up an event. I saw another game do something like that. I thought that was an issue, but I tried this same thing without the Wait functions and it displayed the text immediately no problem. I just want to add some tension to it, you know? Showing each line at a time.

Edit: Man, my posting skills are a little rusty, sorry for the ugly looking post.

1 Like

Yeah unfortunately the issue here is Draw is called every tick, so the wait is called and then overwritten immediately.

Best bet would be to use variables for this. something like FinalTimer=0 and then when you enter the final room call a timer (on enter do) and just increment it and then instead of "wait" in the draws use ifs so if FinalTimer==1 then //display the new label

Looks like you know how to use that stuff already - an example in the player script is below, you could put the timer/timer call / function in the room script itself and just leave the draw checks in player.

on enter do
  FinalTimer=0
  
  call "Timer"
end

on Timer do
  wait 1 then
  FinalTimer++
  call "Timer"
  end
  
end

on draw do
  
  if FinalTimer==1 then
    	label "Label Num 1" at 3,3
  end
  if FinalTimer==2 then
    	label "Label Num 2" at 3,3
  end
  if FinalTimer==3 then
    	label "Label Num 3" at 3,3
  end
  if FinalTimer==4 then
    	label "Label Num 4" at 3,3
  end
  if FinalTimer==5 then
    say "end"
  end
end

Thanks Matt. It worked. Sort of. haha

I didn't explain properly what I wanted. It showed the text one after the next like I want, but it didn't keep the text there. I guess I didn't say that in my original post. I want them to show up on the screen underneath each other, "First line" then under that, a second later "Second line", etc. And it stays on the screen.

Sorry for the confusion.

1 Like

No worries, that's nice and easy, just double up your labels.

 if FinalTimer==1 then
    	label "Label Num 1" at 3,3
  end
  if FinalTimer==2 then
        label "Label Num 1" at 3,3
    	label "Label Num 2" at 3,4
  end
  if FinalTimer==3 then
        label "Label Num 1" at 3,3
    	label "Label Num 2" at 3,4
    	label "Label Num 3" at 3,5
  end
  if FinalTimer==4 then
        label "Label Num 1" at 3,3
    	label "Label Num 2" at 3,4
    	label "Label Num 3" at 3,5
    	label "Label Num 4" at 3,6
  end
  if FinalTimer==5 then
    say "end"
  end

It worked!! Thanks for the help Matt. Hope I can return the favor someday. I'm super new at this, but I catch on quick enough, I might surprise you.

1 Like

Glad you got it working mate! Good job :smiley: Throw up some screenshots when you're further along!