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

How do you make an OS?

Started by Thefdjurt, 25 May 2013 - 06:56 PM
Thefdjurt #1
Posted 25 May 2013 - 08:56 PM
I know that this can't be explained, easily, without actually coding it.
But if you(the reader of this post) could help me with:

-Setting an boot background.
-Rednet(receiving the message from another computer)
-Also, clickable buttons.

Staff if there are post telling how to do this stuff(in basically layman terms, could you pm the links to those topics and delete this topic.Sorry if this is an annoying waste of your(reader who may or may not be a staff member).

P.S This is intended to be both a chat system alongside a banking program.
Molinko #2
Posted 25 May 2013 - 09:07 PM
Recieving rednet messages can change depending on your version of CC however if you're playing on a version above 1.5 then you'll be using the new modem peripheral api.. Here's an example of how to send and recieve a message..


– first off here is the modem api http://computercraft...iki/Modem_(API)

–Sending messages

local modem = peripheral.wrap("right") --Wraps the modem on the right side.
modem.transmit(3, 1, "Hello world!")

–Recieving messages

local modem = peripheral.wrap("left")
modem.open(3)--Open channel 3 so that we can listen on it
local event, modemSide, senderChannel,
   replyChannel, message, senderDistance = os.pullEvent("modem_message")
print("I just received a message from: "..senderChannel)
print("I should apparently reply on: "..replyChannel)
print("The modem receiving this is located on the "..modemSide.." side")
print("The message was: "..message)
print("The sender is: "..senderDistance.." blocks away from me.")
This example code was taken from the computercraft wiki..

If you search 'buttons' in the tutorial boards you will find some examples in other peoples programs of how you implement touch buttons. If the tutorials are still a bit above you head the you should brush up on some more of the basics and your familiarity with lua.

As for the topic of your thread… making an OS, unless you can actually add meaningful and/or useful programs to it aswell or verrrry soon after publishing, it will go unappreciated..(your os i mean)

–good luck
–have fun
Engineer #3
Posted 25 May 2013 - 09:10 PM
Well, an OS actually means 'Operating System'. In those forums, we mostly talk about graphical shells, wich only changes the appearance and has programs and/or games. When you are making a Operating System, you change how things work. With that I mean, you for example give more built-in API's, functionality for multi-threading and ideas I cant come up at the moment what a OS changes.

So Im pretty sure you want to make a Graphical shell. Im not going to give you a full explanation, but Im going to give you some functions wich helpes with your targets (I mean by that, those 3 things you have listed. I really cant find a proper word for it :/)

1: To launch something when you right click your computer (aka opening the pc for the first time), you have to make a file called: startup. Everything what this file contains get launched, and that is your own code. For a background you can use: term.setBackground( colours.colourName ). Click this sentence for more information on colours.

2: Alreadyy answered, see above

3: I have made a tutorial for this: click for the tutorial!

I hope I have been a good help! :)/>/>
theoriginalbit #4
Posted 25 May 2013 - 09:22 PM
Based off your questions, I'm going to assume you're fairly new to ComputerCraft, and haven't made many programs, as such I'm going to strongly advise you against making an OS but instead making something a lot simpler first as OSes are a very difficult thing to create. And as Engineer stated, most of what people make are just graphical shells and can never really be called an OS. At the moment there are lots of graphical shells that are sub-par, released way too early, and never unique.

