This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
FoxData's profile picture

Keep it day - A groundhog program

Started by FoxData, 09 March 2016 - 09:17 PM
FoxData #1
Posted 09 March 2016 - 10:17 PM
Keep It day


Have you ever been working on something in creative mode just for it to turn to night? and you have to use that command?

Well this program will loop the time set command forever until terminated.*

Code:
Spoiler

-- Keep It day
-- By FoxData

term.clear()
--  fs.copy(“Keepitday”, “disk/startup”) – This feature is not fully implemented yet

while true do


commands.exec(“time set day”)
print(“Time Set Day”)
end

Download:
Spoilerpastebin get zC7Kyu2H

Pastebin link: http://pastebin.com/zC7Kyu2H

Warning: This will spam your chat so turn it off before running the program

* Only compatible with command computers


This program is certified to work with O
WWO-114172892
Edited on 11 March 2016 - 05:47 PM
Creator #2
Posted 09 March 2016 - 10:54 PM
Maybe put it to sleep for 2 mins in order to not overuse the server CPU.
Bomb Bloke #3
Posted 09 March 2016 - 11:46 PM
Indeed, this script will work, but it'll put a lot of stress on the server.

FWIW, I use this:

while true do
  commands.time("set 0")
  commands.weather("clear 600")
  sleep(600)
end

This sets the time to morning, then waits until dusk before repeating. It also disables all weather effects.
MKlegoman357 #4
Posted 10 March 2016 - 07:57 AM
There's a /gamerule command made just for this thing.
Dave-ee Jones #5
Posted 10 March 2016 - 09:15 AM
OR you could just type /gamerule doDaylightCycle false in chat which will use almost no CPU (like most other commands unless its one that spawns blocks or entities) and only needs to be set once per world. Seriously…I thought everyone knew this?
Bomb Bloke #6
Posted 11 March 2016 - 01:10 AM
Truth be told, I never searched for a gamerule to deal with the time - I only looked for one to stop the ********* rain and ***** snow, and could never find one.
Dave-ee Jones #7
Posted 11 March 2016 - 10:52 AM
Well it says doDaylightCycle (do the cycle or not how clear can you get :P/>) and it was announced and everyone got hype about it cus they didn't have to use CPU chewing redstone clocks anymore. :)/>
SquidDev #8
Posted 11 March 2016 - 11:03 AM
Well it says doDaylightCycle (do the cycle or not how clear can you get :P/>) and it was announced and everyone got hype about it cus they didn't have to use CPU chewing redstone clocks anymore. :)/>
I use both doDaylightCycle and a daylight sensor: this way you can catch weather events (and so clear the weather).
FoxData #9
Posted 11 March 2016 - 06:48 PM
Tested It with O and it worked So now its got the O certification!
Anavrins #10
Posted 11 March 2016 - 07:09 PM
Tested It with O and it worked So now its got the O certification!
What does that even mean?
Creator #11
Posted 11 March 2016 - 08:52 PM
It would be weird if it did not work with O.
Edited on 11 March 2016 - 08:39 PM
FoxData #12
Posted 11 March 2016 - 08:54 PM
Tested It with O and it worked So now its got the O certification!
What does that even mean?

Means that it works with the OS called "O"
Anavrins #13
Posted 11 March 2016 - 11:08 PM
Means that it works with the OS called "O"
The simplicity of your code is a such that it will work with pretty much everything without modification, so that's kind of meaningless.
Dave-ee Jones #14
Posted 12 March 2016 - 12:24 AM
Means that it works with the OS called "O"
The simplicity of your code is a such that it will work with pretty much everything without modification, so that's kind of meaningless.

Lol. A few lines will work in basically anything unless its a code that is programmed to overwrite the program that is running it, but seeing as it just resets the time of day every few seconds it shouldn't. I still think it's silly just to have a whole computer resetting the time of day when you can literally just set doDaylightCycle to false and BAM, no extra CPU usage required!
FoxData #15
Posted 12 March 2016 - 09:08 PM
Groundhog Version 2.00


Well The successor of "Keep it day" has turned up!

Introducing Groundhog 2.00

Download:
Spoilerpastebin get 4UTcs7KD

Code:
Spoiler

-- Groundhog --

-- By FoxData --

-- Version 2.00 --
term.clear()
print("Welcome to groundhog V2.00")
term.setCursorPos(1,2)
print("T: No More night")
term.setCursorPos(1,3)
print("W: No More rain")
local event, key = os.pullEvent( "key" )
if key == keys.t then
while true do
commands.exec("time set day")
end
end
if key == keys.w then
while true do
  commands.exec("weather clear")
end
end


Pastebin link: http://pastebin.com/4UTcs7KD

Warning: This will spam your chat so turn it off before running the program
Edited on 12 March 2016 - 08:13 PM
FoxData #16
Posted 12 March 2016 - 09:14 PM
By march 13 this program will be no longer supported by FoxData.

A new version has been released: http://www.computercraft.info/forums2/index.php?/topic/26192-groundhog-200-a-new-groundhog-program/
Lyqyd #17
Posted 12 March 2016 - 09:18 PM
Threads merged.
Creator #18
Posted 13 March 2016 - 12:29 AM
In your new program, you forgot the main loop.

Also, please don't act so pathetic. Works with O, well of course it does. Why should it not? And supporting a program for 3 days is the best idea ever. Seriously.

Also, we showed you some non CPU destroying methods. You could use them.
Bomb Bloke #19
Posted 13 March 2016 - 01:14 AM
In your new program, you forgot the main loop.

Not… exactly. The program now asks you to pick a function, and then spams it until termination. That much is likely intended.

It's indeed somewhat frustrating to see it ignore all suggestions made thus far, though.
Anavrins #20
Posted 13 March 2016 - 01:44 AM
By march 13 this program will be no longer supported by FoxData.

A new version has been released: http://www.computerc...undhog-program/
You act like your program is something big, which it isn't, because people will prefer a less cpu-hogging method.
Statements like this are annoyingly redundant.
Goof #21
Posted 13 March 2016 - 01:45 AM
It's indeed somewhat frustrating to see it ignore all suggestions made thus far, though.
I have to agree on this point.
Comments are here to add the missing 'constructive critism' to the topics.

Ignoring comments it pretty much the same as ignoring to admit something that could be done in a better, less harming way. (By harming i mean non-CPU friendly)