Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
GabelaGarlaSrl

nothing to say just that i need help with a script

Question

5 answers to this question

Recommended Posts

  • 1
  • Solution

Here is a fixed version along with some notes:

local event = require("event") --< event library needs to be requested.

local component = require("component") --< same for component
local lift = component.lift

while true do
    local e = event.pull("motion") --< Don't use system reserved variable names for your own.
    if (e == "motion") then --< This event is never false, as the 'event.pull()' is filtered => the upper action will alwayus run.
        lift.callFloor(2)
    else --< Cant be 'elseif', would need a conditon to test
        os.run(elevatormotionmanipulation)
    end
end

-- <= these things are comments, they are used to explain what code does, without affecting its execution, they can be removed without issues.

 

Link to post
Share on other sites
  • 0
On 4/25/2019 at 12:33 PM, SpaceBeeGaming said:

Here is a fixed version along with some notes:


local event = require("event") --< event library needs to be requested.

local component = require("component") --< same for component
local lift = component.lift

while true do
    local e = event.pull("motion") --< Don't use system reserved variable names for your own.
    if (e == "motion") then --< This event is never false, as the 'event.pull()' is filtered => the upper action will alwayus run.
        lift.callFloor(2)
    else --< Cant be 'elseif', would need a conditon to test
        os.run(elevatormotionmanipulation)
    end
end

-- <= these things are comments, they are used to explain what code does, without affecting its execution, they can be removed without issues.

 

That's a long script and i know about comments

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.