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

Question: Is there an API or something that can be used for indicating things throughout the world?

Started by Thorinori, 22 April 2012 - 01:18 AM
Thorinori #1
Posted 22 April 2012 - 03:18 AM
Like the title says, is there a way for the computer to detect something in the world around it?
Advert #2
Posted 22 April 2012 - 03:42 AM
No. There is only turtle.detect and turtle.compare, which are for turtles.

You could use pressure plates and redstone or buttons, and hook them up to a computer, though.
Thorinori #3
Posted 22 April 2012 - 03:52 AM
What I was wanting was to have it detect when it was night so it would turn on a redstone current for automating my EU generation in Tekkit
Luanub #4
Posted 22 April 2012 - 04:18 AM
If you want to turn something on time based you can use os.setAlarm( time ) and use the minecraft time that you want the event to happen as the argument. So if you want it on at 7am minecraft time do something like..


os.setAlarm(7)
evt, e1 = os.pullEvent("alarm")
rs.setOutput("right", true )
Thorinori #5
Posted 22 April 2012 - 04:30 AM
sweet thanks!
Thorinori #6
Posted 22 April 2012 - 05:10 AM
That worked, it took a couple tries to get it right for the event that would be a second alarm, but I got it :)/>/>
yoskaz01 #7
Posted 22 April 2012 - 05:42 AM
Like the title says, is there a way for the computer to detect something in the world around it?

yes there is :)/>/>
ccSensors

there is a world sensor that can provide you with the following world values (among other things):
"Sea Level",
"Light Level",
"Rain Strength",
"Raining?",
"Day/Night",
"isThunderStorm",
"SensorHeight",
Luanub #8
Posted 25 April 2012 - 12:29 PM
If your running Redpower for v1.25 there is now an adjustable light sensor included in it as well.