×
Create a new article
Write your page title here:
We currently have 277 articles on Waste Of Space Wiki. Type your article name above or create one of the articles listed here!



    Waste Of Space Wiki

    Programming: Difference between revisions

    Content deleted Content added
    is not are bro
    m Made article discoverable by search engines, added an fyi editorial comment
    Line 6: Line 6:
    *[[Screen]] - A programmable object that can display user interface objects such as TextLabel, ImageLabel, etc.
    *[[Screen]] - A programmable object that can display user interface objects such as TextLabel, ImageLabel, etc.
    *[[Disk]] - Stores values in a directory-like format.
    *[[Disk]] - Stores values in a directory-like format.
    *[[EthernetCable]] (Optional) - Allows to connect to Objects from [[Port|Ports]], this object is highly recommended. <!-- FYI This is a thing people often get wrong when referring to networking equipment. Ethernet is actually just the protocol which most networks today use for transferring data. The actual cable is often, but not necessarily, some of the cat(n) cables (CAT6 being the most popular one as of 24 Jun 2023). The male end of the connector is, with cat6, the 8p8c modular plug. Note that other CAT(n) cables often use different plugs. As for the "Port", in the case of an 8p8c plug it is most often the RJ45 (Registered jack 45). -->
    *[[EthernetCable]] (Optional) - Allows to connect to Objects from [[Port|Ports]], this object is highly recommended.



    The code below is code for a smart turret that takes chat commands and targets players accordingly, with the command "target playername"<syntaxhighlight lang="lua" line="1">
    The code below is code for a smart turret that takes chat commands and targets players accordingly, with the command "target playername"<syntaxhighlight lang="lua" line="1">
    Line 57: Line 58:
    [[Category:Tutorials]]
    [[Category:Tutorials]]
    [[Category:Mechanics]]
    [[Category:Mechanics]]
    __INDEX__

    Revision as of 10:11, 24 June 2023

    Diagram for how to construct a basic computer including a MicroController.

    The game features an in-depth programming language that allows you to write and execute software that can manage and manipulate the state of other objects in-game. The name of this programming language is called Pilot.lua, which is a reference to rbx.lua.

    The main parts of programming are

    • Microcontroller - An object that stores and runs code when triggered by polysilicon and powered.
    • Port - Allows the microcontroller to interact with other objects, trigger and configure, etc.
    • Screen - A programmable object that can display user interface objects such as TextLabel, ImageLabel, etc.
    • Disk - Stores values in a directory-like format.
    • EthernetCable (Optional) - Allows to connect to Objects from Ports, this object is highly recommended.


    The code below is code for a smart turret that takes chat commands and targets players accordingly, with the command "target playername"

    local Gyro = GetPartFromPort(1, "Gyro") -- Gets gyro attached to port 1
    local Microphone = GetPartFromPort(2, "Microphone") -- Gets microphone attached to port 2
    local Commanders = { -- List of usernames allowed to use the smart turret
      ["Robuyasu"] = true;
    }
    -- Connects to the microphone, adding an event to it that will listen for chat input
    Microphone:Connect("Chatted", function(Player, Message) 
    
      -- This simply makes sure that the player speaking is allowed to run a command
      if not Commanders[Player] then return end
    
      if Message:lower():sub(0, 6) == "target" then -- If the message starts with target
        local Victim = Message:sub(8) -- Gets the rest of the message
        Gyro:Configure({Seek=Victim}) -- Configures the seeker to target that person
      end
    end)
    

    There are many functions in Pilot.lua that allow you to interact with other objects. These are the following default functions listed.

    • GetPort(ID) - Returns a port instance that can be used in other functions.
    • GetPartFromPort(ID or Port Instance, ClassName) Returns a part if found directly attached to a port. An example would be GetPartFromPort(2, "Screen")
    • TriggerPort(ID or Port Instance)
    • GetPartsFromPort(ID or Port Instance, ClassName) Returns multiple parts if found directly attached to a port. Must have "for i = number, number" command in Microcontroller to function.

    All objects will contain certain programmable properties and functions. However, all instances will contain the following properties:

    • Configurable properties, for example an ionrocket's thrust speed property
    • ClassName, which is simply the name of the object
    • Object:Trigger(), which simply triggers the object
    • Object:Configure({Property=NewValue}), which configures the part to the given dictionary/table
    • Object:Connect, which is similar to roblox connections (part.Touched:Connect). An example includes TouchTrigger:Connect("Touched", function() end)

    Certain parts however will have their own special properties.

    • Screen
      • Screen:CreateElement(GUIClassName, Properties), an example includes Screen:CreateElement("TextLabel", {Text = "Hello World!"; TextScaled = true});
      • Screen:ClearElements(), which clears all elements in a gui

    Resources

    • There is currently one player-made wiki, murpyh's
    • Some information on parts can be found at mawesome's part list site, though some information is inaccurate or not displayed there

    Programming Examples

    A flappy bird arcade machine, made by iiMurpyh
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.

    Recent changes

  • Jo857294 • 8 days ago
  • 116.111.185.163 • 21 days ago
  • 116.111.185.163 • 21 days ago
  • 116.111.185.163 • 21 days ago
  • Cookies help us deliver our services. By using our services, you agree to our use of cookies.