Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0


I really want to setup an event on a server and I need a Countdown to do it, I want to use OpenComputers to do it but I don't know how

I would need it to look like this "00:00:00:00" and I want it to be days:hours:minutes:seconds. Also if it his 0 it should send a redstone signal out from the computer.

I'm a novice at coding so it would help a lot if someone could make it for me or send me to someone who has already done it so I can use it and learn more about code.
Thank you in advance.

Share this post

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

First the opencomputers documentation:  http://ocdoc.cil.li

local computer = require("computer")
local component = require("component")
local sides = require("sides")
local rs = component.redstone
local gpu = component.gpu

--Desired time in seconds EDIT THIS!!!
local timer_length = 10

--Clear the screen
local w,h=gpu.getResolution()
gpu.fill(1,1,w,h," ")
local time_remaining

--Get the current time and add desired countdown to it.
local time_now = computer.uptime()
local target_time = time_now + timer_length

-- Function to draw remaining time on screen
local function PrintTime(time)
  --Screen drawing logic in here!
  --Currently writes the reamining time on screen in seconds
  gpu.fill(1,1,w,1," ")
  gpu.set(1,1,"Time Remaining: " .. time)

--Loop until time is done
while true do
  time_now = computer.uptime()
  time_remaining = target_time - time_now
  if(time_now>=target_time) then

-- Emit a redstone signal from the back of the computer with a sgnal strength of 15.

This should work, but i have not tested it. 

It won't format the time in DD:HH:MM:SS (yet). It will howerver send the redstone signal when it hits 0 (in theory).

Just reply in this thread if you need more help  or if it doesn't work.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.