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

BSOD? (Blue Screen Of Death)

Started by crasher925, 09 March 2016 - 07:40 PM
crasher925 #1
Posted 09 March 2016 - 08:40 PM
is there a way i could write a code so that a computer simulates a realistic BSOD? if so what would that code be?

i want it to look like this:
Edited on 10 March 2016 - 11:49 AM
Creator #2
Posted 09 March 2016 - 08:50 PM
Try running OmniOS one or two times :P/> .

Also, this code.
crasher925 #3
Posted 09 March 2016 - 09:24 PM
Try running OmniOS one or two times :P/>/> . Also, this code.

not quite what im looking for i want a windows style BSOD
Lyqyd #4
Posted 09 March 2016 - 10:19 PM
There was less than an hour between your (removed) bump post and your previous post. Be patient. You could start to consider bumping your topic after two or three weeks without a reply.
crasher925 #5
Posted 09 March 2016 - 10:23 PM
There was less than an hour between your (removed) bump post and your previous post. Be patient. You could start to consider bumping your topic after two or three weeks without a reply.

oh ok my bad
Sewbacca #6
Posted 09 March 2016 - 10:34 PM
Yes:


function os.bluscreen(errorMSG)
  <formatted error message>
  sleep(2)
  os.shutdown()
end

or:


local err = error
error = function(...)
  local _, errorMSG = pcall(err, ...)
  <formatted error message>
  sleep(2)
  os.shutdown()
end
Edited on 09 March 2016 - 09:36 PM
crasher925 #7
Posted 09 March 2016 - 10:42 PM
Yes:


function os.bluscreen(errorMSG)
  <formatted error message>
  sleep(2)
  os.shutdown()
end

or:


local err = error
error = function(...)
  local _, errorMSG = pcall(err, ...)
  <formatted error message>
  sleep(2)
  os.shutdown()
end

i ran the first code and it gives me

bios:14: [string "bsod"]:2: unexpected symbol

i dont know much lua so can i get the full code for a BSOD
Edited on 09 March 2016 - 09:43 PM
KingofGamesYami #8
Posted 09 March 2016 - 10:45 PM
I suspect you want this:

term.setBackgroundColor( colors.blue )
term.clear()
os.pullEvent( tostring({}) )
Edited on 09 March 2016 - 09:45 PM
H4X0RZ #9
Posted 09 March 2016 - 10:52 PM
Yes:


function os.bluscreen(errorMSG)
  <formatted error message>
  sleep(2)
  os.shutdown()
end

or:


local err = error
error = function(...)
  local _, errorMSG = pcall(err, ...)
  <formatted error message>
  sleep(2)
  os.shutdown()
end

i ran the first code and it gives me

bios:14: [string "bsod"]:2: unexpected symbol

i dont know much lua so can i get the full code for a BSOD

Wow. This level of " being-spoonfed-and-still-not-getting-it" hurts. <formatted error message> is NO code. You have to replace it with code.

Also, if you don't know much Lua there's no need for an BSOD.
Edited on 09 March 2016 - 09:53 PM
crasher925 #10
Posted 09 March 2016 - 10:57 PM
I suspect you want this:
 term.setBackgroundColor( colors.blue ) term.clear() os.pullEvent( tostring({}) ) 

ok i ran it and nothing happened

added text still nothing

Yes:


function os.bluscreen(errorMSG)
  <formatted error message>
  sleep(2)
  os.shutdown()
end

or:


local err = error
error = function(...)
  local _, errorMSG = pcall(err, ...)
  <formatted error message>
  sleep(2)
  os.shutdown()
end

i ran the first code and it gives me

bios:14: [string "bsod"]:2: unexpected symbol

i dont know much lua so can i get the full code for a BSOD

Wow. This level of " being-spoonfed-and-still-not-getting-it" hurts. <formatted error message> is NO code. You have to replace it with code.

Also, if you don't know much Lua there's no need for an BSOD.

its something i want to do is that so bad?
Edited on 09 March 2016 - 10:02 PM
Creator #11
Posted 09 March 2016 - 10:58 PM
Congratulations on your 1000th post.

