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

Gangsir

Members
  • Content Count

    71
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by Gangsir

  1. You could try using the serialization api. http://ocdoc.cil.li/api:serialization
  2. He means using the filesystem api to do it, instead of exec. another program. Look up OC's filesystem api.
  3. You're missing the require for the filesystem component. Also, the name of the variable used to require the filesystem component in needs to be placed in front of the spaceUsed() method. In total, it should look like this: local component = require("component") fs = component.filesystem space = fs.spaceUsed()
  4. Gangsir

    Commands

    All of the programs that come standard to OpenOS can be found in the /bin folder, which you can access with the following commands in order. cd /bin ls This moves the working directory to /bin, then lists all files, (programs) in that folder. You can then run them by typing the file name. You'll also note that lua and components.lua are there.
  5. Oh, I see what you did. You copied from the documentation. Generally in documentation it's standard to put the type of variable that a function returns after a colon. All you need is the part before :number. That part just tells you that that method returns a number.
  6. Guess who! It's me, Gangsir, back again with a large update to my old base manager program. I've made some tweaks to it, and given it a gui instead of it just being a list of text. In an attempt to keep this post organised, I've broken it up into sections, delimited by large title lines. I decided to do this after looking at the disaster of the original thread. At the bottom are the screenshots, computer requirements, and place to download. Due to it's size after this update, it is too large to copy+paste in one operation, so wgetting it is required. What is this? This is a simple base
  7. You will only need either the redstone card or the redstone io, both give the library you need. Going on your example, here's what it would look like. local os = require("os") local term = require("term") local component = require("component") local red = component.redstone local sides = require("sides") local i = 0 component.gpu.setResolution(10,4) --fitting my current 5x3 tier1 display while true do term.clear() if i == 0 then --simulating flashing colon print(os.date(" %I:%M %p") i = 1 else print(o
  8. Yes, give http://lua.org A look. There's plenty of documentation on every library that is included with lua, and gives many helpful tutorials.
  9. I bet you could also retrieve the real world time from an internet website using http, although I wouldn't know of one.
  10. Hey there! Welcome to the OC forums. It's a bit of a ghost town at times, but I'm usually here with a few others to answer questions. The program you're looking for would be as follows: local os = require("os") --requires the os library local term = require("term") --requires the term library while true do --runs forever term.clear() --clears the screen print(os.date("Current time is: %X%p")) --prints the current ingame time. os.sleep(1) --makes the program wait for a second end The os and term libraries are part of lua. Feel free to look them up, they are basically the same as t
  11. There's your problem. There should be a space after the cd, like so: local ok, err = pcall(shell.execute,"cd ..") Assuming you are not in the root directory (/) , in which case you can't go up a level(which is what two periods do), so that won't work.
  12. Press CTRL+ALT+C. Or, reboot the PC. Inside your code, you can also use os.exit()
  13. Opencomputers computers need an OS to run. For an explanation of how to get a basic computer set up, check here: http://ocdoc.cil.li/tutorial:oc1_basic_computer
  14. I can't find anything immediately obviously wrong with it, how far apart are the two computers? Is there any blocks with high hardness in-between the two? OC gets finicky with it's wireless system if that happens.
  15. I can help with the first request and with the second. First: When you call a method, you must give all params in order, up to the one that you need to modify. robot.use(3,100) would not work, as you are missing the sneaking or not boolean between those two.. It should be robot.use(3,false,100). There is a sides library that allows for direct side naming in english, E.g.: sides = require("sides") robot.use(sides.front,false,100) If you want to keep doing that, just put all the action code in an eternal while loop: sides = require("sides") while true do --run forever robot.use
  16. Yes. In the parameters of the use function, there are variables for (use while sneaking),duration, etc. The format is: robot.use(<side to right click>,<sneaking or non>,<duration in seconds>) More info at: http://ocdoc.cil.li/component:robot
  17. Nitpicks are fine! Accuracy is important. Fixed.
  18. Tis I, Gangsir. I've written a gui program for managing a mob farm's redstone. This program can control lights, doors, modded mob spawners, and a killing mechanism. (Such as grinders from MFR) This is a program that I myself use in my survival world, so I figured I'd share it. ---------------------- Update v1.1: +Added all off and on buttons +Edits to gui. ---------------------- Update v1.2 -Removed all off and on buttons, deemed not necessary +Changed gui library to TankNut's, better lib with more functionality +Tweaks to gui, due to above change -Removed beeping ---------------
  19. Hey, it's me Gangsir. I figured I'd try my hand at writing a tutorial on one of the coolest things (in my opinion) in lua. They say that the best way to learn and understand something is to teach it. This is what I aim to do with this hopefully easily accessible tutorial. What? Let me start off by explaining what a coroutine is, for those that don't know. A coroutine is basically a background function. It allows functions to be run without stopping the main thread. By rapidly stepping through background functions, we can achieve multi-tasking. Think of it like sending out your frien
  20. There's a few ways. Some prefer #1, due to it's similarities to CC turtles, but #2 is the best and fastest way, however it requires coding the program so it passes by a charger in it's travels. 1. Install a generator upgrade, then use it's api to refuel it, like a CC turtle: (Decent speed) http://ocdoc.cil.li/component:generator 2. Place the robot next to a charger block, then provide the charger power and a redstone signal: (Fastest) http://ocdoc.cil.li/block:charger 3. Install a solar power upgrade, and place it in a place it can see sunlight. (Slow) http://ocdoc.cil.li/item:s
  21. Gangsir

    drones

    Drones are basically mobile entity based microcontrollers, so any rules that apply to them also apply to drones. I don't really know to much about them either, you could try looking at this video, it somewhat explains how drones work: https://www.youtube.com/watch?v=ni_X07GbiKQ
  22. I'm no expert in libraries or coroutines, though the way you have the library set up is incorrect for OC. Fixed: http://pastebin.com/21vvAxUh Note that all I did was make it so OC recognises the library and require() returns a table of functions instead of a boolean. I can't guarantee that the code that pre-existed works. I don't really know much about coroutines. Try it out and notice my changes, see if it works.
  23. Yeah, oops. Finger's right, I derped a little on keeping the values updated. Anyway, you're very welcome Godly.
  24. I think the closest thing to the computercraft parallel API is the process API. http://ocdoc.cil.li/api:process It allows setting up other scripts as processes, which if my guess is correct function similarly to parallels. Give it a look.
  25. Opencomputers functions more similarly to real world computers, requiring an installation of OpenOS to a harddrive from the floppy in order to be able to edit and save programs. I recommend looking at the getting started tutorial on the wiki. The [HT] icons look like characters that it can't render. What's the pastebin link?
×
×
  • Create New...

Important Information

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