Create Code for changing time on a Clock

I"m trying to code the clock to stop at a specific time, has anyone else tried this? I’d like to add it as a clue in an escape room

Do you have any more details? Are you using python?

No, strictly blocks at this point. I’m introducing ways to hide stuff.

So I am trying to use the clock object in an escape room. I want to set the clock to a specific time. We are using blocks as I said earlier. Right now, it looks like i can only start or stop a clock turning but can’t set a time. Is there a way to introduce it as a variable to modify the clock hands?
Thanks

Can you make the clock out of text objects, set the time then increment it? This would be a digital clock…

Hi @Thomas_Burau,
The new clock from the library seems to be very adjustable but also unstoppable, at least in the Play mode. You can use a stopwatch displaying seconds and some TypeScript that is always compatible with CoBlocks.
The code would be something like:

function clock() {
    timeGo++;
   
    if (timeGo <= 100) {
        timeDisplay.text = timeGo.toString()
        memory = timeGo
    }
    else {
        timeIsPassing = false
        Time.schedule(clock, 100)     
    }
}

if (timeIsPassing=true) {
    timeDisplay.text = timeGo.toString()
    Time.scheduleRepeating(clock, 1)
}

function start (){ timeGo=memory, clock()}
function stop (){ timeGo=101}

In this example, the time limit is 100 seconds, but of course it can be much more or less. It depends on how many clues you have in the escape room. Also, the clock design can be different, all you need is a text panel or something with a Text Item to display the passing time (in seconds). For a regular digital clock, the TypeScript is much more complicated.
I hope you’ll find the example useful.

1 Like