113 posts
Posted 29 July 2012 - 01:44 AM
ty for helping.
Though I need to know how to hook the program up to the monitor when it runs.
conventinal = ("1337")
heavy = ("2448")
print ("ENTER LAUNCH CODE FOR THE HEAVY OR CONVENTINAL MISSILES")
if = conventinal then
rs.setOutput (left, true)
if = heavy then
rs.setOutput (right, true)
end
print("Launching!")
sleep(5)
print("Action Completed (Assuming the code is correct")
sleep(5)
os.shutdown()
Thats the code.
Its coded so that it'll have two signal senders from Wireless Redstone and it'll go to my my missile panel, which will launch the missiles.
But please tell me why the script won't work.
ty
295 posts
Location
In the TARDIS at an unknown place in time.
Posted 29 July 2012 - 01:50 AM
Found 6 errors, new code:
conventinal = ("1337")
heavy = ("2448")
print ("ENTER LAUNCH CODE FOR THE HEAVY OR CONVENTINAL MISSILES")
input = read()
if input == conventinal then
rs.setOutput ("left", true)
elseif input == heavy then
rs.setOutput ("right", true)
end
print("Launching!")
sleep(5)
print("Action Completed (Assuming the code is correct)")
sleep(5)
os.shutdown()
113 posts
Posted 29 July 2012 - 01:52 AM
TY.
I'm not one of those people that can make scripts with functions without making a small error sometimes.
295 posts
Location
In the TARDIS at an unknown place in time.
Posted 29 July 2012 - 01:54 AM
TY.
I'm not one of those people that can make scripts with functions without making a small error sometimes.
Functions are fairly easy:
function funcname()
<Code>
end
funcname()
Btw, I edited my last post, found a 5th error if you didn't see.
113 posts
Posted 29 July 2012 - 01:55 AM
Uh, when I use that code I get "bios:206: [string "startup" ]: 7 : unexpected symbol
295 posts
Location
In the TARDIS at an unknown place in time.
Posted 29 July 2012 - 01:56 AM
6th error! Just keep on finding them, lol.
1604 posts
Posted 29 July 2012 - 01:56 AM
You never get the input, so you don't have something to compare with. Try with this:
local conventinal = "1337"
local heavy = "2448"
print("ENTER CODE FOR THE HEACY OR CONVENTINAL MISSILES")
local input = read()
if input == conventinal then
rs.setOutput("left", true)
elseif input == heavy then
rs.setOutput("right", true)
end
print("Launching!")
sleep(5)
print("Action Completed (Assuming the code is correct)")
sleep(5)
os.shutdown()
167 posts
Posted 29 July 2012 - 01:59 AM
Just some small errors, I would've posted the new code but it's already been done.
113 posts
Posted 29 July 2012 - 02:04 AM
TY.
you can't expect an 11 year old to know how to always code.
295 posts
Location
In the TARDIS at an unknown place in time.
Posted 29 July 2012 - 02:06 AM
TY.
you can't expect an 11 year old to know how to always code.
I'm 13 and I'm fluent-ish.
113 posts
Posted 29 July 2012 - 02:07 AM
BTW.
How do I make it so that it'll show up on the monitor I have installed?
295 posts
Location
In the TARDIS at an unknown place in time.
Posted 29 July 2012 - 02:08 AM
BTW.
How do I make it so that it'll show up on the monitor I have installed?
I've never dealt with monitors so I have no clue, sorry.
113 posts
Posted 29 July 2012 - 02:09 AM
thats k.
113 posts
Posted 29 July 2012 - 04:38 AM
Testing a new code with else, can you help?
conventinal = ("1337")
heavy = ("2448")
textutils.slowWrite ("ENTER LAUNCH CODE FOR THE HEAVY OR CONVENTINAL MISSILES:")
input = read()
if input == conventinal then
rs.setOutput ("left", true)
elseif input == heavy then
rs.setOutput ("right", true)
if input == else then
textutils.slowPrint("WRONG CODE! SHUTTING DOWN IMMEDIANTLY")
os.shutdown()
end
print("Launching!")
sleep(2)
textutils.slowPrint("Action Completed ("Missiles have been launched!")
sleep(3)
os.shutdown()
167 posts
Posted 29 July 2012 - 04:55 AM
conventinal = ("1337")
heavy = ("2448")
textutils.slowWrite ("ENTER LAUNCH CODE FOR THE HEAVY OR CONVENTINAL MISSILES:")
input = read()
if input == conventinal then
rs.setOutput ("left", true)
elseif input == heavy then
rs.setOutput ("right", true)
if input == else then
textutils.slowPrint("WRONG CODE! SHUTTING DOWN IMMEDIANTLY")
os.shutdown()
end
print("Launching!")
sleep(2)
textutils.slowPrint("Action Completed ("Missiles have been launched!")
sleep(3)
os.shutdown()
Change if input == else then
to
else
like this:
conventinal = ("1337")
heavy = ("2448")
textutils.slowWrite ("ENTER LAUNCH CODE FOR THE HEAVY OR CONVENTINAL MISSILES:")
input = read()
if input == conventinal then
rs.setOutput ("left", true)
elseif input == heavy then
rs.setOutput ("right", true)
else
textutils.slowPrint("WRONG CODE! SHUTTING DOWN IMMEDIANTLY")
os.shutdown()
end
print("Launching!")
sleep(2)
textutils.slowPrint("Action Completed ("Missiles have been launched!")
sleep(3)
os.shutdown()
113 posts
Posted 29 July 2012 - 04:57 AM
thanks, mate! :ph34r:/>/>
167 posts
Posted 29 July 2012 - 04:58 AM
Also, if you want to run it on a monitor, enter in the computer
monitor (side) (program)
so,
monitor top testprogram
would run the program named testprogram on the top monitor.
113 posts
Posted 29 July 2012 - 05:15 AM
Yeah. I know.
But I wanna know how to have it run on both the monitor and the computer.
113 posts
Posted 29 July 2012 - 05:18 AM
BTW, does how enterkeyed your code is matter?
If it has no enters would it still work?
113 posts
Posted 29 July 2012 - 05:26 AM
WOO.
Made my first script ALL by myself without posting on help from a pro thread. :ph34r:/>/>
34 posts
Location
Programming Land
Posted 30 July 2012 - 11:13 PM
I can help with the monitors. Here is some code.
function print(text)
monitor.print(text)
term.write(text)
end
side = "top" --Side of monitor
monitor = peripheral.wrap(side)
-- then you just have to add this code and not change anything!
3790 posts
Location
Lincoln, Nebraska
Posted 31 July 2012 - 12:11 AM
Just from a proofreading standpoint: conventinal is actually properly spelled "CONVENTIONAL". Bugging me that nobody saw cause to correct it, but not a huge thing…