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

LordNocturnus

Members
  • Content Count

    23
  • Joined

  • Last visited

Posts posted by LordNocturnus

  1. I am currently working on a bigger project with open computers and have now run into as serious problem: due to the size of the project there are random tick skips of up to 500 ticks (no that is not a  typing error and no it is not constantly lagging) due to these skips some of my robots and computers decide to throw the error "to long without yielding". I know that this is to prevent open computers from going through infinite loops, but in my case i can not get rid of it(and yes they are sleeping and even printing out something).

    What i think is happening is that open computers checks when the last command was executed (saved as the tick in which it was done or a ms timer is started) and in case this was longer ago than a specific time limit (in ticks or ms) it will through this error. In my case the tick skips seem to fill out the time limit so that it troughs the error (it even happens to OpenOS!! on robots)

    Is there some way to disable this "feature" or prevent the error from showing up(no lag optimizing is not an option i already am in a flatworld with only the spawn chunks being loaded)

  2. OK so i tried integrating your code into my program but very fast i noticed something: i can not download all items because the database upgrade only allows, as far as i know, 81 entries and i have way more ( i remind ~64000 items).

    now that i am back at my PC i can give you my original code for going through the items:

    local c = require("component")
    local s = require("sides")
    local event = require("event")
    
    local db = c.database
    local ex = c.proxy(c.me_exportbus.address)
    local me = c.proxy(c.me_controller.address)
    local r = c.redstone
    local m = c.modem
    
    args = {...}
    m.open(111)
    m.setStrength(64)
    
    --z=args[2]
    if args[4] then
     minz = args[4]
    else
     minz = 0
    end
    for z=minz,args[2] do
     num = 0
     print(z)
     for x=0,args[3] do
      db.clear(1)
      l = z.."-"..args[1].."-"..(args[3]-x)..".0"
      items = me.getItemsInNetwork({label = l})
      if #items > 0 then
       me.store({label = l},db.address,1)
       print(db.get(1).label)
       ex.setExportConfiguration(5,1,db.address,1)
       ex.exportIntoSlot(5)
       os.sleep(0.1)
       num = num+1
      end
      if num == 40 then
       m.broadcast(111,z)
       os.sleep(10)
       red = r.getInput(5)
       while red == 0 do
        os.sleep(0.1)
        red = r.getInput(5)
       end
       num = 0
      end
     end
     if num > 0 then
      m.broadcast(111,z)
      os.sleep(10)
      red = r.getInput(5)
      while red == 0 do
       os.sleep(0.1)
       red = r.getInput(5)
      end
     end
    end

     

  3. i get these labels just with

    for y=0,ydim do
      for x=0,xdim do
        for z=0,zdim do
          label = string.format("%d-%d-%d",x,y,z)
    --    if in ae do something
    --    else do nothing
        end
      end
    end

    and they are just the displayed name of the item (they are OC 3dprints made with the setLabel function)

  4. I am currently in the midst of building a larger open computers project for which i need to go through a lot of blocks with very specific labels (x-y-z, where x,y and z are integers, 0-5-99 for example), which is the only difference that can be found between the blocks without looking at them, that are stored in an ae2 Me system.

    The problem: I only know the maximum values for x,y and z, but not which individual block exist. My question is now if there is a way to do a "fuzzy" search (something like "-32-" to find all items containing that string in their label) within the ae2 integration(searching for all of the blocks takes way to long(64000 blocks and more)), so far i have only come across getting all items or only items with an exactly matching label. In case there is no way to do this in the current ae2 integration i would like to request this feature.

    MC 1.12.2

    OC 1.7.3.146

  5. Hello

    i am still working on my 3dprinting programm but found a problem: I can not print colored glass!!

    In the attached image you can see different kinds of glass(right) and their result when i use the texture in an 3dprint(left full block): they turn untinted.

    2018-08-28_03_18_00.thumb.png.e9a2237701773f8a24c024e03fb17970.png

    they also can not be tinted again using the tint feature of the 3dprinter: They are just a solid block with the assigned color.

  6. Hello

    i am trying to download a file use it and delete it again to make space on the hard drive for the next file but i does not delete the file somehow:

    local c = require("component")
    local computer = require("computer")
    local internet = require("internet")
    local fs = require("filesystem")
    local p = c.printer3d
    args = {...}

    link = "https://raw.githubusercontent.com/LordNocturnus/sf-"
    folder = "/master/"
    imax = 0

    local TIMEOUT = 4  -- in seconds

    for i = 0, imax do
     local url = link .. i .. folder .. "list.txt"
     local status, connection = pcall(internet.request, url)
     if not status or not connection then
      print("Download of " .. url .. " failed.")
     else
      local startTime = computer.uptime()
      while true do
       local response, isFinished = pcall(connection.finishConnect)
       if response and isFinished then
        local f = io.open("list.txt", "wb")
    --    print(status)
    --    print(response)
        print(isFinished)
    --    print(connection)
        for chunk in connection do
         f:write(chunk)
        end
        f:close()
        break
       elseif computer.uptime() - startTime > TIMEOUT then
        print("Request to " .. url .. " timed out")
        os.exit()
       else
        os.sleep(0.25)
       end
      end
     end
     for line in io.lines('list.txt') do
      print(line)
      local url = link .. i .. folder .. line .. ".mb3d"
      local status, connection = pcall(internet.request, url)
      if not status or not connection then
       print("Download of " .. url .. " failed.")
      else
       local startTime = computer.uptime()
       while true do
        local response, isFinished = pcall(connection.finishConnect)
        if response and isFinished then
         local f = io.open(line .. ".mb3d", "wb")
    --     print(status)
    --     print(response)
         print(isFinished)
    --     print(connection)
         for chunk in connection do
          f:write(chunk)
         end
         f:close()
         break
        elseif computer.uptime() - startTime > TIMEOUT then
         print("Request to " .. url .. " timed out")
         os.exit()
        else
         os.sleep(0.25)
        end
       end
      end
      cords = {}
      for i in string.gmatch(line,"([^-]+)") do
       cords[#cords+1] = tonumber(i)
      end
      print(cords[1],cords[2],cords[3])
    --  printer(cords[1],cords[2],cords[3]) -- do something with the file
      file = string.format("%d-%d-%d.mb3d", cords[1],cords[2],cords[3])
      fs.remove(file)
     end
    end

  7. Hello

    i am currently trying to use the textures of flat colored blocks in my 3d print but with the texture picker i always get "flatcoloredblocks:blocks/flatcoloredblock_drywall" which is just a white block.

    is there a way to get the colored texture on to the print or is it just not compatible (oc-version:MC1.12.2-1.7.2.67 and flatcoloredblocks-version:mc1.12-6.6)?

  8. ok i changed the programm a bit:

    local c = require("component")
    local computer = require("computer")
    local internet = require("internet")
    local f = io.open("test.txt", "wb")

    local imax = 0
    local xmax = 0
    local ymax = 41
    local zmax = 1

    local TIMEOUT = 5  -- in seconds

    local link = "https://raw.githubusercontent.com/LordNocturnus/sf-"
    local folder = "/master/"

    local pos = 0

    for i = 0, imax do
      for xb = pos, xmax do
        for yb = 0, ymax do
          for zb = 0, zmax do
            print(xb, yb, zb)
            local file = xb .. "-" .. yb .. "-" .. zb .. ".mb3d"
            local url = link .. i .. folder .. file
            local status, connection = pcall(internet.request, url)

            if not status or not connection then
              print("Download of " .. url .. " failed.")
            else
              local startTime = computer.uptime()

              while true do
                local response, isFinished = pcall(connection.finishConnect)
                
                if response and isFinished then
                  flagg = true
                  break
                elseif not response then
                  print("Could not connect to " .. url .. ".")
                  flagg = false
                  break
                elseif computer.uptime() - startTime > TIMEOUT then
                  print("Request to " .. url .. " timed out")
                  flagg = false
                  break
                else
                  os.sleep(0.25)
                end
              end
              if flagg == true then
                local f = io.open(file, "wb")

                for chunk in response do
                  f:write(chunk)
                end
     
                f:close()
                connection:close()
                flagg = false
              end
            end
          end
        end
      end
    end

    but now i get for file 0 41 0 (first existing file) in line

    for chunk in response do

    a "attempt to call a nil value" error

  9. thanks for the quick answer.

    i tried your code but got a compare number with nil in the line and i newer had a 404 error before even with wget it just wrote a empty file

    if not status or not response or response.response() >= 400 then
  10. Hello

    i am currently trying to download files from github (and yes i know about wget) and i need to know if they exist or not (making a list of all existing files is not feasible, because there is not enough space on the disk for the list).

    I tried multiple things:

    1. wget and filesystem.size always gave a length of 0 even for existing files

    2. copying wget in my own program and setting a flag if there is a chunk works ... but not with every file (all files that exist have the same structure and length) and i need all of the existing ones them

    Now i tried to do it myself with internet.request() but i only get 4 files (also the empty ones) then 6 fail and 4 succeed again(see test.txt t = True and f = False). This is because of to many open connections and i do not know how to close them.

    The internet.close() from the wiki dose not work for some reason. (attempt to call nil)

    How can i detect if the file exists and close the connection after the download?

    test.txt:

    tttttffffffffttttffffffttttffffffttttffffffttttffffffttttffffffttttffffffttttfffffft

    internet.lua:

    local c = require("component")
    local internet = require("internet")
    local f = io.open("test.txt", "wb")

    imax = 0
    xmax = 75
    ymax = 180
    zmax = 87
    line = ""

    link = "https://raw.githubusercontent.com/LordNocturnus/sf-"
    folder = "/master/"

    pos = 0
    i = 0
    while i <= imax do
     xb = pos
     while xb <= xmax do
      yb = 0
      while yb <= ymax do
       zb = 0
       while zb <= zmax do
        print(xb,yb,zb)
        file = tostring(xb) .. "-" .. tostring(yb) .. "-" .. tostring(zb) .. ".mb3d"
        status, user = pcall(internet.request ,link .. tostring(i) .. folder .. file)
        print(status)
        print(user)
    --    for i,v in pairs(user) do
    --     print(i,v)
    --    end
        if status then
         line = line .. "t"
        else
         line = line .. "f"
        end
    --    internet.close()
    --    f = io.open(file, "wb")
    --    for chunk in user do
    --     print(chunk)
    --     f:write(chunk)
    --    end
    --    f:close()
    --    fs.remove("home/" .. file)
        zb = zb+1
       end
       yb = yb+1
      end
      xb = xb+1
     end
     i = i+1
    end
    f:write(line)
    f:close()

     

×
×
  • Create New...

Important Information

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