/plasma-computer

Computer Core and OS in Plasma Sandbox

Primary LanguageLuaMIT LicenseMIT

Plasma Computer

Computer and OS in Plasma

  • Plasma Computer is a computer that can run an OS and interact with the world.
  • Plasma OS is integrated by default but if you want to update the computer with a new version of Plasma OS or your custom OS you will have to use the devices below
  • For a custom OS you can use Plasma OS as a base and read the code to understand how it works.

Note: If you detect any bugs, please report them.


Devices

Computer

Desktop: STEAM ID: 2962708844
Laptop: STEAM ID: 2963356432
Holo: STEAM ID: 2963363681
Core: STEAM ID: 2964560347
The computer is the main device, it is used to run programs and interact with the world, there is two version: laptop and desktop.

how to use :

  1. Turn On.
  2. Enyoy the result.

Disks

Disks are used to store programs and data. They are used by the Wireless Disk Reader to load OS, software and data.

how to use :

  1. Create a "NFC TAG" and put data if you want.
  2. Put --FILE!disk§! on top of the file to make it a file disk.

Wireless Disk Reader

STEAM ID: 2962710912
The Wireless Disk Reader is used to read and write data on disks.

how to use :

  1. Place a Disk on it.
  2. To load an OS, press the button on it.

Plasma OS

STEAM ID: 2960539673
The Plasma OS is the operating system of the Plasma computer.

how to use :

  1. Type "help" on the terminal to get the list of commands.

Code

  1. Devices code is in the "Devices" folder.
  2. Plasma OS code is in the "OS" folder.
  3. OS example is in the "OS" folder.
  4. Software example is in the "Software" folder.

Computer API

Note: don't send image in the Main Transceiver channel 2, this will reduces FPS

Inputs :

Keyboard :
Use "V1" to get the key pressed. Split the string with the !§! separator to get the key pressed.
[1] = Key pressed or type, [2] = Key char or nil.

"V1" type: String

function keyboardEvent()
    -- Called when a key is pressed
    print(V1)
end

Network : Use "V2" to get data from network.

"V2" type: String

function networkEvent()
    -- Called when data arrives from the network
    print(V2) -- Error if V2 not a string
end

Disk : Use "V3" to get data from the disk.

"V3" type: Any

function readDiskEvent()
    -- Called when data from the disk is readed
    print(V3) -- Error if V3 not a string
end

To request the read of the disk use :

output(nil, 3)

Memory :

To read the internal memory use :

read_var("memory")

OS :

To read the current OS :

read_var("os")

Outputs:

Display :
To display text on the screen.

Data type : String

Data examples :

  • "Hello world"
  • "Hello world!§!Line 2", Lines are separated by the !§! separator
  • "0,0,0!display§!Hello world!§!Line 2" , The first part is the background color with r,g,b, the second part is the text. Two are separated by the !display§! separator.
output(data, 1)

Network :
To send data to the network.

Data: Any

output(data, 2)

Disk :
To write data to the disk.

Data: Any

output(data, 4)

Memory :
To write data to the internal memory.

Data: String

write_var(data, "memory")

OS :
To update the current OS and reboot the computer.

output(nil, 5)

Display override :

To enable the display override.

Data: Boolean

write_var(data, "override")

To display an image on the screen send a signal on the Main Transceiver channel 3 with the image or another data.

Keyboard Indicator Color :
To set the color of the keyboard indicator.

Data: Color

Data examples :

  • color(0,0,0)
  • color (255, 0, 0)
output(data, 6) -- To set the color of the keyboard indicator

Display Override :
To override the display.
Make sure you dont output on the Display output 1.

Data: any

output(data, 7)

Plasma OS Software API

To create a software for the Plasma OS.
Use the "Software" folder as a base and replace all the values with your own.
To load the software put the data in a disk, put on the Wireless Disk Reader and execute "software install" on the terminal.

put this on the top of the software code to make it work and replace the values with your own:

--FILE!disk§!
--!soft§!
--SOFTWARE_NAME!soft_data§!

DATA

Put this in your software code to add information about it and replace the values with your own:

SOFTWARES["SOFTWARE_NAME"] = {
  ["version"] = "1.0.0",
  ["author"] = "shazogg",
  ["description"] = "DESCRIPTION",
  ["events"] = {
    {
      ["event"] = "KEYBOARD_INPUT",
      ["function"] = example1
    },
    {
      ["event"] = "NETWORK_INPUT",
      ["function"] = example2
    },
  },
  ["commands"] = {
    {
      ["command"] = "example1",
      ["function"] = example1
    },
    {
      ["command"] = "example2",
      ["function"] = example2
    },
  }
}

EVENTS

Events are used to make the software interact with Plasma OS.
You can add events to your software by adding events in the "events" table in the data above.

EVENTS LIST :

  • "KEYBOARD_INPUT": On Keyboard input
  • "NETWORK_INPUT": On Network input
  • "DISK_INPUT": On Disk input
  • "SETUP": On Setup
  • "LOOP": On Loop

HELP PAGES

to add pages to the help command, add this to the software code and replace the values with your own:

SOFTWARES_HELP_PAGES["SOFTWARE_NAME"] = {
  {
    "example software, page 1",
    "- example2: to test this too, page 1"
  },
  {
    "example software, page 2",
    "- example2: to test this too"
  }
}

COMMANDS

Commands are used to make the user interact with the software.
You can add commands to your software by adding commands in the "commands" table in the data above.

INTERNAL FUNCTIONS

You can access all the variables and functions inside Plasma OS, to use outputs read the "Computer API" section above.