×
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

    Keyboard: Difference between revisions

    Content deleted Content added
    Created page with "{{Object |image1 = Keyboard.png |type = {{#invoke:GetPartInfo|getField|Type}} |uses = <!-- write a short summary of what the part is used for here --> |recipe = {{#invoke:GetPartInfo|getField|Recipe}} |raw_recipe = {{#invoke:GetPartInfo|getField|Raw recipe}} |malleability = {{#invoke:GetPartInfo|getField|Malleability}} |durability = {{#invoke:GetPartInfo|getField|Durability}} |configuration = {{#invoke:GetPartInfo|getField|Configuration}}..."
     
    Fixed some things and added an example program
    Line 1: Line 1:
    {{Object
    {{Object
    |title1 = {{PAGENAME}}
    |image1 = Keyboard.png
    |image1 = Keyboard.png
    |type = {{#invoke:GetPartInfo|getField|Type}}
    |type = {{#invoke:GetPartInfo|getField|Type}}
    |uses = [[Programming]]
    |uses = <!-- write a short summary of what the part is used for here -->
    |recipe = {{#invoke:GetPartInfo|getField|Recipe}}
    |recipe = {{#invoke:GetPartInfo|getField|Recipe}}
    |raw_recipe = {{#invoke:GetPartInfo|getField|Raw recipe}}
    |raw_recipe = {{#invoke:GetPartInfo|getField|Raw recipe}}
    Line 12: Line 13:
    <!-- Some information -->
    <!-- Some information -->
    The '''Keyboard''' is used in programming to take multiple key inputs.
    The '''Keyboard''' is used in programming to take text input. It is used by clicking on it or connecting it to a [[VehicleSeat]], typing text and pressing enter. It is to note the newline caused by pressing enter to input is included in the text.
    <!-- Automated fields -->
    <!-- Automated fields -->
    Line 21: Line 21:
    ==Configuration==
    ==Configuration==
    {{#invoke:GetPartInfo|getField|ConfigurationLarge}}
    {{#invoke:GetPartInfo|getField|ConfigurationLarge}}

    == Programming Example ==

    This program takes keyboard input and prints it to a screen
    <syntaxhighlight lang="lua" line="1">
    local Screen = GetPartFromPort(1, 'Screen') -- gets a Screen
    local Keyboard = GetPartFromPort(2, "Keyboard") -- gets a Keyboard
    Screen:ClearElements() -- Clears screen

    local TextLabel = Screen:CreateElement('TextLabel', {
    AnchorPoint = Vector2.new(0.5, 0.5);
    Position = UDim2.fromScale(0.5, 0.5);
    Size = UDim2.fromScale(1, 1);
    Text = ' ';
    TextSize = 20;
    TextScaled = false;
    }) -- Creates a container for text

    local function WriteScreen(text)
    text = text:sub(1, -2) --removes the newline from pressing enter to confirm keyboard input
    TextLabel:ChangeProperties({ -- change the text
    Text = text;
    })
    end -- function to edit text label

    Keyboard:Connect("TextInputted", WriteScreen)
    -- when text is inputted to the keyboard it will run the WriteScreen function
    </syntaxhighlight>
    [[Category:Parts]]
    [[Category:Parts]]
    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.