Posted 10 August 2017 - 03:52 AM
Introduction
I am having an issue with a simple program I am making to make mass producing of programs on floppies and such, more efficient and cleaner.
The issue comes (I assume) when I try to define read() as a word and not a string, and then try to put that into a command which requires strings.
I want the program to essentially ask for the drive side, the file, move it to the disk in that drive, and then rename the disk to whatever the user pleases. I haven't done the last part yet. I want to fix this part first.
The Code
I am having an issue with a simple program I am making to make mass producing of programs on floppies and such, more efficient and cleaner.
The issue comes (I assume) when I try to define read() as a word and not a string, and then try to put that into a command which requires strings.
I want the program to essentially ask for the drive side, the file, move it to the disk in that drive, and then rename the disk to whatever the user pleases. I haven't done the last part yet. I want to fix this part first.
The Code
selDrive = nil
term.clear()
term.setCursorPos(1,1)
term.setTextColour(colours.yellow)
term.write("What side is the drive with the disk?")
term.setCursorPos(2,5)
term.setTextColour(colours.white)
term.write("Examples: right, front, back, top")
term.setCursorPos(2,3)
term.setTextColour(colours.blue)
while true do
response1 = read()
term.setCursorPos(2,3)
term.clearLine()
if response1 == "top"
then selDrive = top
break
elseif response1 == "bottom"
then selDrive = bottom
break
elseif response1 == "front"
then selDrive = front
break
elseif response1 == "back"
then selDrive = back
break
elseif response1 == "left"
then selDrive = left
break
elseif response1 == "right"
then selDrive = right
break
end
end
term.clear()
term.setCursorPos(1,1)
term.setTextColour(colours.yellow)
term.write("What would you like to export?")
term.setCursorPos(2,5)
term.setTextColour(colours.white)
print("The name of the file; for example: adventure, hello, help")
term.setCursorPos(2,3)
term.setTextColour(colours.blue)
file = read()
term.clear()
dir = disk.getMountPath(selDrive)
fs.copy(file,dir)
sleep(1)