Also, code I gave you works very well. Just modify the text.
crasher925 #12
Posted 09 March 2016 - 11:07 PM
Congratulations on your 1000th post. Also, code I gave you works very well. Just modify the text.

indeed it does but theres one problem the command line at the top ruins it also can you give me an idea on how i can make it look like a BSOD from windows
Creator #13
Posted 09 March 2016 - 11:08 PM
Just change the text. Make a nice term.clear too.
crasher925 #14
Posted 09 March 2016 - 11:14 PM
Just change the text. Make a nice term.clear too.
done but i still have that line at the top what do i do?
crasher925 #15
Posted 10 March 2016 - 12:24 PM
ok its been 12 hours can please i get some help here?
Edited on 10 March 2016 - 11:39 AM
Lupus590 #16
Posted 10 March 2016 - 01:30 PM
do you have any Lua knowledge?

we generally prefer to teach people how to write their own programs over writing programs on demand.
crasher925 #17
Posted 10 March 2016 - 01:32 PM
do you have any Lua knowledge?

we generally prefer to teach people how to write their own programs over writing programs on demand.

yes but very little
Lyqyd #18
Posted 10 March 2016 - 03:33 PM
ok its been 12 hours can please i get some help here?
Be patient. You could start to consider bumping your topic after two or three weeks without a reply.

Consider this your first official warning.
KingofGamesYami #19
Posted 10 March 2016 - 03:52 PM
I can manually emulate the exact thing, word-for-word. Other than that, I'm not exactly sure what you want - all of that information is irrelevant to computercraft and debugging.

Spoiler
term.setBackgroundColor( colors.blue )
term.setTextColor( colors.white )
print( [[A problem has been detected and Windows has been shut down to prevent damage to your computer.

The problem seems to be caused by the following file: kbdhid.sys

MANUALLY_INITIATED_CRASH

If this is the first time you've seen this stop error screen, restart your computer.  If this screen appears again, follow these steps:

Check to make sure any new hardware software is properly installed.  If this is a new installation, ask your hardware or software manufacturer for any Windows updates you might need.

If problems continue, disable or remove any newly installed hardware or software.  Disable BIOS memory options such as caching or shadowing.  If you need to use safe mode to remove or disable components, restart your computer, press F8 to select Advanced Startup Options, and then select Safe Mode.

Technical Information:

*** STOP: 0x000000e2 (0x00000000, 0x00000000, 0x00000000, 0x00000000)

*** kbdhid.sys - Address 0x94efd1aa base at 0x94efb000 DateStamp 0x4a5bc705]] )
os.pullEvent( "key" )
os.shutdown()
Sewbacca #20
Posted 10 March 2016 - 03:58 PM
I can manually emulate the exact thing, word-for-word. Other than that, I'm not exactly sure what you want - all of that information is irrelevant to computercraft and debugging.

Spoiler
term.setBackgroundColor( colors.blue )
term.setTextColor( colors.white )
print( [[A problem has been detected and Windows has been shut down to prevent damage to your computer.

The problem seems to be caused by the following file: kbdhid.sys

MANUALLY_INITIATED_CRASH

If this is the first time you've seen this stop error screen, restart your computer.  If this screen appears again, follow these steps:

Check to make sure any new hardware software is properly installed.  If this is a new installation, ask your hardware or software manufacturer for any Windows updates you might need.

If problems continue, disable or remove any newly installed hardware or software.  Disable BIOS memory options such as caching or shadowing.  If you need to use safe mode to remove or disable components, restart your computer, press F8 to select Advanced Startup Options, and then select Safe Mode.

Technical Information:

*** STOP: 0x000000e2 (0x00000000, 0x00000000, 0x00000000, 0x00000000)

*** kbdhid.sys - Address 0x94efd1aa base at 0x94efb000 DateStamp 0x4a5bc705]] )
os.pullEvent( "key" )
os.shutdown()

you can put it into the function:


local err = error
error = function(...)
  local _, errorMSG = pcall(err, ...)
  os.pullEventRaw = os.pullEvent
  <formatted error message>
  sleep(2)
  os.shutdown()
end