So before you consider making something like an OS you need to read through the following resourcesThen before starting to make on OS take into consideration these few things + some suggestions
  1. Do you know Lua and CCLua well enough to make most of this OS without needing help (i.e. video tutorials, or reading other "OSes" code)
  2. Are you able to make the OS unique, and something never seen before on these forums, we don't just want a vomit of the same code
  3. Never release an OS in Alpha stages, only release it in beta stages if you must… the best way to have a popular OS is to not release too early when it does nothing, have lots of programs and features (I'd say about 10-20 features and at least 5 programs)
  4. Test your program before releasing! I will say that again, test your program before releasing! Nothing makes people not like your programs more than not testing them before releasing and them being riddled by bugs.
If you cannot complete any of the required readings, have the appropriate understanding of Lua, and do not meet the above points, I suggest that you do not make an OS, but instead something simpler…
Xenthera #5
Posted 25 May 2013 - 09:37 PM
It's a very long, and (if you have limited knowledge of cclua) mind-racking process. I'd suggest starting with something simpler like make a very basic gui.

Like this




I was just like you once where I wanted to make an OS, but had no idea where to start. What I did instead was learn simpler things and made sure I knew exactly what everything did.
Then eventually I ended up with something that resembles an OS. The good thing though is I can manipulate everything to do what I want, since I understand the code. I suggest you do the same.

These are just tips to how I would do things, it helps in the long run, trust me.
bjornir90 #6
Posted 26 May 2013 - 02:34 AM
Well if you want for the buttons and gui, you can use my API (in my signature) :)/> If you want I may help you with gui :)/>
SuicidalSTDz #7
Posted 26 May 2013 - 07:33 PM
Well if you want for the buttons and gui, you can use my API (in my signature)
It wouldn't be his 'OS' then, now would it. An 'OS', in my mind, should only contain code from the developer (Excluding games, programs, software, etc). If one cannot make a simple button themselves, they should stray away from an 'OS' entirely (that is assuming it is a graphical interface and not command-line).

Like TheOriginalBIT stated, don't start off with an 'OS'. They are far too complex for beginners and are often left in the shadows due to poor knowledge. Some people can pull it off though.

LyqydOS is a very nice example of a good OS. And no, this is not the only good OS out there, I purely chose it over the others since it is a bold example.

Poor example of an OS:

os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
print("PoorOS 0.1")
while true do
cmd = read()
if cmd == "edit" then
  file = read()
  shell.run("edit", file)
elseif cmd == "run" then
  file = read()
  shell.run(file)
end
end
This is not even a graphical shell at best. This is a program, and some people need to see that through.

EDIT: This is a much better example of what an OS is not.
Thefdjurt #8
Posted 26 May 2013 - 07:52 PM
It wouldn't be his 'OS' then, now would it. An 'OS', in my mind, should only contain code from the developer (Excluding games, programs, software, etc). If one cannot make a simple button themselves, they should stray away from an 'OS' entirely (that is assuming it is a graphical interface and not command-line).

Like TheOriginalBIT stated, don't start off with an 'OS'. They are far too complex for beginners and are often left in the shadows due to poor knowledge. Some people can pull it off though.

LyqydOS is a very nice example of a good OS. And no, this is not the only good OS out there, I purely chose it over the others since it is a bold example.

Poor example of an OS:

os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
print("PoorOS 0.1")
while true do
cmd = read()
if cmd == "edit" then
  file = read()
  shell.run("edit", file)
elseif cmd == "run" then
  file = read()
  shell.run(file)
end
end
This is not even a graphical shell at best. This is a program, and some people need to see that through.

EDIT: This is a much better example of what an OS is not.

Thanks, I learn the code once I read it at least 2 times, and now that of Engineer's button tutorial I understand the click-able button.
Also I am working on a graphical shell now(Bomber&Co.) link in my signature.
nutcase84 #9
Posted 27 May 2013 - 03:07 PM
or example of an OS:

os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
print("PoorOS 0.1")
while true do
cmd = read()
if cmd == "edit" then
  file = read()
  shell.run("edit", file)
elseif cmd == "run" then
  file = read()
  shell.run(file)
end
end
This is not even a graphical shell at best. This is a program, and some people need to see that through.

EDIT: This is a much better example of what an OS is not.

There's better examples than that.

*Cough*
H4X0RZ #10
Posted 27 May 2013 - 04:54 PM
There's better examples than that.

*Cough*

[Sarkasm] That's the best OS ever !! I love it! *-* [/Sarkasm]