performWithDelay trouble

Hey, I have 4 years of Lua experience and I’m stuck creating 2 texts appearing one after another for an hour already. Looks something like this:
 

timer.performWithDelay(1000/60, firstTextFafeIn, 50) timer.performWithDelay(1000/60, secondTextFadeIn, 50) -- functions make texts' alpha add 1/50 every time

BUT

The only thing I don’t understand here is why timer starts these two functions simultaneously. I even created a wait() function

function skipTime()     print("Skipped time")     return end function wait(sec) timer.performWithDelay(sec\*1000, skipTime) return end

and still, though now obvious, they all start at the same time with no delay between each other.

How do I make another timer perform after the other one has finished its loop?

Are you saying you want

  • firstTextFafeIn() first called after 60 seconds
  • secondTextFadeIn() first called after 120 seconds

Additionally, regardless of the timer durations, you want the secondTextFadeIn() to be scheduled as a consequence of firstTextFafeIn() being called?

Yeah, but if there is a way to just let the timer sit for a while and fire, it would be much more comfortable to use. Just using wait() functions of some kind, if possible, of course.

But I guess the only way to do it for now is to expand 2 little functions into something much bigger.

There is no way to syntactically chain timer.performWithDelay() function calls. 

You’ll have to write your own chaining code.

This is the fundamental idea behind Corona.  It provides you highly functional basic functions and you write your own custom/app specific solutions.

It would be a hot mess if it was instead a collection of specific detailed solutions to particular use cases.

Are you fading in native.newTextField()'s? I’m not 100% sure you can.

Also, normally you would use transition.to() to do a timed event like a fade in where you’re changing some value over time. The transition.to has advanced controls like setting delays for when the transition starts and so on.

Rob

Thanks for reminding me about that one, Rob. I’ll try to figure out the time issues myself then

@qwertyuk01  and @everyone
 
Hi again.  I wanted to let you know, that @Appletreeman contacted me a while after seeing this post and it turns out he has some code that might help you out. 

I am hosting in in my GitHub Free Stuff repository in the AskEd section.
 
You can download the code directly here: https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2017/12/messages.zip
 
It looks like this when it runs:
https://www.youtube.com/watch?v=VKJM2gl7plo&feature=youtu.be

Are you saying you want

  • firstTextFafeIn() first called after 60 seconds
  • secondTextFadeIn() first called after 120 seconds

Additionally, regardless of the timer durations, you want the secondTextFadeIn() to be scheduled as a consequence of firstTextFafeIn() being called?

Yeah, but if there is a way to just let the timer sit for a while and fire, it would be much more comfortable to use. Just using wait() functions of some kind, if possible, of course.

But I guess the only way to do it for now is to expand 2 little functions into something much bigger.

There is no way to syntactically chain timer.performWithDelay() function calls. 

You’ll have to write your own chaining code.

This is the fundamental idea behind Corona.  It provides you highly functional basic functions and you write your own custom/app specific solutions.

It would be a hot mess if it was instead a collection of specific detailed solutions to particular use cases.

Are you fading in native.newTextField()'s? I’m not 100% sure you can.

Also, normally you would use transition.to() to do a timed event like a fade in where you’re changing some value over time. The transition.to has advanced controls like setting delays for when the transition starts and so on.

Rob

Thanks for reminding me about that one, Rob. I’ll try to figure out the time issues myself then

@qwertyuk01  and @everyone
 
Hi again.  I wanted to let you know, that @Appletreeman contacted me a while after seeing this post and it turns out he has some code that might help you out. 

I am hosting in in my GitHub Free Stuff repository in the AskEd section.
 
You can download the code directly here: https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2017/12/messages.zip
 
It looks like this when it runs:
https://www.youtube.com/watch?v=VKJM2gl7plo&feature=youtu.be