Change scene by way of timer

I was looking to move a scene within director class automatically by an expired set timer. Is there a way to time how long a scene may stay open and then push to another scene?

When programming, would I need to change director class or the scene itself? I assume I would only program the scene itself since I would NOT want all the scenes to be on a timer. [import]uid: 88495 topic_id: 34493 reply_id: 334493[/import]

sceneTimer = timer.performWithDelay(300000, function() director.changeScene("newscene") end)  

Will change to “newscene” after 30 seconds.
[import]uid: 199310 topic_id: 34493 reply_id: 137150[/import]

Now if I wanted to show that as a count down on a elapsed timer? [import]uid: 88495 topic_id: 34493 reply_id: 137224[/import]

How would I keep track of points on a scoreboard by way of touch events? [import]uid: 88495 topic_id: 34493 reply_id: 137230[/import]

I got the return from output…

[code]
Runtime error

c:\users\stephen\director.lua:159: bad argument #1 to ‘lower’
stack traceback:
[C]: ?
[C]: in function ‘lower’
c:\users\stephen\director.lua:159 in function ‘changeScene’
c:\us
[/code] [import]uid: 88495 topic_id: 34493 reply_id: 137241[/import]

Looks like you’re not using “lower” correctly with regards to the error.

As for a count down timer, that’s still pretty easy but there is a little more work to it.

local timeLeft = 30  
  
local timeLeftText = display.newText(timeLeft, 0, 0, native.systemFont, 20)  
local function isTimeUp(event)  
 timeLeft = timeLeft - 1  
 timeLeftText.text = timeLeft  
 if timeLeft \< 1 then  
 director.changeScene("wherever")  
 end  
end  
  
local countDownTimer = timer.performWtihDelay(1000, isTimeUp, timeLeft)  

Or something similar.
[import]uid: 199310 topic_id: 34493 reply_id: 137253[/import]

what could be placed in to change lower? It feels like the program cannot interpret (lastScene) and (nextScene)

[code]
if lastScene then
if string.lower(lastScene) == string.lower(nextScene) then
return true
end
end

[/code] [import]uid: 88495 topic_id: 34493 reply_id: 137275[/import]

lower probably isn’t the problem, one of the strings your passing to lower is nil.
[import]uid: 199310 topic_id: 34493 reply_id: 137279[/import]

sceneTimer = timer.performWithDelay(300000, function() director.changeScene("newscene") end)  

Will change to “newscene” after 30 seconds.
[import]uid: 199310 topic_id: 34493 reply_id: 137150[/import]

Now if I wanted to show that as a count down on a elapsed timer? [import]uid: 88495 topic_id: 34493 reply_id: 137224[/import]

How would I keep track of points on a scoreboard by way of touch events? [import]uid: 88495 topic_id: 34493 reply_id: 137230[/import]

I got the return from output…

[code]
Runtime error

c:\users\stephen\director.lua:159: bad argument #1 to ‘lower’
stack traceback:
[C]: ?
[C]: in function ‘lower’
c:\users\stephen\director.lua:159 in function ‘changeScene’
c:\us
[/code] [import]uid: 88495 topic_id: 34493 reply_id: 137241[/import]

Looks like you’re not using “lower” correctly with regards to the error.

As for a count down timer, that’s still pretty easy but there is a little more work to it.

local timeLeft = 30  
  
local timeLeftText = display.newText(timeLeft, 0, 0, native.systemFont, 20)  
local function isTimeUp(event)  
 timeLeft = timeLeft - 1  
 timeLeftText.text = timeLeft  
 if timeLeft \< 1 then  
 director.changeScene("wherever")  
 end  
end  
  
local countDownTimer = timer.performWtihDelay(1000, isTimeUp, timeLeft)  

Or something similar.
[import]uid: 199310 topic_id: 34493 reply_id: 137253[/import]

what could be placed in to change lower? It feels like the program cannot interpret (lastScene) and (nextScene)

[code]
if lastScene then
if string.lower(lastScene) == string.lower(nextScene) then
return true
end
end

[/code] [import]uid: 88495 topic_id: 34493 reply_id: 137275[/import]

lower probably isn’t the problem, one of the strings your passing to lower is nil.
[import]uid: 199310 topic_id: 34493 reply_id: 137279[/import]