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

[LUA] [ERROR] bios:206: [string "startup"]:39: '=' expected

Started by CCNoob, 10 August 2012 - 03:46 PM
CCNoob #1
Posted 10 August 2012 - 05:46 PM
Hey there.

I'm trying to make a casino on a multiplayer server I play on. However, I keep on getting errors with my code. I set the code as startup, by the way. Basically, you put a diamond in a chest, and it will pass through a filter then item detector and send a pulse to the computer, which will start the slots. The code is linked http://pastebin.com/kxUNBk1p . Also posted below. Thanks for any and all help in advance!


prizeamount = 10
detectside = "front"
monside = "right"
dispenserside = "bottom"
showloser = true

mon = peripheral.wrap(monside)
shell.run("clear",1)
mon.clear()
mon.setCursorPos(1,1)
mon.write(" Place")
mon.setCursorPos(1,2)
mon.write("Diamond")
mon.setCursorPos(1,3)
mon.write("In Chest")
mon.setCursorPos(1,4)
mon.write("To Play")
print("Hold Control + T to edit code")

function winner()
sleep(2)
mon.clear()
mon.setCursorPos(1,1)
mon.write("*-*-*-*")
mon.setCursorPos(1,2)
mon.write("-*-*-*-")
mon.setCursorPos(1,3)
mon.write("Winner!")
mon.setCursorPos(1,4)
mon.write("-*-*-*-")
mon.setCursorPos(1,5)
mon.write("*-*-*-*")
sleep(2.5)
end

function Loser()
sleep(2)
mon.clear()
mon.setCursorPos(1,1)
mon.write("*-*-*-*")
mon.setCursorPos(1,2)
mon.write("-*-*-*-")
mon.setCursorPos(1,3)
mon.write("Loser!!")
mon.setCursorPos(1,4)
mon.write("-*-*-*-")
mon.setCursorPos(1,5)
mon.write("*-*-*-*")
sleep(2)
end

function slots()
result1 = math.random(1,7)
result1 = result1 - ".0"

result2 = math.random(1,7)
result2 = result2 - ".0"

result3 = math.random(1,7)
result3 = result3 - ".0"

result4 = math.random(1,7)
result4 = result4 - ".0"

result5 = math.random(1,7)
result5 = result5 - ".0"

result6 = math.random(1,7)
result6 = result6 - ".0"

result7 = math.random(1,7)
result7 = result7 - ".0"

result8 = math.random(1,7)
result8 = result8 - ".0"

result9 = math.random(1,7)
result9 = result9 - ".0"

term.setCursorPos(25,5)
mon.clear()
mon.setCursorPos(1,1)
mon.write("*******")
mon.setCursorPos(2,2)
mon.write(result1.."|"..result2.."|"..result3)
mon.setCursorPos(2,3)
mon.write(result4.."|"..result5.."|"..result6)
mon.setCursorPos(2,4)
mon.write(result7.."|"..result8.."|"..result9)
mon.setCursorPos(1,5)
mon.write("*******")
term.setCursorPos(1,3)
print("Debug Info:")
print("Results:   "..result1.."|"..result2.."|"..result3)
print("		   "..result4.."|"..result5.."|"..result6)
print("		   "..result7.."|"..result8.."|"..result9)

if result1 == result2 and result2 == result3 then
  print("Row Match, Top Row")
  winner()
  cpayout = 0
  while cpayout < prizeamount do  
		 redstone.setOutput(dispenserside,true)
   sleep(0.2)
   redstone.setOutput(dispenserside,false)
   sleep(0.2)
   cpayout = cpayout +1
  end
  os.reboot()
elseif result4 == result5 and result5 == result6 then
  print("Row Match, Middle Row")
  winner()
  cpayout = 0
  while cpayout < prizeamount do  
		 redstone.setOutput(dispenserside,true)
   sleep(0.2)
   redstone.setOutput(dispenserside,false)
   sleep(0.2)
   cpayout = cpayout +1
  end
  os.reboot()
elseif result7 == result8 and result8 == result9 then
  print("Row Match, Bottom Row")
  winner()
  cpayout = 0
  while cpayout < prizeamount do  
		 redstone.setOutput(dispenserside,true)
   sleep(0.2)
   redstone.setOutput(dispenserside,false)
   sleep(0.2)
   cpayout = cpayout +1
  end
  os.reboot()
elseif result1 == result5 and result5 == result9 then
  print("Diagonal Match From top to bottom.")
  winner()
  cpayout = 0
  while cpayout < prizeamount do  
		 redstone.setOutput(dispenserside,true)
   sleep(0.2)
   redstone.setOutput(dispenserside,false)
   sleep(0.2)
   cpayout = cpayout +1
  end
  os.reboot()
elseif result7 == result5 and result5 == result3 then
  print("Diagonal Match From bottom to top.")
  winner()
  cpayout = 0
  while cpayout < prizeamount do  
		 redstone.setOutput(dispenserside,true)
   sleep(0.2)
   redstone.setOutput(dispenserside,false)
   sleep(0.2)
   cpayout = cpayout +1
  end
  os.reboot()
else
  print("There was No Match")
  if showloser == true then
   Loser()
  end
  sleep(2)
  os.reboot()
end

end

local rRunning = true

while rRunning do
  sleep(0.5)
  local rEvent, param = os.pullEvent()
  if rEvent == "redstone" then
	if redstone.getInput(detectside) then
	  if redstone.getInput(detectside) == true then
	  slots()
	  else
		shell.run("clear",1)
	  end
	end
  end
end
CCNoob #2
Posted 10 August 2012 - 11:20 PM
Bump ;)/>/>
Pharap #3
Posted 11 August 2012 - 05:13 AM
Does it happen at a particular point?

line 39 in bios is in the new line function, so my guess is that one of those prints is conflicting with the cursor position/what's being written.
CCNoob #4
Posted 11 August 2012 - 02:06 PM
Does it happen at a particular point?

line 39 in bios is in the new line function, so my guess is that one of those prints is conflicting with the cursor position/what's being written.

This happens directly after I start the program. Nothing will display but this error message.

I'll check into the new line function, and see if I can find anything; however, I'm kind of lost, so I'll probably need help ;)/>/>

Thanks :(/>/>
Pharap #5
Posted 11 August 2012 - 07:57 PM
Try replacing some of the prints with write, it might fix things.
CCNoob #6
Posted 11 August 2012 - 09:43 PM
Try replacing some of the prints with write, it might fix things.

I removed all prints and term.setCursorPos.. Nothing. However, there is a new error, this time Line38.

bios:206: [string: "casino"]:38: "=" expected
Tiin57 #7
Posted 11 August 2012 - 10:45 PM
That's the same error, but you moved the lines up one. I have nothing to add except that observation.
Pharap #8
Posted 12 August 2012 - 03:34 AM
Try replacing some of the prints with write, it might fix things.

I removed all prints and term.setCursorPos.. Nothing. However, there is a new error, this time Line38.

bios:206: [string: "casino"]:38: "=" expected

Can you post a copy of the edited code so I know which line is now line 38? It would make things much easier.
Also, are you using CC 1.3 or 1.4?
If you're using 1.4, line 206 of the bios is part of the file loading function, but that probably doesn't mean much.