StoryBoard Overlays crash the game

has anyone else had this problem?

after the storyboard hide overlay disappears, i click on the box to go to the next scene and the game crashes.

im assuming this happens as the scene overlay has not fully faded out before i clicked on the go to next scene.

here’s my code

function scene:enterScene( event )  
 local group = self.view   
 print( "OverLay Weapon 18: enterScene event" )  
  
 local function gotoTitle()  
 storyboard.hideOverlay( true, "fade" )  
 \_G.hud.isVisible = true  
 \_G.hudHealth.isVisible = true  
end  
   
timer.performWithDelay(1000, gotoTitle)  
  
 local lastScene = storyboard.getPrevious()  

any one got a suggestion on how to fix this error ??

[import]uid: 17701 topic_id: 28750 reply_id: 328750[/import]

Is there a showOverlay() somewhere? Is that enterScene() part of your overlay scene? If so, why are you idning the overlay immediatly upon showing it?

We really need to know more about your project and see more of the code.

[import]uid: 19626 topic_id: 28750 reply_id: 115907[/import]

Rob,

the reason i have it going back is because I’m using the overlay to display a Cut scene pop up of a item found (like resident evil) and when the item is found it fades back. but when i click on the next room while the overlay is fading out it crashes.
[import]uid: 17701 topic_id: 28750 reply_id: 115967[/import]

I’m guessing it’s because your passing two parameters. storyboard.hideOverlay can take 2 or 3 optional parameters:

storyboard.hideOverlay( [purgeOnly, effect, effectTime] )

– also supported:

storyboard.hideOverlay( [effect, effectTime] )

It looks to me like if you call hideOverlay() with only two parameters, the first one is expected to be a string and your passing a boolean. If you need to pass that true in, add the effect time so that you’re passing all three parameters and see if that fixes it.

I’m taking a stab in the dark here. [import]uid: 19626 topic_id: 28750 reply_id: 116168[/import]

i think the problem stems from me trying to leave a scene when the hide overlay is taking place.
OverLay Black Key: exitScene event
((destroying OverLay Black Key’s view))
1: exitScene event

Cut Scene 2: createScene event
Runtime error
?:0: attempt to index upvalue ‘?’ (a nil value)
stack traceback:
[C]: ?
?: in function ‘?’
?: in function <?:1193>
(tail call): ?
?: in function <?:1184>
?: in function <?:226>

is there a way to not accept response from user until the overlay is fully finished >??
[import]uid: 17701 topic_id: 28750 reply_id: 116256[/import]

i think i fixed it…

i just change it to
storyboard.hideOverlay()

got rid of the fade effect time. :slight_smile:

testing all files now… [import]uid: 17701 topic_id: 28750 reply_id: 116258[/import]

@emanouel, did you ever find a solution to this that allows you to use the transition? I’m getting the exact same error, and while not using a transition fixes it, I would like to use one.

Thanks!

  • David [import]uid: 149111 topic_id: 28750 reply_id: 123915[/import]

When the overlay comes up could you disable any buttons that move you from the parent scene? Then enable them again inside scene:overlayEnded.

It would mean your “Next Place” button wouldn’t work until the overlay was completely gone, so you might get impatient people stabbing the button multiple times until it works.

Or, alternate (but a little more work) way would be to set a flag when the overlay starts and clear it on scene:overlayEnded – then when a button is clicked see if that flag is set. If so, just stall briefly and check the flag again, etc., until it’s clear.

Just some brainstorming.

Jay
[import]uid: 9440 topic_id: 28750 reply_id: 123916[/import]

There is an event called overlayEnded or something like that in the calling window. You could prevent your button from firing the scene change until a flag is true and set it to true in the overlayEnded function [import]uid: 19626 topic_id: 28750 reply_id: 123917[/import]

Oddly enough, in my situation I’m not changing to a different scene, just simply hiding the overlay. And the error appears after “overlayEnded” is called. [import]uid: 149111 topic_id: 28750 reply_id: 123918[/import]

@davidcondolora can you post some code? [import]uid: 19626 topic_id: 28750 reply_id: 123951[/import]

