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

[String "door"]:3: '=' Expected

Started by hobnob11, 17 February 2012 - 03:00 PM
hobnob11 #1
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…
Espen #2
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
hobnob11 #3
Posted 17 February 2012 - 04:20 PM
wow, extreme derp on my part, will change thoes parts now
hobnob11 #4
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")
Advert #5
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
hobnob11 #6
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
Advert #7
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.
arongy #8
Posted 18 February 2012 - 08:22 AM
rs.setBundeledOutput wtf

rs.setBundledOutput
Zitrone77 #9
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!)
Advert #10
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.
ComputerCraftFan11 #11
Posted 06 March 2012 - 01:53 AM
white true do
?

edit:

you misspelled while true do
Espen #12
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*
ChaosBeing #13
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
wilcomega #14
Posted 08 March 2012 - 04:16 PM

white true do
really?
do this:

while true do
nunag24 #15
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.
RaTheBadger #16
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 :)/>/>
xuma202 #17
Posted 10 July 2012 - 11:21 PM
eof means you've putten too many ends or you've placed them wrong. Complete code plz.