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

All Activity

This stream auto-updates     

  1. Today
  2. In what piece of code you have 3 ends? I only find 3 ends in the last program I posted. There you have one end for closing the main function (2nd end), one for closing the if-statement (1st end) and the last end is for closing the while loop. And for the error: First it would be good if you could post the actual screenshot. Second, could you post the code of the program you were running? From what I currently see, there‘s propably a typo in line 18, but I can‘t tell exactly, what is wrong until I see the actual code.
  3. Yesterday
  4. I have a question why type 3 ends? I am thinking one ends the loop,another ends the main function and the last ends the program. Am I right? And it gave me this error:/lib /process.lua:52: /home/autorun.lua:18: syntax error near ‘username’: stack traceback: |C|: in function ‘assert’ /lib/process.lua:52: in function </lib/process.lua:35> (...tail calls...) [C]: in function ‘xpcall’ machine:791: in function ‘xpcall’ /lib/process.lua:63: in function </lib/process.lua:59> Help!
  5. Yes I am trying to restart the function thanks for the compliment and help this will really help me!
  6. Many thanks Molinko, replaced them all with static references for now, will read up on arrays later. Code is no longer erroring. Still needs work though. Thanks again!
  7. On line 349 and others you use an undeclared variable named 'turbineNum' to index the turbine table like so "some_value = turbine[turbineNum].someMethod()". You use this in a few places in the script yet I can't find a placed where it is defined.
  8. Okay, lots of progress here. Got mixed up with 'goto ::label::' and a self declared function here called label. Problem was the label function being declared after it was called. Ive since butchered the script and reduced it to only what I need. Now I have a new issue and I cant seem to work out whats up here. New code - https://pastebin.com/uet4tZ8N Error screenie below. Any suggestions?
  9. Hey, in these if statements, you need to use relational operators. Since you want to see if you're variable is equal to a certain string, you need the '==' (two equal signs). So you're code would look like this -- local require commands start local component= require (“component”) local sides = require(“sides”) local rs = component.redstone local event = require(“event”) -- local os = require(“os”) remove this, the os lib does not need to be required, I think -- local require commands end -- Main function start local function main() local username, message = event.pull(“chat_message”) -- you head a period (.) between both variables -- problematic loop start if username == “Hakz_Studios” and message == “ Alice Refuel” then component.speech_box.say(“Refueling”) component.chat_box.say(“Refueling”) repeat local username,message = event.pull(“chat_message”) rs.setoutput(sides.bottom, 15) -- you need to give the redstone output a value, otherwise it wont turn on -- also, by putting it into a loop, the redstone output will be set a ton of times -- it helps putting the statement before the repeat until loop until username == “Hakz_Studios” and message == “Stop Refueling” -- restarting function function main() -- idk what is this line about, but i dont think it belongs here elseif username == “Hakz_Studios” and message == “Stop Refuel Systems” os.execute(“Shutdown”) -- it will look for a program called 'Shutdown' with a capital S else function main() -- also, dont know what you want to do here, do you want to start the function again (to have the code repeated endlessly) --problematic loop end end -- main function end end Some small info: you don't have to put brackets around your condition in the if-statements, you can, but it's not necessary. Also, here is a program that repeats the main loop over and over again, as I think that is what you want to do in your original code, if I'm wrong tho and misinterpreting you're code, just ignore my suggestion -- require libs local component = require("component") local rs = component.redstone local sides = require("sides") local event = require("event") -- main function local function main() local username, message = event.pull("chat_message") if username == "Hakz_Studios" and message == "Alice Refuel" then component.speech_box.say("Refueling") component.chat_box.say("Refueling") -- this time I set the redstone output once, and then wait for the message 'Stop refueling' then deactivate the redstoneoutput again rs.setOutput(sides.bottom, 15) repeat username, message = event.pull("chat_message") -- you dont have to use 'local' in front of username and message here, since you already created these variables at the top of the main function -- it will override these values but it actually doesnt matter since from this part you will skip to the end and these initial values for both variables -- wont be needed anymore until username == "Hakz_Studios" and message == "Stop Refueling" rs.setOutput(sides.bottom, 0) -- I assume you want to deactivate the redstone after you're done refueling elseif username == "Hakz_Studios" and message == "Stop Refuel System" then os.execute("Shutdown") -- again, this will start the program "Shutdown" with a capital "S" end -- as you can see, we skip the last else statement, as it will call the main function recursively, resulting in a overflow error pretty fast -- you could get away with returning a call to the main function, but this wouldnt be good practice eiter, I guess end -- we add a last while loop, which will repeat endlessly calling the main function while true do main() end I hope this helps. Also you did great for your first shot at programming!
  10. I need help with my autorun.lua program It won’t take my If-then statements what am I doing wrong? (I am using Computronics) Here is the program — local require commands start local component= require (“component”) local sides = require(“sides”) local rs = component.redstone local event = require(“event”) local os = require(“os”) — local require commands end — Main function start local function main() local username.message = event.pull(“chat_message”) —problematic loop start if (username = “Hakz_Studios” and message = “ Alice Refuel”) then component.speech_box.say(“Refueling”) component.chat_box.say(“Refueling”) repeat local username,message = event.pull(“chat_message”) rs.setoutput(sides.bottom) untill username= “Hakz_Studios” and message = “Stop Refueling” — restarting function function main() elseif username = “Hakz_Studios” and message = “Stop Refuel Systems” os.execute(“Shutdown”) else function main() —problematic loop end end — main function end Sorry If I had many mistakes I just started Coding Today and Thanks in advance
  11. Last week
  12. Trying to setup a turbine monitor using CC, quite new to this but not to programming. All I'm getting is errors, including from others projects. Trying to replicate _quietstorm_s project here http://pastebin.com/TKZfaERy All I'm getting is image. 1. Are the two mod packs able to function together (some posts report no, I cant find out conclusively) 2. If yes to the above then what am I doing wrong here? Many thanks Ben
  13. you have an internet card?
  14. Strange. When I attempt to install it, it complains about some wget error while installing the dependencies so it never actually installs.
  15. there is not global method named "list". There is, however, a method "list" on the "component" table: component.list("mfe")
  16. The question has been cleared by hard googling, please remove. Thanks!
  17. I've removed the link in the OP as it directs to a generally non-standard site. @AtomicScience please use Paste/Hastebin or GitHub for sharing code as they are easier to see the code and no possibility of a virus or something being included
  18. I can't get this to repro. can you open a github issue and provide this info? also (in the github issue) can you paste the steps you are taking? the exact code?
  19. I have a hostname on it because i put an old hard drive in there oc version is 1.7.4.153 Running the same snippet on a Creatix throws the same error: I haven't done anything to the creatix, I placed it, and then pasted the snippet into the lua interpreter.
  20. oc version please also, looks like you've set your hostname on that robot - which only tells me this isn't a minimal repro please provide minimal repro steps (also, if you have a bug, github is the place to report it)
  21. Earlier
  22. Hey, I'm trying to make a babby's first robot, and I'm already hitting some blockades All my code so far: local r = require("robot") r.forward() However, when I run this snippet, I get an out of bounds error as seen here: This also happens with some few other functions. (for example: place and detect) I'm convinced that this is not an error on my part, but I hope someone can prove me wrong.
  23. I can only recommend to put it onto github, its the same afford to put it there then to put into a zip folder and upload it to a file sharer. Also anybody can be sure that downloading your piece of software is not containing any malware which gets executed on download. In addition, i could be able to report the first bug in your issue tracker and you can keep track of it.
  24. just requiring your library throws errors. Another thing what is strange is that when you download the zip folder, its already inflated, thats not some kind of hacking assault?
  25. It's not possible. You can set them one after the other, sequentially, fast enough that you won't notice. Effectively at the same time.. but parallelization is not possible
  26. I would like to execute both if statements in the same time so that it can light up both redstone lamp at the same time I would like to execute both if statements in the same time so that it can light up both redstone lamp at the same time
  27. like molinko said, we dont have parallel execution, but we do have concurrency. https://ocdoc.cil.li/api:thread
  28. If you could post all the code or explain what you're trying to do a bit more that would help me help you. Lua is single threaded so there isn't any real parallelization, so I'm having a hard time understanding what you need.
  1. Load more activity
  • Newsletter

    Want to keep up to date with all our latest news and information?

    Sign Up
×
×
  • Create New...

Important Information

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