local monitor = peripheral.wrap("left")
term.redirect(monitor)
term.clear()
sleep(5)
local song = {}
local filename = fs.combine(disk.getMountPath("top"), "songdata")
local file = fs.open(filename, "r")
if disk.hasData("top") then
print("Reading song '"..disk.getLabel("top").."' . Commence song!")
for line in io.lines(file) do
table.insert(song, line)
end
end
term.restore()
else
print("No data in disk!")
term.restore()
end
for i = 1, #song do
clin = song[i]
local col
check = string.sub(clin, 1, 2)
if check == "^1" then
col = 1
elseif check == "^2" then
col = 2
elseif check == "^3" then
col = 4
elseif check == "^4" then
col = 8
elseif check == "^5" then
col = 16
end
local nt
notecheck = string.sub(clin, 4)
if notecheck = "1" then
nt = 1
elseif notecheck = "2" then
nt = 2
elseif notecheck = "3" then
nt = 3
elseif notecheck = "4" then
nt = 4
elseif notecheck = "5" then
nt = 5
elseif notecheck = "6" then
nt = 6
elseif notecheck = "7" then
nt = 7
elseif notecheck = "8" then
nt = 8
elseif notecheck = "9" then
nt = 9
elseif notecheck = "10" then
nt = 10
elseif notecheck = "11" then
nt = 11
elseif notecheck = "12" then
nt = 12
elseif notecheck = "13" then
nt = 13
elseif notecheck = "14" then
nt = 14
elseif notecheck = "15" then
nt = 15
elseif notecheck = "16" then
nt = 16
end
print(col.."|"..nt)
local times = nt
repeat rs.setBundledOutput('bottom', col) sleep() rs.setBundledOutput('bottom', 0) times = (times - 1) until times = 0
end
[Error] bios:206: [string "MasterControl"]:15: '<eof>' expected?
#1
Posted 19 October 2012 - 04:14 PM
#2
Posted 19 October 2012 - 04:22 PM
local monitor = peripheral.wrap("left")
term.redirect(monitor)
term.clear()
sleep(5)
local song = {}
local filename = fs.combine(disk.getMountPath("top"), "songdata")
local file = fs.open(filename, "r")
if disk.hasData("top") then
print("Reading song '"..disk.getLabel("top").."' . Commence song!")
for line in io.lines(file) do
table.insert(song, line)
end
end
term.restore()
else << wheres the start?
print("No data in disk!")
term.restore()
end
you put in an else with out an if?also, tab your code, errors like this would be so much easier to spot.
#3
Posted 19 October 2012 - 04:24 PM
billysback, on 19 October 2012 - 04:22 PM, said:
local monitor = peripheral.wrap("left")
term.redirect(monitor)
term.clear()
sleep(5)
local song = {}
local filename = fs.combine(disk.getMountPath("top"), "songdata")
local file = fs.open(filename, "r")
if disk.hasData("top") then
print("Reading song '"..disk.getLabel("top").."' . Commence song!")
for line in io.lines(file) do
table.insert(song, line)
end
end
term.restore()
else << wheres the start?
print("No data in disk!")
term.restore()
end
you put in an else with out an if?also, tab your code, errors like this would be so much easier to spot.
Also, around line 35 I missed an extra =
and after that I missed a lot of ='s.
Also, i'm now getting a "attempt to call nil" at 'for line in io.lines(file) do'..
#4
Posted 19 October 2012 - 04:39 PM
#6
Posted 19 October 2012 - 04:50 PM
local monitor = peripheral.wrap("left")
term.redirect(monitor)
term.clear()
sleep(5)
local song = {}
local filename = fs.combine(disk.getMountPath("top"), "songdata")
local file = io.open(filename, "r")
if disk.hasData("top") then
print("Reading song '"..disk.getLabel("top").."' . Commence song!")
for line in file:lines() do
table.insert(song, line)
end
term.restore()
else
print("No data in disk!")
term.restore()
end
for i = 1, #song do
clin = song[i]
local col
check = string.sub(clin, 1, 2)
if check == "^1" then
col = 1
elseif check == "^2" then
col = 2
elseif check == "^3" then
col = 4
elseif check == "^4" then
col = 8
elseif check == "^5" then
col = 16
end
local nt
notecheck = string.sub(clin, 4)
if notecheck == "1" then
nt = 1
elseif notecheck == "2" then
nt = 2
elseif notecheck == "3" then
nt = 3
elseif notecheck == "4" then
nt = 4
elseif notecheck == "5" then
nt = 5
elseif notecheck == "6" then
nt = 6
elseif notecheck == "7" then
nt = 7
elseif notecheck == "8" then
nt = 8
elseif notecheck == "9" then
nt = 9
elseif notecheck == "10" then
nt = 10
elseif notecheck == "11" then
nt = 11
elseif notecheck == "12" then
nt = 12
elseif notecheck == "13" then
nt = 13
elseif notecheck == "14" then
nt = 14
elseif notecheck == "15" then
nt = 15
elseif notecheck == "16" then
nt = 16
end
print(col.."|"..nt)
local times = nt
repeat
rs.setBundledOutput('bottom', col)
sleep()
rs.setBundledOutput('bottom', 0)
times = (times - 1)
until times == 0
end
It doesn't like line 68.. (print(col.."|"..nt))It said: attempt to concatenate string and nil
I fixed that - and now i get an error with this line:
elseif check == "^3" then -- bad argument: double expected, got nil
#7
Posted 19 October 2012 - 05:46 PM
Can anyone help??
Edited by digpoe, 19 October 2012 - 06:16 PM.
#9
Posted 19 October 2012 - 06:56 PM
digpoe, on 19 October 2012 - 05:46 PM, said:
Can anyone help??
This is a forum, not an instant messaging service. Have some patience, please. You'll need to post the latest version of the code and the full error message. I have the feeling that the error isn't where you're saying it is.
#10
Posted 19 October 2012 - 07:01 PM
Lyqyd, on 19 October 2012 - 06:56 PM, said:
digpoe, on 19 October 2012 - 05:46 PM, said:
Can anyone help??
This is a forum, not an instant messaging service. Have some patience, please. You'll need to post the latest version of the code and the full error message. I have the feeling that the error isn't where you're saying it is.
Yeah.. I figured it out. sleep() doesn't like being used with no arguments.
Anyway, here's my updated code.. It's still bugged, as it runs an infinite loop just printing 0|0 to my terminal screen..
local monitor = peripheral.wrap("left")
term.redirect(monitor)
term.clear()
sleep(5)
local song = {}
local filename = fs.combine(disk.getMountPath("top"), "songdata")
local file = io.open(filename, "r")
if disk.hasData("top") then
print("Reading song '"..disk.getLabel("top").."' . Commence song!")
for line in file:lines() do
table.insert(song, line)
end
else
print("No data in disk!")
term.restore()
end
for i = 1, #song do
clin = song[i]
col = 0
check = string.sub(clin, 1, 2)
if check == "^1" then
col = 1
elseif check == "^2" then
col = 2
elseif check == "^3" then
col = 4
elseif check == "^4" then
col = 8
elseif check == "^5" then
col = 16
end
nt = 0
notecheck = string.sub(clin, 4)
if notecheck == "1" then
nt = 1
elseif notecheck == "2" then
nt = 2
elseif notecheck == "3" then
nt = 3
elseif notecheck == "4" then
nt = 4
elseif notecheck == "5" then
nt = 5
elseif notecheck == "6" then
nt = 6
elseif notecheck == "7" then
nt = 7
elseif notecheck == "8" then
nt = 8
elseif notecheck == "9" then
nt = 9
elseif notecheck == "10" then
nt = 10
elseif notecheck == "11" then
nt = 11
elseif notecheck == "12" then
nt = 12
elseif notecheck == "13" then
nt = 13
elseif notecheck == "14" then
nt = 14
elseif notecheck == "15" then
nt = 15
elseif notecheck == "16" then
nt = 16
end
reptime = nt
repeat
print(col.."|"..nt)
rs.setBundledOutput('bottom', col)
sleep(0.1)
rs.setBundledOutput('bottom', 0)
reptime = (reptime - 1)
until reptime == 0
print("Done!")
term.restore()
print("Done!")
end
#11
Posted 19 October 2012 - 07:52 PM
[spoiler][code]your code here[/ code][/spoiler]
#12
Posted 19 October 2012 - 08:53 PM
#13
Posted 20 October 2012 - 11:35 AM
Lyqyd, on 19 October 2012 - 08:53 PM, said:
#14
Posted 20 October 2012 - 04:47 PM
I'm pretty sure the output will help you figure this out.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











