10 posts
Posted 17 February 2012 - 04:00 PM
ok, while waiting for some help with my decoder… (
http://www.computercraft.info/forums2/index.php?/topic/106-making-a-binary-to-decimal-decoder/)
i decided to try somthing simpler… so i set about making a keycode type thing…
here is what i have so far…
print = ("Loading KeyReader")
textutils.slowPrint = ("||||||||||",10)
white true do
shell.run ("clear")
print("=================")
print("KeyReader: Active")
print("=================")
print("insert Key")
event, driveSide == os.pullEventRaw()
if (event == "disk" and driveSide and disk.isPresent(driveSide) ) then
lable = disk.getLabel(driveSide)
if (lable == "WaterControl DoorKey") then
rs.setBundeledOutput (bottom, colors.white)
else
print("error")
when i run it, this error appears
[string "door"]:3: '=' expected
im lost for what to do now…
715 posts
Posted 17 February 2012 - 04:07 PM
Get rid of the '=' in these two lines:
print = ("Loading KeyReader")
textutils.slowPrint = ("||||||||||",10)
You're trying to call functions, not assign them with anything. But I guess, since the rest of your code doesn't have this, you might've just unintentionally derped. :D/>/>
Also remove one '=' from this line:
event, driveSide == os.pullEventRaw()
You want to assign values here, not check them!
= for assigning values
== for checking them
Edited on 17 February 2012 - 03:09 PM
10 posts
Posted 17 February 2012 - 04:20 PM
wow, extreme derp on my part, will change thoes parts now
10 posts
Posted 17 February 2012 - 04:22 PM
… changed thoes parts, still not working…
print ("Loading KeyReader")
textutils.slowPrint ("||||||||||")
white true do
shell.run ("clear")
print("=================")
print("KeyReader: Active")
print("=================")
print("insert Key")
event, driveSide = os.pullEventRaw()
if (event == "disk" and driveSide and disk.isPresent(driveSide) ) then
lable = disk.getLabel(driveSide)
if (lable == "WaterControl DoorKey") then
rs.setBundeledOutput (bottom, colors.white)
else
print("error")
454 posts
Location
London
Posted 17 February 2012 - 04:40 PM
… changed thoes parts, still not working…
print ("Loading KeyReader")
textutils.slowPrint ("||||||||||")
while true do -- You mis-spelled while
shell.run ("clear")
print("=================")
print("KeyReader: Active")
print("=================")
print("insert Key")
event, driveSide = os.pullEventRaw()
if (event == "disk" and driveSide and disk.isPresent(driveSide) ) then
lable = disk.getLabel(driveSide)
if (lable == "WaterControl DoorKey") then
rs.setBundeledOutput (bottom, colors.white)
else
print("error")
You're missing three
ends at the end, from a glance.
I've added them and added some pointers:
print ("Loading KeyReader")
textutils.slowPrint ("||||||||||")
white true do -- you made a typo here; while, not white
--you can use term.clear()
shell.run ("clear")
print("=================")
print("KeyReader: Active")
print("=================")
print("insert Key")
event, driveSide = os.pullEventRaw()
if (event == "disk" and driveSide and disk.isPresent(driveSide) ) then
lable = disk.getLabel(driveSide)
if (lable == "WaterControl DoorKey") then
rs.setBundeledOutput (bottom, colors.white)
else
print("error")
end
end
end
10 posts
Posted 17 February 2012 - 05:42 PM
ok… corrected as above, then tested it and it worked!… for a while
it got up to "insert Key". when i inserted the correct key, it said "attempted to call nil"
so close!
also when i put a diffrent disk in, nothing visable happened
454 posts
Location
London
Posted 17 February 2012 - 05:49 PM
ok… corrected as above, then tested it and it worked!… for a while
it got up to "insert Key". when i inserted the correct key, it said "attempted to call nil"
so close!
also when i put a diffrent disk in, nothing visable happened
Check the spelling of your functions, that'd be my pointer.
One of them is spelled wrong (hint: it's in the rs api).
type "help rs" in the console, and you should get the correct spelling.
37 posts
Location
Quebec, Canada
Posted 18 February 2012 - 08:22 AM
rs.setBundeledOutput wtf
rs.setBundledOutput
17 posts
Location
Swiss..
Posted 05 March 2012 - 09:47 PM
rs.setBundeledOutput wtf
rs.setBundledOutput
This is from redpower..! And it's spelled wrong.. (damn i told you guys where the spelling Error is!)
454 posts
Location
London
Posted 05 March 2012 - 10:09 PM
rs.setBundeledOutput wtf
rs.setBundledOutput
This is from redpower..! And it's spelled wrong.. (damn i told you guys where the spelling Error is!)
Yes; this is because ComputerCraft's computers can connect to bundled cables.
718 posts
Location
Hawaii
Posted 06 March 2012 - 01:53 AM
white true do
?
edit:
you misspelled while true do
715 posts
Posted 06 March 2012 - 01:56 AM
white true do ?
Could you be a bit more precise? :unsure:/>/>
Are you asking what that line is supposed to do?
Are you not really asking, but merely pointing out that there is no such thing as a white-loop, but a while-loop?
*puzzled*
18 posts
Location
My Computer. Possibly, my computer inside my computer.
Posted 06 March 2012 - 03:15 PM
also when i put a diffrent disk in, nothing visable happened
That's because you've got the else after this line:
if (lable == "WaterControl DoorKey") then
You just need to add an end after that if and before the else.
if (event == "disk" and driveSide and disk.isPresent(driveSide) ) then
lable = disk.getLabel(driveSide)
if (lable == "WaterControl DoorKey") then
rs.setBundledOutput(bottom, colors.white)
end
else
print("error")
end
453 posts
Location
Holland
Posted 08 March 2012 - 04:16 PM
white true do
really?
do this:
while true do
1 posts
Posted 30 March 2012 - 05:37 AM
if (event == "disk" and driveSide and disk.isPresent(driveSide) ) then
lable = disk.getLabel(driveSide)
if lable == "WaterControl DoorKey") then
rs.setBundeledOutput (bottom, colors.white)
else
print("error")
end
hobnob11, you spelled
label incorrectly.
7 posts
Location
Minecraftia
Posted 10 July 2012 - 11:04 PM
Hey, I tried to use this but it gave me an error at the last "end" saying "<eof> expected". Being a complete noob to this mod, I have no idea what this means ! Someone help, please :)/>/>
286 posts
Location
Bonn Germany
Posted 10 July 2012 - 11:21 PM
eof means you've putten too many ends or you've placed them wrong. Complete code plz.