Making a RRandom seconds timer

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Hello Clickteam Community,

    I am new to this amazing software and faszinated by it's easy of use. I am already energetically crawling through the many tutorials out there, but sometimes I am having difficulties with the methods I can us ein the Events Editor. In this case I am nearly finished with the Fruit Catcher tutorial, but I'd like to modify the time, the fruits are dropping from the spacecraft to a random range between (i.e.) 5 and 10 seconds. I choosed calculate for the Timer/Every event, and found the operator RRandom and seconds but I don't know how to write the expression correctly. Would one of you wise guys please help a beginner?

    Salutations,
    Robin

  • I believe the 'Timer/Every' condition is meant to be consistent, as in once it is defined it is meant to repeat in that steady interval. But I just checked this out and I am wrong! More below.

    ---This is the complicated way lol---
    The technique I would use is to create a countdown value and test it against zero.

    At frame start set the countdown to rrandom(10,60) (where 10frames would be the min and 60frames between would be max).
    Always (every frame update) subtract one from the countdown value
    if countdown <=0, (do something) and set countdown to rrandom(10,60) again

    This would produce a routine where the event fires randomly within an interval range, but not always at a steady interval

    --- after checking I found that every does re-evaluate, so this is simpler than I thought ---

    The syntax of the custom expression in Timer/Every is simply in milliseconds. 1000ms/second, so (1000/(60fps))*number of frames would be the range formula.
    Timer/Every RRandom(166,1000) would be the same as the previous (10,1000) that relieved on the frame rate if that makes sense.

    ----
    If you want the interval to be consistent, you could set a value to an interval using rrandom(10,1000) at frame start, and then set the every condition to the value of that defined value.

    Sorry for the confusion, I started writing before I tried it all out.

    Attached is an example file for 2.5

    Please login to see this attachment.

  • Hey, thanks for the quick answer! You helped me out, that is great. No confusion in there, I could follow and just tried the last option and it worked fine for my program.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!