GabelaGarlaSrl 0 Posted April 24, 2019 Share Posted April 24, 2019 So i was working on a a script that is supposed to make an one way elevator with thut's elevators and opencomputers, but the script errors I want to know what is the problem NOTE: I'm new to opencomputers Quote Link to post Share on other sites
1 Solution SpaceBeeGaming 3 Posted April 25, 2019 Solution Share Posted April 25, 2019 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. Quote Link to post Share on other sites
0 SpaceBeeGaming 3 Posted April 25, 2019 Share Posted April 25, 2019 @GabelaGarlaSrl What is the error? Can't help if we don't know the problem. Quote Link to post Share on other sites
0 GabelaGarlaSrl 0 Posted April 25, 2019 Author Share Posted April 25, 2019 Well, it like always says then is required near end Also i'm playing in 1.12.2 Quote Link to post Share on other sites
0 GabelaGarlaSrl 0 Posted April 27, 2019 Author Share Posted April 27, 2019 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 Quote Link to post Share on other sites
0 SpaceBeeGaming 3 Posted April 27, 2019 Share Posted April 27, 2019 @GabelaGarlaSrl Glad to be of help, and no it's not that long script. Here is an example of a medium/large-ish-sized script: https://github.com/SpaceBeeGaming/OC-DNS/blob/master/bin/dns_server.lua (It's from my GitHub, part of a larger project) Quote Link to post Share on other sites
So i was working on a a script that is supposed to make an one way elevator with thut's elevators and opencomputers, but the script errors
I want to know what is the problem
NOTE: I'm new to opencomputers
Link to post
Share on other sites