Sure! The overlay is a drawer that the player drags out from the right side of the screen:

if (e.phase == "began") then  
 -- If the touch was within 50 pixels of the right side of the screen  
 if (\_W - e.x \< 50) then  
 beganX = e.x  
 end  
elseif (e.phase == "moved") then  
 if (beganX - e.x \> 150) then  
 storyboard.showOverlay("craters.inventory", {effect="slideLeft", time=200, isModal=true})  
 end  
end  

The overlay is hidden when the user drags it back to the right. This code is inside the overlay module:

function invBackground:touch (e)  
 if (e.phase == "began") then  
 beganX = e.x  
 elseif (e.phase == "moved") then  
 if (e.x - beganX \> 150) then  
 storyboard.hideOverlay(true, "slideRight", 200)  
 end  
 end  
end  

This is the error I get upon hiding the overlay:

Runtime error  
 ?:0: attempt to index upvalue '?' (a nil value)  
stack traceback:  
 [C]: ?  
 ?: in function '?'  
 ?: in function <?:1193>  
 (tail call): ?  
 ?: in function <?:1184>  
 ?: in function <?:226>  

Thanks for the help! [import]uid: 149111 topic_id: 28750 reply_id: 123957[/import]

@emanouel, did you ever find a solution to this that allows you to use the transition? I’m getting the exact same error, and while not using a transition fixes it, I would like to use one.

Thanks!

  • David [import]uid: 149111 topic_id: 28750 reply_id: 123915[/import]

When the overlay comes up could you disable any buttons that move you from the parent scene? Then enable them again inside scene:overlayEnded.

It would mean your “Next Place” button wouldn’t work until the overlay was completely gone, so you might get impatient people stabbing the button multiple times until it works.

Or, alternate (but a little more work) way would be to set a flag when the overlay starts and clear it on scene:overlayEnded – then when a button is clicked see if that flag is set. If so, just stall briefly and check the flag again, etc., until it’s clear.

Just some brainstorming.

Jay
[import]uid: 9440 topic_id: 28750 reply_id: 123916[/import]

There is an event called overlayEnded or something like that in the calling window. You could prevent your button from firing the scene change until a flag is true and set it to true in the overlayEnded function [import]uid: 19626 topic_id: 28750 reply_id: 123917[/import]

Oddly enough, in my situation I’m not changing to a different scene, just simply hiding the overlay. And the error appears after “overlayEnded” is called. [import]uid: 149111 topic_id: 28750 reply_id: 123918[/import]

@davidcondolora can you post some code? [import]uid: 19626 topic_id: 28750 reply_id: 123951[/import]

Sure! The overlay is a drawer that the player drags out from the right side of the screen:

if (e.phase == "began") then  
 -- If the touch was within 50 pixels of the right side of the screen  
 if (\_W - e.x \< 50) then  
 beganX = e.x  
 end  
elseif (e.phase == "moved") then  
 if (beganX - e.x \> 150) then  
 storyboard.showOverlay("craters.inventory", {effect="slideLeft", time=200, isModal=true})  
 end  
end  

The overlay is hidden when the user drags it back to the right. This code is inside the overlay module:

function invBackground:touch (e)  
 if (e.phase == "began") then  
 beganX = e.x  
 elseif (e.phase == "moved") then  
 if (e.x - beganX \> 150) then  
 storyboard.hideOverlay(true, "slideRight", 200)  
 end  
 end  
end  

This is the error I get upon hiding the overlay:

Runtime error  
 ?:0: attempt to index upvalue '?' (a nil value)  
stack traceback:  
 [C]: ?  
 ?: in function '?'  
 ?: in function <?:1193>  
 (tail call): ?  
 ?: in function <?:1184>  
 ?: in function <?:226>  

Thanks for the help! [import]uid: 149111 topic_id: 28750 reply_id: 123957[/import]

Anyone have any luck diagnosing this? This error continues to plague me. [import]uid: 149111 topic_id: 28750 reply_id: 125801[/import]

I figured out my problem, and posted the solution here. Thanks! [import]uid: 149111 topic_id: 28750 reply_id: 125925[/import]