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

Impossibly confused.

Started by applesauce10189, 13 January 2014 - 12:17 AM
applesauce10189 #1
Posted 13 January 2014 - 01:17 AM
So, I set the startup to say a different OS and to run my program. It only uses about 5 lines of code and my error is "bios:335: Expected string, string"


term.clear()
term.setCursorPos(1,1)
term.setTextColor(1024)
print("AppleOS V1")
os.run("turtledoor")
applesauce10189 #2
Posted 13 January 2014 - 01:24 AM
Note: that os.run("turtledoor") line, I tried running it alone and it works fine so the problem is somewhere above it.

EDIT: I tried running turtledoor itself not the actual line of code.
Edited on 13 January 2014 - 12:35 AM
Csstform #3
Posted 13 January 2014 - 01:34 AM
I'm not sure about the part where you set the color, but whenever I use 'shell.run()' (the same as os.run()) I do not use quotation marks… I don't see any other problems.
applesauce10189 #4
Posted 13 January 2014 - 01:40 AM
Removed quotation marks. Same error. I feel the quotation marks are optional because of this but it also could be the bios:335… error being triggered first.
Also changed term.setTextColor(1024) to term.setTextColor(colors.purple)
It wrote the "AppleOS" part but still didn't run the program.

EDIT: changed os.run(turtledoor) to use shell instead of os and now it ignores that line of code entirely, it literally printed AppleOS and didn't run the program. Also no error other than the fact it's ignoring the last line of code.
Edited on 13 January 2014 - 12:43 AM
applesauce10189 #5
Posted 13 January 2014 - 01:45 AM
Okay, I put the quotation marks back and it's working perfectly………. Seriously what the heck I changed almost nothing what was even causing this? I only changed two things to make this error go away, using shell instead of os and using colors.purple instead of 1024……… Wow…
CometWolf #6
Posted 13 January 2014 - 02:36 AM
Os.run and shell.run is not the same thing, and neither will work with an undefined variable. Os.run however also requires an enviroment along with the string path.
Edited on 13 January 2014 - 01:36 AM
Kingdaro #7
Posted 13 January 2014 - 02:54 AM
Use shell.run() instead of os.run(). Never mind, missed that it was solved.
Edited on 13 January 2014 - 01:55 AM
Buho #8
Posted 13 January 2014 - 12:03 PM
I like the title: Impossibly Confused. Reminds me of the World's Most Interesting Man: He got confused once just to see what it was like.

Applesauce: a debugging tip: put error("X") or some other string after the first line. If the first line runs and you just get "X", then move it to under the 2nd line and repeat.

Alternatively, in your case, comment out all the lines except the first. Run. If all is fine, uncomment the second. Repeat.
CometWolf #9
Posted 13 January 2014 - 12:18 PM
A better idea in case of longer programs is check the functions of the api returning the error, which in this case is reffered to as "bios" and is thus any os. functions.
OReezy #10
Posted 13 January 2014 - 12:33 PM
Or having print() to check if it gets to a point is fine although sometimes slower.
quique18c #11
Posted 13 January 2014 - 12:57 PM
well try this :D/>!

at

term.setCursorPos(1,1)
it should be

term.setCursorPos(1, 1)
and change os.run to shell.run

it should be something like this


term.clear()
term.setCursorPos(1, 1)
term.setTextColor(1024)
print("AppleOS V1")
shell.run("turtledoor")
Lyqyd #12
Posted 13 January 2014 - 02:32 PM
This has already been solved. Argument spacing is a purely cosmetic choice and does not affect function.
applesauce10189 #13
Posted 13 January 2014 - 10:30 PM
I do still have a question though, what was causing the error? As mentioned above, I used shell instead of os and I used colors.purple instead of 1024, I want to know so I can avoid it in the future because I remember running into this problem once before and rage quitting.
Alice #14
Posted 13 January 2014 - 10:36 PM
I believe it's the use of shell.run over os.run.
Lyqyd #15
Posted 14 January 2014 - 12:56 AM
os.run requires an environment table as the first argument, which you were not providing.
CometWolf #16
Posted 14 January 2014 - 02:26 AM
Os.run and shell.run is not the same thing, and neither will work with an undefined variable. Os.run however also requires an enviroment along with the string path.
Im feeling pretty ignored right now…
applesauce10189 #17
Posted 14 January 2014 - 05:22 PM
Os.run and shell.run is not the same thing, and neither will work with an undefined variable. Os.run however also requires an enviroment along with the string path.
Im feeling pretty ignored right now…
Don't worry you didn't go ignored by me, just impossibly confused me.