os.pullEvent = os.pullEventRaw
term.setTextColor(colors.white)
term.clear()
local StFile = nil
local filePath = "system32/kernel/bos/startup"
local fileHandle = fs.open(filePath, 'r')
StFile = textutils.unserialize (fileHandle.readLine(1))
fileHandle.close()
function PKey() --Bootmenu Key
while true do
local event, key = os.pullEventRaw("key")
if key == keys.f12 then
shell.run("system32/kernel/bos/bios")
break
end
end
end
function PInfo() --Prints the Text
-------------
--Erste Zeile
-------------
term.setCursorPos(1,1)
print("_")
sleep(0.1)
term.setCursorPos(1,1)
print(" ")
sleep(0.1)
term.setCursorPos(1,1)
print("_")
sleep(0.1)
term.setCursorPos(1,1)
print(" ")
sleep(0.1)
term.setCursorPos(1,1)
print("_")
sleep(0.1)
term.setCursorPos(1,1)
textutils.slowPrint("CCW-Bios v1.0 press F12 to enter Bootmenu")
sleep(0.1)
term.setCursorPos(42,1)
print("_")
sleep(0.1)
term.setCursorPos(42,1)
print(" ")
sleep(0.1)
term.setCursorPos(42,1)
print("_")
sleep(0.1)
term.setCursorPos(42,1)
print(" ")
sleep(0.1)
term.setCursorPos(42,1)
print("_")
sleep(0.1)
term.setCursorPos(42,1)
print(" ")
--------------
--Zweite Zeile
--------------
term.setCursorPos(1,2)
print("_")
sleep(0.1)
term.setCursorPos(1,2)
print(" ")
sleep(0.1)
term.setCursorPos(1,2)
print("_")
sleep(0.1)
term.setCursorPos(1,2)
print(" ")
sleep(0.1)
term.setCursorPos(1,2)
print("_")
sleep(0.1)
term.setCursorPos(1,2)
textutils.slowPrint("© by Killah1312 2012-2016")
sleep(0.1)
term.setCursorPos(26,2)
print("_")
sleep(0.1)
term.setCursorPos(26,2)
print(" ")
sleep(0.1)
term.setCursorPos(26,2)
print("_")
sleep(0.1)
term.setCursorPos(26,2)
print(" ")
sleep(0.1)
term.setCursorPos(26,2)
print("_")
sleep(0.1)
term.setCursorPos(26,2)
print(" ")
--------------
--Dritte Zeile
--------------
term.setCursorPos(1,4)
print("_")
sleep(0.1)
term.setCursorPos(1,4)
print(" ")
sleep(0.1)
term.setCursorPos(1,4)
print("_")
sleep(0.1)
term.setCursorPos(1,4)
print(" ")
sleep(0.1)
term.setCursorPos(1,4)
print("_")
sleep(0.1)
term.setCursorPos(1,4)
textutils.slowPrint("MC Dual-Core CPU X7223 @1.5GHz")
sleep(0.1)
term.setCursorPos(31,4)
print("_")
sleep(0.1)
term.setCursorPos(31,4)
print(" ")
sleep(0.1)
term.setCursorPos(31,4)
print("_")
sleep(0.1)
term.setCursorPos(31,4)
print(" ")
sleep(0.1)
term.setCursorPos(31,4)
print("_")
sleep(0.1)
term.setCursorPos(31,4)
print(" ")
--------------
--Vierte Zeile
--------------
term.setCursorPos(1,5)
print("_")
sleep(0.1)
term.setCursorPos(1,5)
print(" ")
sleep(0.1)
term.setCursorPos(1,5)
print("_")
sleep(0.1)
term.setCursorPos(1,5)
print(" ")
sleep(0.1)
term.setCursorPos(1,5)
print("_")
sleep(0.1)
term.setCursorPos(1,5)
textutils.slowPrint("DDR3 1600MHz VRAM94866 4096MB")
sleep(0.1)
term.setCursorPos(30,5)
print("_")
sleep(0.1)
term.setCursorPos(30,5)
print(" ")
sleep(0.1)
term.setCursorPos(30,5)
print("_")
sleep(0.1)
term.setCursorPos(30,5)
print(" ")
sleep(0.1)
term.setCursorPos(30,5)
print("_")
sleep(0.1)
term.setCursorPos(30,5)
print(" ")
--------------
--Fünfte Zeile
--------------
term.setCursorPos(1,6)
print("_")
sleep(0.1)
term.setCursorPos(1,6)
print(" ")
sleep(0.1)
term.setCursorPos(1,6)
print("_")
sleep(0.1)
term.setCursorPos(1,6)
print(" ")
sleep(0.1)
term.setCursorPos(1,6)
print("_")
sleep(0.1)
term.setCursorPos(1,6)
textutils.slowPrint("SH37941005 Sata600 HDD Detected")
sleep(0.1)
term.setCursorPos(32,6)
print("_")
sleep(0.1)
term.setCursorPos(32,6)
print(" ")
sleep(0.1)
term.setCursorPos(32,6)
print("_")
sleep(0.1)
term.setCursorPos(32,6)
print(" ")
sleep(0.1)
term.setCursorPos(32,6)
print("_")
sleep(0.1)
term.setCursorPos(32,6)
print(" ")
---------------
--Sechste Zeile
---------------
term.setCursorPos(1,8)
print("_")
sleep(0.1)
term.setCursorPos(1,8)
print(" ")
sleep(0.1)
term.setCursorPos(1,8)
print("_")
sleep(0.1)
term.setCursorPos(1,8)
print(" ")
sleep(0.1)
term.setCursorPos(1,8)
print("_")
sleep(0.1)
term.setCursorPos(1,8)
textutils.slowPrint("Loading PXE-Networkboot Agent...")
sleep(0.1)
term.setCursorPos(33,8)
print("_")
sleep(0.1)
term.setCursorPos(33,8)
print(" ")
sleep(0.1)
term.setCursorPos(33,8)
print("_")
sleep(0.1)
term.setCursorPos(33,8)
print(" ")
sleep(0.1)
term.setCursorPos(33,8)
print("_")
sleep(0.1)
term.setCursorPos(33,8)
print(" ")
sleep(1)
--------------
--Siebte Zeile
--------------
term.setCursorPos(1,9)
print("_")
sleep(0.1)
term.setCursorPos(1,9)
print(" ")
sleep(0.1)
term.setCursorPos(1,9)
print("_")
sleep(0.1)
term.setCursorPos(1,9)
print(" ")
sleep(0.1)
term.setCursorPos(1,9)
print("_")
sleep(0.1)
term.setCursorPos(1,9)
textutils.slowPrint("Exeting PXE-Networkboot Agent...")
sleep(0.1)
term.setCursorPos(33,9)
print("_")
sleep(0.1)
term.setCursorPos(33,9)
print(" ")
sleep(0.1)
term.setCursorPos(33,9)
print("_")
sleep(0.1)
term.setCursorPos(33,9)
print(" ")
sleep(0.1)
term.setCursorPos(33,9)
print("_")
sleep(0.1)
term.setCursorPos(33,9)
print(" ")
sleep(1)
end
parallel.waitForAny(PKey, PInfo)
if fs.exists(StFile) then
term.clear()
shell.run(StFile)
else
term.setCursorPos(1,11)
print("_")
sleep(0.1)
term.setCursorPos(1,11)
print(" ")
sleep(0.1)
term.setCursorPos(1,11)
print("_")
sleep(0.1)
term.setCursorPos(1,11)
print(" ")
sleep(0.1)
term.setCursorPos(1,11)
print("_")
sleep(0.1)
term.setCursorPos(1,11)
textutils.slowPrint("No Bootable System found! Enter Bootmenu to set it!")
PKey()
end
Can someone help me?
ComputerCraft Error dont know whats wrong
Started by Killah1312, Jan 17 2016 04:54 PM
5 replies to this topic
#1
Posted 17 January 2016 - 04:54 PM
I have a Problem at Time i write a Bios for computercraft and i dont know where the problem is i get the error "startup:295: Expected String"
#2
Posted 17 January 2016 - 06:27 PM
I don't see any problem on line 295, any chance you have accidentally fixed it in copying your code into your post?
Also, fake loading screens are despised on the forums.
Also, fake loading screens are despised on the forums.
Edited by Lupus590, 17 January 2016 - 06:28 PM.
#4
Posted 17 January 2016 - 07:20 PM
Lines 4-9
Lines 290-292
Edit: I also agree with the above, don't really like fake loading screens. Most games that do have loading screens (I'm meaning like flash games or whatevs) only really use the loading screens as a way to show the user that while it's taking time, it's still progressing. It's doing other stuff than just printing to the screen that it's progressing.
local StFile = nil local filePath = "system32/kernel/bos/startup" local fileHandle = fs.open(filePath, 'r') StFile = textutils.unserialize (fileHandle.readLine(1)) --#My comment here, StFile is now a TABLE. --#Also, readLine reads only the next line, it doesn't take a line number fileHandle.close()
Lines 290-292
if fs.exists(StFile) then term.clear() shell.run(StFile)Do you see your problem? You cannot use fs.exists on a table (Or nil, as I suspect it's turning into). It's expecting a string. Don't unserialize an apparent file name.
Edit: I also agree with the above, don't really like fake loading screens. Most games that do have loading screens (I'm meaning like flash games or whatevs) only really use the loading screens as a way to show the user that while it's taking time, it's still progressing. It's doing other stuff than just printing to the screen that it's progressing.
Edited by Dragon53535, 17 January 2016 - 07:48 PM.
#5
Posted 17 January 2016 - 09:53 PM
TheOddByte, on 17 January 2016 - 07:13 PM, said:
Not only that, but the code here code greatly be shortened by using for loops
For example, this sort of thing:
Spoiler
... can be reduced to:
Spoiler
http://lua-users.org...ructureTutorial
#6
Posted 19 January 2016 - 12:01 AM
And you could even shorten the second block by using the modulo operator and ternary operators.
http://lua-users.org...TernaryOperator
for i = 1, 6 do term.setCursorPos(33,9) print( i % 2 == 0 and " " or "_" ) sleep(0.1) endThe only difference with this is that you may want to increase the amount of times to loop.
http://lua-users.org...TernaryOperator
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











