×
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
    Removed superlative things
    Tags: Mobile edit Mobile web edit
    More context about rbx.lua, i added i so people know that rbx.lua is a nickname for Luau
     
    (9 intermediate revisions by 5 users not shown)
    Line 1:
    [[File:ComputerDiagram.png|alt=|thumb|300x300px|Diagram for how to construct a basic computer including a MicroController.]]TheWaste gameof Space features an in-deptha programming language thatnamed allows'''Pilot.lua'''. you to write and execute software that canPilot.lua managelets andplayers manipulate the statestates of other objects in-game. TheAs name of this programming language is called '''Pilot.lua''', which is a referencesuperset toof rbx.lua[https://luau-lang.org/ ItLuau] is recommendedRoblox' tosuperset learnof rbx[https://en.luawikipedia.org/wiki/Lua_(programming_language) beforeLua] you learn pilot.lua5.1 Coding''–'' inlearning thisLuau game(or isat superleast helpful,Lua as it allows for much more possibilities and5.1) stufffirst youwould canbe dobeneficial.
    The main parts of programming are:
     
    Documentation for all the parts can be found here [https://github.com/iimurpyh/pilot-lua/wiki].
    *[[Microcontroller]] - An object that stores and runs code when triggered by polysilicon and powered. This is the core component of coding, as its the only way to run code in this game.
    The mainImportant parts offor programming are:
    *[[Port]] - Allows the microcontroller to interact with other objects, trigger and configure, etc. This is also a very important part, because it is the ONLY way to allow microcontrollers to interact with the outside world.
     
    *[[Screen]] - A programmable object that can display user interface objects and UIs such as TextLabel, ImageLabel, etc. This is very important for creating custom UIs and displaying text. However, if you are new to coding and don't understand UIs too much, then it is recommended to just use [[Sign|signs]].
    *[[Microcontroller]] - An object that stores and runsRuns code when triggered by polysiliconPolysilicon andif it is powered. This is the core componentan ofessential codingpart, as itsit is the only way to run code in this game.
    *[[Disk]] - Stores values in a [https://create.roblox.com/docs/education/coding-5/intro-to-dictionaries dictionary] format. It is very useful to store large amounts of info like code and [[Model Builder|model codes]]. It is also very useful, as microcontrollers don't carry information across turning on and off, while disks do.
    *[[Port]] - Allows the microcontrollerMicrocontroller to interact with other objects, triggerconfigure them, and configure,send etctriggers. ThisWhile not strictly essential, it is alsostill a very importantcore part, becauseof programming as it is the ONLYonly way tofor allowa microcontrollersMicrocontroller to interact with the outsideits worldsurroundings.
    *[[EthernetCable]] (Optional) - Allows you to extend the range of [[Port|ports]], not required to get parts from a [[Port]], although highly recommended if your creation is large, and you need get parts far away from the [[Port]]. Note: The [[EthernetCable]] needs to be touching the hole on the [[Port]] in order to work.<!-- 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). -->
    *[[Screen]] - Displays user interface objects on its surface using Gui elements (such as TextLabel, Button, ..). It is one of the most common ways to provide the user with feedback as it is able to display it in a clear, visual way. It can be to a certain extent supplemented with the much easier to program [[Sign|signs]].
    *[[Disk]] - Stores values in a [https://create.roblox.com/docs/education/coding-5/intro-to-dictionaries dictionary] format. It is very useful toCan store large amounts of infodata like code and [[Model Builder|model codes]]. ItData isstored alsoon verya usefuldisk is permanent, as microcontrollersopposed don'tto carryvariables informationon acrossa turningmicrocontroller on(which andare lost when the microcontroller is powered off, whileor disksthe do.server is restarted).
    *[[EthernetCable]] (optional) - Allows Ports to reach further when placed touching the hole of the port, similar to how a wire allows power to reach further.
    *(UNSTABLE) [[Router]] (optional) - The router is the [[Antenna]] of [[EthernetCable|ethernet cables]]. It does the same thing as [[EthernetCable|ethernet cables]], only wireless. This is incredibly useful, as it allows for wireless connections, and allows for parts to be connected from across the region. Note that this is ONLY in [https://www.roblox.com/games/4569607361/Waste-Of-Space-UNSTABLE unstable].
     
    Other less-important items in coding include:
    *[[Modem]] - Allows for cross-region message passing and communication with arbitrary www domains (Sends GET and or POST requests to either the WOS internet, or the real (www) one). Allows for the creation of an internet of sorts. See the article for more details.
    *[[Modem]] - Extremely useful for creating makeshift internets of sorts. It allows messages to travel across the entire universe! <!-- PLEASE add info on postrequests and stuff, bc I don't understand them -->
    *[[LifeSensor]] - Very usefulReturns forthe makingnames smartof turretsplayers and othertheir stuff.Vector3 Itlocation, isif usedthey toare returnwithin namesits ofrange. playersCan andbe theirused Vector3to locationmake, for example, smart turrets.
    *[[Gyro]] - whileNot theprogramming-exclusive, [[Gyro]]though isstill notwidely aused coding exclusive part like most,as it has a programmable method called gyro:PointAt(vector3 position). This, along with [[LifeSensor]], can make an accurate turret, or if you just want to make the gyro point at a certain place.
    *[[Keyboard]] - extremely usefulUsed for inputting text, commands, or when attached to a [[Seat]] or [[VehicleSeat]], can be used to get keys pressed to make keybinds.
    *[[Microphone]] - extremelyRetrieves usefulchat formessages. makingCan chatbe commandsused orfor chat logs ofor somechat sort, because its used to get anything said in chatcommands.
    *[[Instrument]] - VeryMeasures usefulphysical for giving information to a microcontroller,properties such as outside temptemperature andor positionvelocity.
    *[[TouchScreen]] - A improved version of the [[Screen]], as it allows you to get the X and Y (in offset) of the cursor on the screen. Note that you can use buttons on Screens for User input.
     
    TheAs an example, the code below is code for a smart turret that takes chat commands and targets players accordingly, with the command "<code>target playername"</code>:<syntaxhighlight lang="lua" line="1">
    local Gyro = GetPartFromPort(1, "Gyro") -- Gets gyro attached to port 1
    local Microphone = GetPartFromPort(2, "Microphone") -- Gets microphone attached to port 2
    Line 35 ⟶ 38:
    end)
    </syntaxhighlight>
    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. It is only really recommended if your going to do something like port:Connect("Triggered")
    *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) - pretty self explanatory, sends a [[Button|trigger signal]] from the given port or port instance
    *GetPartsFromPort(ID or Port Instance, ClassName) Returns an [https://create.roblox.com/docs/luau/tables array] of different parts attached to the [[Port]]. In order to use, it is recommended to use [https://create.roblox.com/docs/education/coding-5/pairs-and-ipairs ipairs], however, a "'''for i = number, number do'''" along with a "'''Parts[i]'''" will work too.
     
    *<code>GetPort(ID)</code> - Returns a port instance that can be used in other functions. It is only really recommended if your going to do something like <code>port:Connect("Triggered")</code>
    *<code>GetPartFromPort(ID or Port Instance, ClassName)</code> Returns a part if found directly attached to a port. An example would be GetPartFromPort(2, "Screen")
    *<code>TriggerPort(ID or Port Instance)</code> - pretty self explanatory, sends a [[Button|trigger signal]] from the given port or port instance
    *<code>GetPartsFromPort(ID or Port Instance, ClassName)</code> Returns an [https://create.roblox.com/docs/luau/tables array] of different parts attached to the [[Port]]. In order to use, it is recommended to use [https://create.roblox.com/docs/education/coding-5/pairs-and-ipairs ipairs], however, a "<code>'''for i =''' number, number do'''"</code> along with a "'''<code>Parts[i]'''"</code> will work too.
     
    All objects will contain certain programmable properties and functions. However, all instances will contain the following properties and methods:
    *Properties
    **Configurable properties, for example an ionrocketIonRocket's thrust speed property
    **<code>ClassName</code>, which is simply the name of the object
    *Methods
    **Object:Trigger(), which simply triggers the object
    **Object:Configure({Property=NewValue}), which configures the part to the given dictionary/table
    **Object:Connect, whichconnects isa similarfunction to robloxan connections (part.Touched:Connect). An example includesobject's event
     
    TouchTrigger:Connect("Touched", function() end)
    *Events
    **part:Connect("Triggered", function() end)
    Certain parts however will have their own special properties.
    *Screen
    Line 150 ⟶ 152:
    </syntaxhighlight>
    There you go! You have just made a simple messaging system. You can expand on this by using [[Keyboard|Keyboards]] to send messages, or use screens to make a nice looking UI.
     
    Another method is the RealPostRequest, it enables you to send post requests to real websites such as google. Here's an example:
     
    <syntaxhighlight lang="lua" start="1">
    local Modem = GetPartFromPort(1,"Modem")
    local Sign = GetPartFromPort(1,"Sign")
     
    local Payload = JSONEncode({"Data",1,2,3})
     
    local Data, Success = Modem:RealPostRequest("http://CustomLinkHere.com",Payload,false,nil,{["Content-Type"]="application/json"})
    if Success then
    Sign:Configure({SignText=Payload})
    end
    </syntaxhighlight>Sadly, the RealGetRequest does not work. So you have to use the post requests.
     
    If you want to use the RealPostRequest for sending data to your computer then you will have to use third party resources. (i.e. website hosting) how ever, learn Luau first, you will need some LUAU experience or lua 5.1 experience, learn Lua 5.1 then Luau then pliot.lua.
     
    == Resources ==
    Line 155 ⟶ 173:
    * There is currently one player-made wiki, [https://github.com/iimurpyh/pilot-lua/wiki murpyh's]
    * Some information on parts can be found at [https://wos.mawesome4ever.com mawesome's part list site], though some information is inaccurate or not displayed there
    *[https://create.roblox.com/docs/ Roblox creator documentation] contains a load of info on rbx.lua. If you are unfamiliar with lua, or coding in general, it is highly recommended to learn rbx.lua first. if you do NOT know what rbx.lua IS, it is a nickname for Luau.
     
    ==Programming Examples ==
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.

    Recent changes

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