11 posts
Posted 12 June 2014 - 11:20 PM
I got the tornado mod shortly after I downloaded CC and I wanted to create something that I can link them with.
I decided to go for a warning system that uses the redstone signal produced from the tornado sensor (part of the tornado mod) and when the computer picks up this signal it says that a tornado warning has been put in place and tells you what Minecraft time it was spotted at, then it tells you a safe place to take cover.
It is great for Role playing games on MC or use it in a mass tornado survival so people in the server have this utility on their
computers.
You must place the tornado sensor on the back of the computer, otherwise you will have to change the code where it gets all the redstone inputs from.
print("Tornado Warning System")
print("Starting up...")
sleep(1)
print("Loading Sensor")
sleep(1)
print("Tornado Warning System is Active")
shell.run('clear')
repeat
redstone.getInput ('back')
print("No tornado warnings in this area")
sleep(0.5)
shell.run('clear')
until redstone.getInput ('back',true)
shell.run('clear')
print("A TORNADO WARNING HAS BEEN PUT IN PLACE")
sleep(1)
local time = os.time()
local formattedTime = textutils.formatTime(time, false)
print("AT" .. formattedTime) print("A TORNADO WARNING WAS PUT IN PLACE")
sleep(1)
print("ALL RESIDENTS SHOULD TAKE COVER")
sleep(1)
print("TAKE COVER IN A TORNADO SHELTER")
sleep(1)
print("IF NO SHELTER IS AVAILABLE")
print("TAKE COVER IN A CENTRAL ROOM IN A HOUSE")
print("THIS ROOM SHOULD BE ON THE LOWER FLOOR OF THE HOUSE")
301 posts
Location
Whenever, Wherever!
Posted 13 June 2014 - 03:49 AM
Any chance of integrating with real life data? Could of been useful this evening.
11 posts
Posted 13 June 2014 - 10:01 PM
Not sure. That was really what made the idea for this code. I was trying to see if I could make a code by finding codes that would pull data from weather services that would show weather reports in MC or Tekkit on a monitor or normal computer screen.
1852 posts
Location
Sweden
Posted 16 June 2014 - 11:57 AM
A small suggestion, Add a clock that shows all the time so that the time the tornado was spotted would be more useful
11 posts
Posted 22 June 2014 - 03:01 PM
it does that is what this part of the code does:
local time = os.time()
local formattedTime = textutils.formatTime(time, false)
print("AT" .. formattedTime) print("A tornado WARNING WAS PUT IN PLACE")
51 posts
Posted 22 June 2014 - 09:27 PM
term.clear()
print("No tornado warnings in this area")
while not redstone.getInput ('back',true) do end
term.clear()
print("A TORNADO WARNING HAS BEEN PUT IN PLACE")
print("AT" .. textutils.formatTime(os.time(), false).."A TORNADO WARNING WAS PUT IN PLACE\nALL RESIDENTS SHOULD TAKE COVER\nTAKE COVER IN A TORNADO SHELTER\nIF NO SHELTER IS AVAILABLE\nTAKE COVER IN A CENTRAL ROOM IN A HOUSE\nTHIS ROOM SHOULD BE ON THE LOWER FLOOR OF THE HOUSE")
1852 posts
Location
Sweden
Posted 25 June 2014 - 12:42 AM
it does that is what this part of the code does:
local time = os.time()
local formattedTime = textutils.formatTime(time, false)
print("AT" .. formattedTime) print("A tornado WARNING WAS PUT IN PLACE")
You misunderstood me.. that piece of code just prints the time when the tornado was spotted, I meant always drawing the current time
1326 posts
Location
Error 404: Could not find.
Posted 25 June 2014 - 10:41 PM
Stick this BEFORE the part when the tornado is detected for a clock. (One that constantly runs instead of every time there is a tornado)
local time = os.time()
local formattedTime = textutils.formatTime(time,false)
term.setCursorPos( <x>,<y> )
term.write( time )
--or
term.write( "["..time.."]" )
Edited on 25 June 2014 - 08:42 PM
50 posts
Posted 01 July 2014 - 09:25 PM
You could connect this up to the Howler Alarm And put a random number code for the sleep too for some more realism. Along with a rain maker. OR a command block to implement a storm with lightning.
Edited on 01 July 2014 - 07:26 PM
1326 posts
Location
Error 404: Could not find.
Posted 02 July 2014 - 10:45 PM
Well, the tornado mod does provide a siren that is redstone activated.
1 posts
Posted 01 June 2016 - 12:23 AM
Easy paste bin download
pastebin get xL0ZSsd2 startup
67 posts
Posted 21 June 2016 - 06:30 AM
A few suggestions:
A.) Indent your code- This won't change the function of the program but it will make you seem more experienced as this is a common practice amongst professional programmers
B.) Don't use shell.run('clear')- Again, this won't change the function of the program but will make you seem more experienced
C.) Add a variable at the beginning for the input side so people can change it easier.
D.) Put your code in a while true loop that way you don't have to reset the program after every tornado.
E.) Add support for monitors. For example, when a tornado warning is issued, the computer would put the message on all the monitors it is connected to.
Other than that, good program!
89 posts
Posted 21 June 2016 - 04:22 PM
A few suggestions:
A.) Indent your code- This won't change the function of the program but it will make you seem more experienced as this is a common practice amongst professional programmers
B.) Don't use shell.run('clear')- Again, this won't change the function of the program but will make you seem more experienced
C.) Add a variable at the beginning for the input side so people can change it easier.
D.) Put your code in a while true loop that way you don't have to reset the program after every tornado.
E.) Add support for monitors. For example, when a tornado warning is issued, the computer would put the message on all the monitors it is connected to.
Other than that, good program!
Note: if you wish to clear, just use term.clear() to clear the screen