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



    Waste Of Space Wiki

    Programming/Staging: Difference between revisions

    Content added Content deleted
    m (finished setup part, except the text editor list)
    m (spacing)
    Line 27: Line 27:


    In this case, you'll need something that can run luau code. This guide recommends that you use Roblox Studio for these purposes. Using Studio to test your code isn't exactly the best, but studio is approachable for a beginner such as yourself. Besides, there aren't really any other options anyways.
    In this case, you'll need something that can run luau code. This guide recommends that you use Roblox Studio for these purposes. Using Studio to test your code isn't exactly the best, but studio is approachable for a beginner such as yourself. Besides, there aren't really any other options anyways.




    For now, do the following:
    For now, do the following:
    Line 41: Line 43:
    * Resize the output window to be a bit bigger than by default if you have the screen space for it.
    * Resize the output window to be a bit bigger than by default if you have the screen space for it.
    * In the Explorer, hover over the 'ServerScriptService' and click the plus (+) icon beside it. Then, add a script to it (a regular script: make sure it's not a LocalScript or ModuleScript).
    * In the Explorer, hover over the 'ServerScriptService' and click the plus (+) icon beside it. Then, add a script to it (a regular script: make sure it's not a LocalScript or ModuleScript).





    Line 52: Line 55:
    Once everything's loaded, you should see the following in the output window:
    Once everything's loaded, you should see the following in the output window:
    Hello world!
    Hello world!





    This means everything's working! You're now ready to start coding. If this isn't the case, double check you followed all of the instructions to the letter.
    This means everything's working! You're now ready to start coding. If this isn't the case, double check you followed all of the instructions to the letter.

    Revision as of 22:09, 16 June 2024

    Waste Of Space features a fully fleshed out programming system, allowing players to program Microcontrollers using a sandboxed subset of luau (which is itself a superset of lua) called Pilot.lua. Programming allows players to easily and efficiently implement complex logic and automation into their builds by writing code.


    This article serves as an introduction to programming in-game. It provides a handy yet detailed tutorial to get you started, a list of commonplace and useful programming-related parts to consider, some useful resources to help you with programming successfully, and at the end; a few inspiring examples. The talk page of this article hosts a community board to share useful and unique projects/code.

    Tutorial

    Foreword

    Microcontrollers are perhaps one of the most powerful tools waste of space provides you with. Knowing how to use them is paramount if you want to implement any kind of advanced automation or autonomy into your builds. This is not to say they are only for drones and factories, however. Programming expands your already large range of possibilities to a nearly boundless one.

    This tutorial will provide you with a brief guide on programming and coding in-game. Namely; programming and coding are not the same, though they are often confused as such. Coding is just writing instructions to the computer (code), while programming is the engineering of software. A programmer creates algorithms and solves problems, and then codes them to create a fully-fledged software solution.

    Please do not feel intimidated by this, as if it something out of reach to you. Though serious programming is not everyone's cup of tea, you do not need to be an AAA++ software engineer with 15 years of experience to code up your little idea. Everyone needs to start somewhere, and Waste of Space is hardly a source of difficult problems. Perhaps, if after reading this tutorial you find out that you like programming, you may even become one of those pros one day. Even in the worst case though, you will have learned an increasingly relevant skill and will have developed your logical thinking. If you haven't already gotten the gist, this guide is aimed at newcomers to programming.

    If you aren't sure whether or not to commit to learning programming, perhaps a well-known example (it's on the game's thumbnail!) of programming in waste of space can tip you over to either side.

    A video of the space arcade by iiMurpyh

    Learning to code

    While you may be tempted to start writing code right away you'll need to set up an environment for this first. This is what's called a development environment.

    As you'll just be writing some basic luau (a dialect of the lua) throughout this tutorial, this will consist of just a text editor (and something to run your code with). A text editor can be as simple as just a notepad program so you have somewhere to jot down your code, or can be more complex and specialized for writing code. These types of text editors (code editors) often offer useful features such as automatic code completion and syntax highlighting (it colour-codes smaller bits of code, conveying their meaning or data type). A few suggestions for a code editor are listed below, complete with pros, cons, images, and links.

    • (the list)


    Once you've set up a code editor, there's one more thing to do before you can start coding: setting up a runtime environment. As lua is a scripting language - a programming language in which the instructions to the computer are stored as source code (the code as you wrote it, in textual format) - it must be translated to the computer in real time because computers can only understand binary (0s and 1s). This is what a runtime environment is for (in this case); it allows for the execution of scripts (source code) by translating them to machine code (instructions understandable to the computer) on the go.

    In this case, you'll need something that can run luau code. This guide recommends that you use Roblox Studio for these purposes. Using Studio to test your code isn't exactly the best, but studio is approachable for a beginner such as yourself. Besides, there aren't really any other options anyways.


    For now, do the following:

    • Install Roblox Studio if necessary.
      • Go to https://create.roblox.com/
      • Click the 'Studio' button in the left side menu (under 'Quick links': at the bottom of the list). Alternatively, if you are not logged in, click the 'Start creating' button.
      • Click the 'Download' button
      • Install Studio by running the newly downloaded file
    • Open Roblox studio and under the 'New' tab click on the 'Baseplate' template
    • Open the file tab (Top left) and save this new experience (click 'Save to Roblox')
    • Close all of the windows except the 'Output' window (if present) and the 'Explorer' window.
      • If you don't have an output window, click the 'View' tab at the top of your screen and then click the 'Output' button to turn the window on
    • Resize the output window to be a bit bigger than by default if you have the screen space for it.
    • In the Explorer, hover over the 'ServerScriptService' and click the plus (+) icon beside it. Then, add a script to it (a regular script: make sure it's not a LocalScript or ModuleScript).



    If you've done everything correctly, you should now be in the built-in script editor. You should see the following:

    print("Hello world!")
    

    Go ahead and run this by clicking play at the top of your screen. You'll do this from now anytime you need to run your code. Unless you've chosen the built-in studio editor as your text editor of choice, you'll have to copy and paste the code you write into this script. Make sure to first select all of the text and only then paste your code so as to replace the existing contents.

    Once everything's loaded, you should see the following in the output window:

    Hello world!
    



    This means everything's working! You're now ready to start coding. If this isn't the case, double check you followed all of the instructions to the letter.

    - Use this as an introduction to basic code flow

    - variables, global vs local

    - types

    - numerical operators, numerical operators on variables

    - logical operators, scope

    - tables, dictionaries

    - loops - basic

    - strings - basic operations

    - more operators, operator shenanigans

    - functions (basic. just an introduction;)


    - tasks should be included for each of these. these tasks should be quizzed (use the quiz extension).

    Computational thinking

    - problems, and how they are broken down into programmable steps. just a lot of problems. practice makes perfect

    - small project at the end

    Coding revisited

    - strings 2

    - basic OOP

    - functions/methods 2 (stuff like recursion goes here)

    - more complex collections (stacks, queues, etc. - with implementation details/a preprogrammed script available for these)

    - built in functions (if possible in any way this should be introduced bit by bit through earlier sections)

    - coroutines

    - error handling


    - quizzes after every smaller chunk. more than for learning to code as this is tougher.

    The Microcontroller

    - parts

    - built in microcontroller functions

    - JSON and modems; web requests

    - add a quick little quiz and small project at the end

    Programming at last

    - everything put together and tested with practical projects

    - thorough explanations and solutions should be given for each project. throw in some software engineering stuff here as well.

    Afterword

    - buh bye

    Parts

    Resources

    Examples

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

    Recent changes

  • Axenori • 1 day ago
  • Voivsone • 1 day ago
  • Axenori • 1 day ago
  • Axenori • 2 days ago
  • Cookies help us deliver our services. By using our services, you agree to our use of cookies.