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

Search the Community

Showing results for tags 'lua'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • OpenComputers
    • Announcements
    • Feedback
    • IRC
  • Code Central
    • Support
    • Showcase
    • Tutorials
  • Addons & More
    • Addons Mods
    • Architectures
    • OpenEngineering Task Force
  • General
    • Lounge
    • Forum Games
    • Showcase
    • Servers
  • Archives
    • Public Archives

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Minecraft


GitHub


IRC


Fediverse ID


Location


Interests

Found 7 results

  1. So I made myself a little lua script to read the inventory of my me storage system and also list the amount of bytes they require. Its my first script so I'm sure there are better ways to do all of this. The Me Network is connected to the Computer via an adapter on the me controller of the network. Pastebin here Now what it does is it uses the getItemsInNetwork function to list all items in a loop and display the name and amount of Bytes of each item in one line. A line counter goes up for each of the items added which is needed later. After all Items are listed it displays the total amount of Bytes available as well as the amount of bytes used and then the percentage of used storage. And finally at the very end a timer is displayed that counts down from 60. Once this timer is over the script refreshes and goes through the list of items again so that the item counts are updated. here is where I used the line counter so that the very last line could get cleared and replaced with the new timer that displays one second less on every loop until it hits zero and the script refreshes. This script has worked for me for quite a while and on a second me system that only holds 3 different types of items it still does. On my main me storage however this script is starting to break at the very end with the timer line no longer being overwritten and instead adding multiple lines alongside the new timer line like so: And here is how it looks on the other me system: Here the line "Time until refresh: n" is replaced the way its supposed to. The only difference between the two scripts is that the one that works uses the getFluidsInNetwork function instead. Is there a way for me to fix this or is it a problem of having too many items in storage ? Additionally tips on how to improve this script in general are welcome as its my first and could probably be improved a lot.
  2. Hello guys i am Symbo i know this is a simple tutorial but the fact that idk programming well let's talk about it! Now the programming language as named LUA is a programming language that is very easy to learn! Let's get start with an explication of what you sould start with. Now whos like me that dosen't know programming well your here to learn some. You sould go ahead and get ComputerCraft and learn CC's lua because it's the same but some apis are modified because OC uses direct lua. This is the most inpersive concept of learning lua without learning the apis. First of all i am not a programmer i will not teach you lua, it's your opinion if you want to learn lua or not. Now the fact that lua is easy to learn you sould first learn ComputerCraft... well heres some apis that will actualy help you programming some programs term.clear() term.setCursorPos(X, Y) print("STRING") Now those are some basic stuff. CC has basic lua so you will learn much much basics from CC, If you do that then you can learn OC because if you know CC already then it wil lbe 5x more easier to learn because only some apis are changed from the basic lua. The stuff you don't need at CC is components, components are the basic stuff you start with and they are optional for OC (Open Computers) Now you sould learn CC first and then OC because it will be very very easy to learn DIRECT LUA I recommend lua 5.3 because lua 5.2 is not even doing good anymore. Now if you wanna change the cpu to lua 5.3 then just brick right click in air and you will see in chat what type of lua you changed. Now replay if you want i will try replaying to the replay you did so if this makes no sense then i will call your replays comments. Now let's start with some basic stuff that people are very lazy to do Well the first stuff is learning, people whos lazy dosen't even have time to learn but they have to make thier programs. But what if programming languages was about explaining what the program does Like While the program is open then Open the other program. end Well this is not how it works. People stop being lazy reading and start learning! - Post end -
  3. Description: I need a controling system for distance control of my bunker. Mods: OpenComputer for 1.12.2 Opensecurity for 1.12.2 OpenGlasses for 1.12.2 Functions: Door state control Lock/Unlock doors Key card locks for piston doors All of it must controled from glasses from openglasses If you don't understood somethink, please write and i will answer you as soon as posible. And sorry for mistakes, i'm from Russia ans not master of english.
  4. I have tried for a long time to figure out a way to read a NBT Tag from Lua but all it says when I hit enter is 'nil "0"'. For example: In reactorcraft, you can make toroid magnets, and for some reason unlike other blocks in reactorcraft, you cannot read the tank levels. So, you must get the NBT data. I looked in the mod files and found the tags, but when I put the string into the function to get the NBT Tag, it says 'nil "unknown error"', meaning it knows that it is a recognized tag, becuase otherwise with a random string nothing happens. Please help me get this data from LUA!! Thanks, DMANisAWESOME
  5. It seems completely funny but I am actually trying to get through this for the last 2 days: I try to access weather data through the OpenWeatherMap.org API wich seems to work fine with internet.request(url). The problem is just that it returns me the JSON as a table instead of a String. I tried to access fields of that table but everything seems to return nil. I just can't get to access anything from that table. There are tons of JSON serialization librarys out there but they all need the JSON as a String. I am completely lost rn. This is the API response that gets stored as a table for some reason: {"coord":{"lon":7.68,"lat":52.85},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"base":"stations","main":{"temp":10.51,"pressure":999,"humidity":66,"temp_min":10,"temp_max":11.11},"visibility":10000,"wind":{"speed":5.1,"deg":230},"rain":{"3h":0.11},"clouds":{"all":92},"dt":1552771115,"sys":{"type":1,"id":1871,"message":0.0045,"country":"DE","sunrise":1552714945,"sunset":1552757625},"id":2810860,"name":"Werlte","cod":200} My Lua code couldn't be simpler: local web = require("internet") local data = web.request(<API_LINK>) -- data is of type table and I don't know how to get any values. Tried so many combinations on indices. -- For each loop works to loop through everything though
  6. Hello. I’m entirely new to Opencomputers and Lua scripts. I’m not familiar with the language nor can I code. I would like ask how to create a automatic door to open with a passcode. I have all the components just don’t know how to make it all work! Thanks in advance ;)
  7. hi i am okay to computercraft but a complete newb to openccomputers but here is my question I have made a program in cc and then ported it over to oc it works but for some unknown reason will it not read the data from my table or maybe from ae2 itself here is the code so what's wrong local component = require "component" local gpu = component.gpu local colors = require("colors") local term = require "term" local me = component.me_interface local monX,monY = gpu.getResolution() local low = 64 local meItems = { [1] = {"Iron Ingot","minecraft:iron_ingot","0"}, [2] = {"Sand", "minecraft:sand","0"}, [3] = {"Acasia Wood","minecraft:log2","0"}, [4] = {"Acasia Planks","minecraft:planks","4"}, [5] = {"SawDust","Mekanism:Sawdust","0"}, [6] = {"Paper","minecraft:paper","0"}, [7] = {"Cactus","minecraft:cactus","0"}, [8] = {"Cactus Green","minecraft:dye","2"}, [9] = {"Ink","minecraft:dye","0"}, [10] = {"Red Dye","minecraft:dye","1"}, [11] = {"Purple Dye","minecraft:dye","5"}, [12] = {"Gray Dye","minecraft:dye","8"}, [13] = {"Light Gray Dye","minecraft:dye","7"}, [14] = {"Light Blue Dye","minecraft:dye","12"}, [15] = {"Dandyline Yellow","minecraft:dye","11"}, [16] = {"Aluminium Ingots","TConstruct:materials","11"}, [17] = {"Stone","minecraft:stone","0"}, [18] = {"CobbleStone","minecraft:cobblestone","0"}, [19] = {"Gold Ingots","minecraft:gold_ingot","0"}, [20] = {"Copper Ingots","Mekanism:Ingot","5"}, [21] = {"GlowStone Dust","minecraft;glowstone_dust","0"}, [22] = {"Glass","minecraft:glass","0"} } function checkMe(checkName, name) melist = me.getAvailableItems() for a = 1, #melist do itemName = melist[a].fingerprint.id .. melist[a].fingerprint.dmg value = tostring(melist[a].size) if itemName == checkName then centerT(name, row+2, 0x000000, 0x0024BF, "lefty") if tonumber(value) <= low then centerT(value, row+2,0x000000, 0xBF0000, "righty") else centerT(value, row+2,0x000000, 0x0FBF00, "righty") end row=row+1 end end end function checkTable() row = 1 clearScreen() for i = 1, #meItems do checkName = meItems[2] .. meItems[3] name = meItems[1] checkMe(checkName, name) end end function clearScreen() gpu.setBackground(0x000000) term.clear() term.setCursor(1,1) centerT(" ME Inventory ",1 ,0x0F00BF , 0xFFFFFF,"head") end function centerT(text,line,txtback,txtcolor,pos) gpu.setBackground(txtback) gpu.setForeground(txtcolor) length = string.len(text) dif = math.floor(monX-length) x = math.floor(dif/2) if pos == "head" then term.setCursor(x+1, line) term.write(text) elseif pos == "lefty" then term.setCursor(2,line) term.write(text) elseif pos == "righty" then term.setCursor(monX-length, line) term.write(text) end end while true do checkTable() -- sleep(10) end
×
×
  • Create New...

Important Information

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