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

Monitor change

Started by Fiestaguy, 27 February 2014 - 07:26 PM
Fiestaguy #1
Posted 27 February 2014 - 08:26 PM
I am having a problem.
There is a monitor in my office displaying the following text:

Ovis Aries Industries
Nuclear reactor: STABLE


**:**PM/AM
the script is:

side = "back"
cn = "Ovis Aries Industries"
mon = peripheral.wrap(side)
Active = Nein
mon.setTextScale(2)
if Active == Nuke then
while true do
mon.setCursorPos(1,1)
mon.write(cn)
mon.setCursorPos(1,2)
mon.write("Nuclear reactor: STABLE
mon.setCursorPos(22,9)
mon.write(textutils.formatTime(os.time(), false))
sleep(1)
mon.clear()
shell.run("Nuke")
end
end
if redstone.getInput("left")
then
Active = Nuke
mon.clear()
mon.setCursorPos(1,1)
mon.write("EMERGENCY. REACTOR MELTDOWN IMMINENT")
mon.setCursorPos(1,2)
mon.write("REACTOR SHUT DOWN.")
end
You might notice that there is a command to run the program "Nuke"

that program is irrelevant as it just shows stuff on the computer itself and not on the monitor.

I would like to add that in the seventh line

if Active == Nuke then
when its == the screen will work as fine as normal and show all info

when the == is changed to ~= (Is not equal to) then the whole monitor becomes inoperatable.

I would like to know if someone knows how to fix this. thank you
KaoS #2
Posted 27 February 2014 - 10:16 PM
you need to enclose your strings in quotes

side = "back"
cn = "Ovis Aries Industries"
mon = peripheral.wrap(side)
Active = "Nein"
mon.setTextScale(2)
if Active == "Nuke" then
while true do
mon.setCursorPos(1,1)
mon.write(cn)
mon.setCursorPos(1,2)
mon.write("Nuclear reactor: STABLE
mon.setCursorPos(22,9)
mon.write(textutils.formatTime(os.time(), false))
sleep(1)
mon.clear()
shell.run("Nuke")
end
end
if redstone.getInput("left")
then
Active = "Nuke"
mon.clear()
mon.setCursorPos(1,1)
mon.write("EMERGENCY. REACTOR MELTDOWN IMMINENT")
mon.setCursorPos(1,2)
mon.write("REACTOR SHUT DOWN.")
end