So ever a error occures you get a Bluescreen
Edited on 10 March 2016 - 03:03 PM
crasher925 #21
Posted 10 March 2016 - 07:51 PM
ah thank you and sorry admins i thought i could bump after atleast a day
crasher925 #22
Posted 10 March 2016 - 11:50 PM
I can manually emulate the exact thing, word-for-word. Other than that, I'm not exactly sure what you want - all of that information is irrelevant to computercraft and debugging.
Spoiler
term.setBackgroundColor( colors.blue ) term.setTextColor( colors.white ) print( [[A problem has been detected and Windows has been shut down to prevent damage to your computer. The problem seems to be caused by the following file: kbdhid.sys MANUALLY_INITIATED_CRASH If this is the first time you've seen this stop error screen, restart your computer. If this screen appears again, follow these steps: Check to make sure any new hardware software is properly installed. If this is a new installation, ask your hardware or software manufacturer for any Windows updates you might need. If problems continue, disable or remove any newly installed hardware or software. Disable BIOS memory options such as caching or shadowing. If you need to use safe mode to remove or disable components, restart your computer, press F8 to select Advanced Startup Options, and then select Safe Mode. Technical Information: *** STOP: 0x000000e2 (0x00000000, 0x00000000, 0x00000000, 0x00000000) *** kbdhid.sys - Address 0x94efd1aa base at 0x94efb000 DateStamp 0x4a5bc705]] ) os.pullEvent( "key" ) os.shutdown()
you can put it into the function:
 local err = error error = function(...) local _, errorMSG = pcall(err, ...) os.pullEventRaw = os.pullEvent  sleep(2) os.shutdown() end 
So ever a error occures you get a Bluescreen

what do i put in the spot where the … are?
KingofGamesYami #23
Posted 10 March 2016 - 11:58 PM
You'd put it in the spot where the non-Lua code is (<formatted …)

… is actually a thing in Lua, since functions can take any number of arguments (regardless of how many are required).
crasher925 #24
Posted 11 March 2016 - 12:58 AM
You'd put it in the spot where the non-Lua code is (<formatted …)

… is actually a thing in Lua, since functions can take any number of arguments (regardless of how many are required).


it works! the question is how do you make the thext fit on the screen
Edited on 10 March 2016 - 11:59 PM
hbomb79 #25
Posted 11 March 2016 - 05:28 AM
You won't be able to get a full Windows 'Blue Screen of Death' to fit on the screen without using some sort of scrolling.

Either:
- Shorten the content so that it is actually relevant information (get rid of all the windows debug stuff that means nothing in CC)
- Look into text scrolling

Text scrolling
Off the top of my head there are a couple of ways of doing this. The easiest is to have each line (max length 51 for normal ComputerCraft computers) as an item in a Lua table:

Spoiler

local terminalWidth, terminalHeight = term.getSize() --# get the width and height of our computer terminal (ComputerCraft)
local lines = {"line 1", "line 2", "line 3", "line 4", "line 5", "line 6", "line 7", "line 8", "line 9", "line 10", "line 11", "line 12", "line 13", "line 14", "line 15", "line 16", "line 17", "line 18", "line 19", "line 20", "line 21", "line 22", "line 23"} --# these are our lines.

--# Print all the lines the screen can fit using print.
for i = 1, terminalHeight - 1 do --# that -1 is there because the 'print' function creates a new line under it at each call. Therefore our capacity is termHeight - 1 for this example
  print( lines[ i ] ) --# print the line number 'i'. 'i' increases by 1 every iteration (loop)
end

--# The amount of lines we are trying to display is greater than our line capacity.
if #lines > terminalHeight then
  local currentLine = terminalHeight - 1 --# Set the current line to our last displayed. This tells the program what line was just printed and therefore which to print next.

  --# Do everything in this loop until all lines are printed.
  while currentLine < #lines do
    os.pullEvent("key") --# wait for the user to press a key
    currentLine = currentLine + 1 --# advance the line by one now
    print( lines[ currentLine ] ) --# print this line.
  end
end

Remember that the line can only be 51 characters long, if its longer it will wrap and might get crazy.
Edited on 11 March 2016 - 04:31 AM
MrObsidy #26
Posted 26 August 2016 - 06:34 AM
You could just use a monitorm trolled my friend like this. (Maybe I will put that code to pastebin)