GabelaGarlaSrl Posted April 24, 2019 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
1 SpaceBeeGaming Posted April 25, 2019 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
0 SpaceBeeGaming Posted April 25, 2019 Posted April 25, 2019 @GabelaGarlaSrl What is the error? Can't help if we don't know the problem. Quote
0 GabelaGarlaSrl Posted April 25, 2019 Author Posted April 25, 2019 Well, it like always says then is required near end Also i'm playing in 1.12.2 Quote
0 GabelaGarlaSrl Posted April 27, 2019 Author 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
0 SpaceBeeGaming Posted April 27, 2019 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
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