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

Subtixx

Members
  • Content Count

    11
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by Subtixx

  1. Pretty cool, I'll check it out later.  One thing I could recommend is having a config setting to disable the chatbox.  That way those would don't use it don't have to edit your functions at all.

     

    Thanks and yes it would be better to have one :). So now just change "enableChatBox" to false :)

  2. With this program you can have a player interface automatically supply you with oxygen tanks.

     

    Basically this program checks your inventory if you have equal or more than "tankToKeepInInv" tanks in your inventory. When the variable "shouldSmallTanksCount" is set to true it also counts smaller tanks (light & med). If you've less than "tankToKeepInInv" tanks in your inventory, it will transfer tanks to your inventory until you reach "tankToKeepInInv" amount. If you've empty oxygen tanks in your inventory it pulls it out of your inventory, charges it, and put it back in the oxygen supply chest. It will also notify you if the oxygen chest is empty or your inventory is full.

     

    Mods you will need:

    - Peripherals++ Mod

    - OpenComputers

    - Galacticraft

     

    Items you will need:

    - Computer

    - Player interface (Peripherals++ Mod) [To interface with the players inventory]

    - Chatbox (optional disable through enableChatBox = false) (Peripherals++ Mod) [To alarm you about oxygen chest empty or inventory full]

    - 2 Adapters [1 for the player interface, 1 for the oxygen supply chest]

    - Some cabling

    - Hopper [As buffer for the player interface and the oxygen compressor]

    - Oxygen compressor & collector [To fill the oxygen tanks]

    - Filterable item pipes (transport pipes from bc, itemsducts from thermal expansion, item conduits from EnderIO etc.)

    - Chunkloader (Optional but necessary)

     

    Images:

    sFFd8k0.pngdYCTWdC.png

    (The resonant servo has full oxygen tanks as whitelist filter)

     

    Pastebin source:

    http://pastebin.com/yhpQDaWk

     

    I will post some setup pictures shortly.

     

    Attention: This was written in and for Space Astronomy, a modpack available on the FTB Launcher and Curse. It was not tested against any other mod packs! If you encounter any issues please post the modpack / mod combination with it!

     

    PS:

    Please do not brag about variables names nor sloppy code. This code was done after 10 hours of live streaming. You can suggest improvements but please do not post something like "should've named your vars better" or similar. Thanks!

     

    PS2:

    The part about "stockHotbar" was not tested. So it might not function correctly.

  3. JcicOaS.png

     
    Easy to expand! You can create "modules" of segmented displays:
     


    2pelSXO.png



    This is an "API/Library/Program" to display multiple characters on multiple SISD (sixteen-segment display)
      
    Setup pictures:


     
    Bugs / ToDo:

    • Convert it to an actual library / API
    • Displaying a marqueed "HELLO" text on 9 segmented display causes to display "LLO HE "
    • Marquee text? (scrolling text)
    • Placing more characters than redstone addresses causes the program to "crash"
    • Implement a function / method to use up all 5 sides of the redstone I/O (5 because 6 sides - the side for the cable)
      2.1 Easier ability to change sides (Related to 2)
    • Adding non-alphanumeric character will ?(I assume) crash? the program.

    Changelog:

    v1.2:
    - Optimizations
    - Added "Marquee" Text function
    - Fixed "Specified Side is invalid" trying to use sides[]

    v1.1:
    - Added new special chars: +, -, *
    - Fixed non-alphanumeric characters
    - Added the ability to use more than 1 side of a redstone I/O
    - Fixed more than one character display

    v1.0:
    - First release

     
    Code:

    --###################################################################
    --################# ProjectRed SISD Display v1.2 ####################
    --#################      (c) 2015 GigaToni       ####################
    --#################     DO NOT REDISTRIBUTE!     ####################
    --###################################################################
    
    component = require("component")
    sides = require("sides")
    
    local redstoneAddresses = {  
      {
          ["address"] = "3fbde23c-9b52-45ec-b957-3c5cc516c7ba",
          ["validSides"] = {
            sides.north,
            sides.west,
            sides.south
          }
      },
      
      {
          ["address"] = "1f49d174-6cd4-4eca-b246-60ed886053c4",
          ["validSides"] = {
            sides.north,
            sides.west,
            sides.south
          }
      },
      {
          ["address"] = "47889542-98ef-42ea-916f-96d3898e44b2",
          ["validSides"] = {
            sides.north,
            sides.west,
            sides.south
          }
      }
    }
    
    local segments = {
      ["*"] = 65280,
      ["+"] = 43520,
      ["-"] = 34816,
      ["0"] = 17663,
      ["1"] = 12,
      ["2"] = 34935,
      ["3"] = 34879,
      ["4"] = 34956,
      ["5"] = 37043,
      ["6"] = 35067,
      ["7"] = 15,
      ["8"] = 35071,
      ["9"] = 35007,
      
      ["A"] = 35023,
      ["B"] = 10815,
      ["C"] = 243,
      ["D"] = 8767,
      ["E"] = 35059,
      ["F"] = 35011,
      ["G"] = 2299,
      ["H"] = 35020,
      ["I"] = 8755,
      ["J"] = 124,
      ["K"] = 38080,
      ["L"] = 240,
      ["M"] = 1484,
      ["N"] = 4556,
      ["O"] = 255,
      ["P"] = 35015,
      ["Q"] = 4351,
      ["R"] = 39111,
      ["S"] = 35003,
      ["T"] = 8707,
      ["U"] = 252,
      ["V"] = 17600,
      ["W"] = 20684,
      ["X"] = 21760,
      ["Y"] = 43140,
      ["Z"] = 17459,
    }
    
    local nullCols = {
      [0] = 0,
      [1] = 0,
      [2] = 0,
      [3] = 0,
      [4] = 0,
      [5] = 0,
      [6] = 0,
      [7] = 0,
      [8] = 0,
      [9] = 0,
      [10] = 0,
      [11] = 0,
      [12] = 0,
      [13] = 0,
      [14] = 0,
      [15] = 0,
    }
    
    function resetDisplay()
      for k,v in pairs(redstoneAddresses) do
        if(#v["validSides"] > 5) then
          print("Address " .. v["address"] .. " Error: You may only have 5 sides!")
        end
        
        if(component.list(v["address"]) == nil) then
          print("Address " .. v["address"] .. " Error: Address is not available!")
        end
        
        for key, side in pairs(v["validSides"]) do
          if(sides[side] == nil) then
            print("Side (".. key ..") " .. side .. " Error: The specified side is invalid!")
          else
            print("Clearing ("..v["address"]..") Side: " .. sides[side] .. "")
            component.invoke(v["address"], "setBundledOutput", side, nullCols)
          end
        end
      end
    end
    
    function displaySegment(address, side, value)
      local setCols = {}   
      for n = 0, 15, 1 do
        setCols[n] = bit32.band(bit32.rshift(value, n), 0x1) * 255
      end
      
      if(address == nil) then
        print("No address given!")
        return
      end
      if(component.list(address) == nil) then
        print("Unavailable address found: " .. address)
        return
      end
      component.invoke(address, "setBundledOutput", side, setCols)
    end
    
    function splitSegment(str)
      if(type(str) == number) then
        str = tostring(str)
      end
      
      local sID = 1
      for _, add in pairs(redstoneAddresses) do
        for _, side in pairs(add["validSides"]) do
          local c = str:sub(sID, sID)
          if(c ~= nil and c ~= "" and c ~= " ") then
            if(segments[c] ~= nil) then
              displaySegment(add["address"], side, segments[c])
            else
              print(add["address"] .. " (" .. sides[side] .. ") received unknown character '" .. c .. "'")
            end
          elseif(c == " ") then
            -- skip whitespace
          else
            return
          end
          sID = sID + 1
        end
      end
    end
    
    function marqueeDisplay(str)
      str = str .. "  "
      
      splitSegment(str)
      os.sleep(1)
      
      while true do
        resetDisplay()
        
        local c = str:sub(1, 1)
        str = str:sub(2, #str) .. c
        splitSegment(str)
        
        os.sleep(1)
      end
    end
    
    -------------------------------------------------------------------------------------
    ------------------------------------ Program start ----------------------------------
    -------------------------------------------------------------------------------------
    resetDisplay()
    
    ----- Examples:
    --splitSegment("ABCDEFGHI")
    --marqueeDisplay("HELLO")
    



    [Thanks to @_CURSOR_ for the bit shifting part!]

  4. i'm setting the value to 1 maybe thats too low...

    from the docs:

    "Note that for mods such as ProjectRed, low values (such as the vanilla maximum of 15) may not function as expected for simple on/off values (opening a door for example), because they have a larger value range. You may need to use a higher value, such as 255."[/size]

     

    try this inside the function instead:

     

    component.redstone.setBundledOutput(side, n, bit32.band(bit32.rshift(value, n), 0x1) * 255);
    
    Sorry i dont have the game in this machine to test it
     

    (I didn't thought about the 255 problem.. Thanks.)

    Holy cow. xD It works! But.. Same as the tabling. It's so so so so so so so slow..... It takes ~3-4 seconds to display. And with a energy cell that is updating every tick.. It would hogg up displaying. Hmm I'll think about something! thanks

     

    EDIT:

    BLAZING FAST

    http://i.imgur.com/MofzliT.gifv

    component = require("component")
    colors = require("colors")
    sides = require("sides")
    
    rs = component.redstone
    
    local segments = {
      ["0"] = 17663,
      ["1"] = 12,
      ["2"] = 34935,
      ["3"] = 34879,
      ["4"] = 34956,
      ["5"] = 37043,
      ["6"] = 35067,
      ["7"] = 15,
      ["8"] = 35071,
      ["9"] = 35007,
      
      ["A"] = 35023,
      ["B"] = 10815,
      ["C"] = 243,
      ["D"] = 8767,
      ["E"] = 35059,
      ["F"] = 35011,
      ["G"] = 2299,
      ["H"] = 35020,
      ["I"] = 8755,
      ["J"] = 124,
      ["K"] = 38080,
      ["L"] = 240,
      ["M"] = 1484,
      ["N"] = 4556,
      ["O"] = 255,
      ["P"] = 35015,
      ["Q"] = 4351,
      ["R"] = 39111,
      ["S"] = 35003,
      ["T"] = 8707,
      ["U"] = 252,
      ["V"] = 17600,
      ["W"] = 20684,
      ["X"] = 21760,
      ["Y"] = 43140,
      ["Z"] = 17459,
    }
    
    local nullCols = {}
    for n=0, 15 do
      nullCols[n] = 0
    end
    rs.setBundledOutput(sides.right, nullCols)
    
    function displaySegment(side, value)
       local setCols = {}   
       for n = 0, 15, 1 do
          setCols[n] = bit32.band(bit32.rshift(value, n), 0x1) * 255
       end
       rs.setBundledOutput(side, setCols)
    end
    
    function splitSegment(str)
      if(type(str) == number) then
        str = tostring(str)
      end
      for i = 1, #str do
        rs.setBundledOutput(sides.right, nullCols)
        local c = str:sub(i,i)
        if(c ~= nil) then
          displaySegment(sides.right, segments[c])
        end
        os.sleep(0.5)
      end
    end
    
    os.sleep(2)
    splitSegment("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
    
  5. L3tLuin.png

     

    Nope..

     

    It doesn't even turn on the bundled cable (Individual colors).

     

    Honestly I'm at a point where I have no clue anymore.

     

    There's no possible (+ fast) solution to display an integer in the computer to a segment display.

    With fast I mean ye sure. I could do something like 1 = blue on, red on, yellow off etc. but for a RF display (8.000.000 RF) that take ages to code, and ages to display.

    The segmented display can display values up to 65535 (4 displays as slaves and 1 master). Where this is the logic behind it:

    white = 1

    orange = 2

    magenta = 4

    light blue = 8

    etc.

     

    And you can do something like:

    white on + orange on = 3

     

    But.. I don't seem to know a possible solution to do:

    8000000 = light blue, orange, red etc.

    Because tabling all possible values would be inefficient and dumb.

     

    The easiest thing I imagine would be a BCD...

  6. Hey, I'm kind of confused. After I coded a little program for Integrated Circuits (A mod) to display Letters on a 7-Segment Display, I've discovered that project red has a SISD (Sixteen segment display). So I search and found this page:
     
    http://ftb.gamepedia.com/Segment_Display
    Which says:

    Furthermore there is a compatibility to ComputerCraft and OpenComputers to easyly display specific characters on the Segment Display in SISD mode.

    The 16 bars on the SISD-Segement Display allow 216 (65536) combination options. With the computers the player can send via Bundled Cable a self-chosen combination to the display, which then displays this combination. Furthermore, a generated restone signal from the cable can be read and the corresponding number can be found.

    The following table shows the combination numbers of the Latin alphabet and Arabic numbers:


    So I tried:

    component.redstone.setBundledOutput(35023)
    component.redstone.setBundledOutput(sides.right, 35023)
    component.redstone.setBundledOutput(sides.right, colors.white, 35023)
    

    which doesn't work. (1: Invalid side, 2: Invalid color, 3: Turns on the white cable).

     

    My "old" code for the 7-segment display worked good. But this is giving me a headache right now..

     

    So I started to look into the source of opencomputers and the integration of projectred, and found... Nothing. Just the integration of the screwdriver.

     

    My question:

    Is there an implementation for this or not?

    Or does anybody have an idea how to "convert" a decimal like 800000 to unsigned short (1,2,4,8,16....), binary (0010), or any other usable form for Integrated Circuits 7-Segment Display or RedPowers SISD?

×
×
  • Create New...

Important Information

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