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

meigrafd

Members
  • Content Count

    29
  • Joined

  • Last visited

Posts posted by meigrafd

  1. I wrote a topic before but decided to put all questions into one topic.

    Next time hit the EDIT button on the bottom-left of your Post and change everything you need.. That whould be better.

    1. How do I delete a program? What do I have to type in? I tried "delete [filename]" and "remove [filename]" but I can't figure it out.

     

    2. How do I go back to other folders/directories/cd I know how to get into them with "cd [directory]" but I don't know how to go back without rebooting.

    As i posted in your other Thread:

    Its the same behavior like with Unix / Linux:

     

    cd bin
    ls
    cd ..
    
    cd lib
    cd /

    In /bin/ you find all Programs you can run.

    For a general help type

    help
    For a Help from the Program type E.g.:
    rm
     

    3. For some reason when I make a program in a mounted hdd it makes a copy of it in the main system programs. Is that normal or just me messing something up?

    Please post a Screenshot.

  2. I've coded a simple methode with ComputerCraft to export all Items with a damage value of >= 6 : http://pastebin.com/NbC59sfW

     

    --[[
    
     For: ComputerCraft
    
     If the Nuclear Reactor overheats the Robot drops not only depleted Uran Rods into the Trash...
     If your using Applied Energistics (like me) for Supporting the Robot you will have much used Rods after some Days
     which will blow you storages... 
     And here comes this Script in place:
     Extract all used Uran Rods from AE System and split them into a Chest. This Chest can than be linked to another AE or whatever..
     
     Setup:
     - Place an ME_Interface_Block to a Computer.
     - Connect the ME_Interface with your AE Network and to another side of the ME_Interface place a Chest.
    
    --]]
    
    
    -- Direction from ME_Interface to Chest. Only valid: north, south, west, east, up, down
    directionChest = "NORTH"
    
    -- Side of ME_Interface. Only valid sides: left, right, back, front, up, bottom
    meInterfaceSide = "back"
    
    -- Export all Items with a minimum or equal damage value of ...
    local minDamage = 6
    
    local CheckEvery = 15  -- sec.
    
    
    --[[ Internal values - DONT change! ]]
    
    
    local meInterface = peripheral.wrap(meInterfaceSide)
    
    local version = 0.1
    local Count = 0
    
    function exportDamagedItems()
        for number,item in pairs(itemList) do
            local ID = item.fingerprint.id
            local DMG = item.fingerprint.dmg
            if (DMG >= minDamage) then
                Count = Count + 1
                meInterface.exportItem(item.fingerprint, directionChest, 1, 0)
                print("("..Count..") Exported "..ID.." with dmg: "..DMG)
            end
        end
    end
    
    
    
    ---[[ Main Program ]]
    
    
    -- FIXME: only export if enough space in chest is free
    
    while true do
        itemList = meInterface.getAvailableItems()
        exportDamagedItems()
        os.sleep(CheckEvery)
    end
    
    
    --
    -- EOF
    --
    

     

    But with OpenComputers i still not have a working way :(

  3. Do the damaged item in the database and the damaged item in the ME Network have the same damage value?

    No. As i sayd: The Items have different damage values..

     

    Since component.me_exportbus.exportIntoSlot needs an entry from a Database Upgrade, the only solution I see right now is to put every possible damage value in the database, though I'm not sure if you can do that since I don't know IC2 :(

    Well i can only add max. 81 entries to a Database but i have much more items with different damage values in my ME System (Uranium Rods are stackable but i have ~100 single stacks in the ME Network)

    The only idea i had was something with the inventory_controller or geolyzer but i dont know if the ME_Network can get handled like an Inventory? didnt tested that yet..

    I need a way to add something to Database without extra peripheral.. something where i can directly access the Database and store/erase entries.... Does anyone know such methode?

  4. What is if you change 'binary' write-mode to normal? -> "w" instead of "wb"

    And does the directory 'bankAccounts/' exists?

    Add something like

    if not fs.isDir("bankAccounts") then
        fs.makeDir("bankAccounts")
    end
    before your loop..

    And btw: instead of using ev.pull("modem_message") inside of a loop you should use event.listen("modem_message", <yourfunction>) but after that you still need something so script doesnt quit -> a loop ;)

    E.g.:

    if not fs.isDir("bankAccounts") then
      fs.makeDir("bankAccounts")
    end
    
    function messageReceived(event, localAddress, remoteAddress, port, senderDistance, message, nick, balance)
      nick = nick or nil
      balance = balance or nil
      if message == "getInfo" then
        ...
      elseif message == "setInfo" then
        local fil = io.open("bankAccounts/"..nick, "w")
        fil:write(balance)
        fil:close()
        net.send(remoteAddress, 15, "done it")
      end
    end
    event.listen("modem_message", messageReceived)
    
    while true do
      os.sleep(1)
    end
  5. If you're sending messages wirelessly, and sometimes they fail to arrive, could it be that your wireless signal strength on the sender is too low?

    It was set to default and its max: 400

    actually i have set it to 200 but on default the problem was there too..

     

    I'm just not sure if making a command queue is necessary. If all you're sending is a command to turn off a reactor, then it shouldn't matter if that gets executed multiple times, since you can't turn off an already off thing. The extra "off" signals would just be ignored.

    That was just an example - i have more commands as only "off" :)

     

    Another example is, that the computer always sends a "ping" via broadcast and if a new client (robot) is in network it should get added to a GUI on computer.. but also this "pong" doesnt arrive allways but the robot doesnt repeats again...

    Maybe it get clear if you have a look to the code:

    Computer: http://pastebin.com/hfjT7e8s ...importend code for this begins @line 199

    Robot: http://pastebin.com/FT4UuWdX ...importend code for this begins @line 543

     

    Ooh, I just thought of something. What if you sent a random number as another parameter with the message,(i.e, modem.send(<address>,<port>,"Message",<random #>)) generated every time you click the button to start the command-sending loop? Then, the receiver could store that random number, and if the next command contains the same number, it's a duplicate, and can ignore it. That should work. I believe there's a library called math that has a random number generator.

    Mh. You mean that the Client saves the last "random-key" and rechecks it on next received command? Oke... But what is with commands where the Computer requests stuff from Client, but that will not arrive? :P

     

    PS. Making conversation, I noticed that you're in Germany. Where are you from in Germany? I'm personally from Texas in the US.

    'Niedersachsen' ;)
  6. Hm. The Problem is that i want to send Commands which the 'receiver' execute. It would be bad if the 'receiver' execute that Command more than one time only coz the 'sender' didnt know that his command got arrived...

    As example:

    I have a Computer with touch-screen. Now i click on a "OFF" button to tell Robot#1 to turn reactor off. The problem now is that this command not always arrives and i need to click it again...

    My idea now was to code something like a queue - a table with 'destinationAddress' and 'command'

    local commandQueue = {}
    remoteAddress = 'abcde-fghi...'
    commandQueue.remoteAddress = 'POWER:OFF'
    And having a function which repeat processes this queue..

    local proceedCommandQueue = function()
        if (tableLength(commandQueue) > 0) then
            for remoteAddress,command in pairs(commandQueue) do
                wlan.send(remoteAddress, wlanPort, command)
            end
        end
    end
    event.timer(0.5, proceedCommandQueue)
    
    But now i have brain-lagg and dont know how to verify this on client-side (receiver) or even how i must handle it by the computer (sender) to be sure that command was executed and can get delete from commandQueue
  7. Is there a way to verify that a modem_message was received?

    As i know a send() doesnt means that the message will 100% arrive - even like UDP.

    I want to send Commands over Wireless Network but need to be sure that it really arrive and if not to repeat sending it... like a command-queue or so..

    An example code whould be helpful ;)

    Thanks!

  8. Hi.

     

    Im searching for a methode to export damaged items from an AE2 Network. The Items have different damage values..

     

     

    My situation:

     

    I have several Nuclear Reactor's which gets controlled by Robots. The Robot's sometimes drops not fully used Uranium Rods back into my AE2 Network to prevent explosion..

    Im using a Quantum Network Bridge over 2 dimensions and have no ME_Controller where i want to export the damaged Items, so im using following Setup:

     

    - Adapter connected to a Computer.

    - ME_Interface placed on Adapter and connected to my AE2 Network.

    - right-clicked an Database-Upgrade in my hand and added an already used " IC2:reactorUraniumQuad " item. After that i put the Database into the Adapter.

    - ME_ExportBus connected with Adapter and placed a Chest in front of it.

     

    Now i have tried the following Code:

     

    local component = require('component')
    local side = require('sides')
    local meExportBus = component.getPrimary('me_exportbus')
    local meInterfaceBus = component.getPrimary('me_interface')
    local db = component.database
    
    local exportBusSide
    for i = 0, 5 do
        if select(2, meExportBus.getConfiguration(i)) ~= "no export bus" then
            exportBusSide = i
            break
        end
    end
    
    local entryNum = {}
    for i = 1, 81 do
        local item = db.get(i)
        if item then
            entryNum[item.name] = i
        end
    end
    
    local itemList = meInterfaceBus.getAvailableItems()
     
    for k,v in pairs(itemList) do
        for key,value in pairs(v.fingerprint) do
            if (key == "dmg") and (value >= 10) then
                print("Exporting ".. v.fingerprint.id .." with dmg: "..value)
                meExportBus.setConfiguration(exportBusSide, 1, db.address, entryNum[v.fingerprint.id])
                meExportBus.exportIntoSlot(exportBusSide, 1)
            end
        end
    end
    
     

     

    My Problem is now that this doesnt work :( It outputs the print line but it doesnt export any Item

     

    What am i doing wrong?

    Thanks!

  9. I'm pretty sure that right clicking or shift+rightclicking the upgrade itself opens a gui that you can manipulate.

     

    I dont get it ... Where you mean should i right-(shift)click the upgrade ?

     

     

    //EDIT: Now i read it in the in-game-manual: right-clicking with the database in hand.

  10. I have a strange behavior with an Table ...

     

    I have a Script which listens for 'modem_message' events and to get track about 'Clients' i have a same named Table where i want to add each client-robot to it...

     

    The Code looks reduced like:

     

    local component = require("component")
    local event = require("event")
    local wlan = component.modem
    
    local wlanPort = 7331
    wlan.open(wlanPort)
    local Clients = {}
    
    function tableLength(T)
        local count = 0
        for k,v in pairs(T) do count = count + 1 end
        return count
    end
    
    function addClient(remoteAddress)
        local rcount = (tableLength(Clients) + 1)
        Clients[rcount] = remoteAddress
        print("Added new Client #"..rcount)
    end
    
    function messageReceived(event, localAddress, remoteAddress, port, senderDistance, message)
        addClient(remoteAddress)
    end
    
    event.listen("modem_message", messageReceived)
    
    while true do
        os.sleep(1)
    end

    Real code: http://pastebin.com/hfjT7e8s

     

    The Problem is that 'rcount' doesnt get expanded. Its always same

     

     

    It receives a modem_message, so the event works - thats tested and is not the Problem. Also i know that #Clients can return the table length too but i have a good reason why i did it not that way (#tbl only works for numerical keys)

    What am i doing wrong?  :unsure:

    //EDIT: the reduced code works... mmh :( why not the real?

  11. Well my english is bad so i hope its oke when i explain it in german? (coz your also from Germany)

     

     

    Ich hab einen Computer welcher als Wireless-Server fungiert und eine GUI bereitstellt.. Der Server pingt regelmäßig auf einem bestimmten wlan-Port via broadcast, also an "alle".

     

    Dann starte ich einen Client, welcher den PING empfängt, sich die serverAddress merkt und einen PONG mit weiteren Informationen zurück schickt. (sobald er die serverAddress gespeichert hat antwortet er nicht mehr auf den PING).

     

    Der Server soll dann eine weitere Zeile zur GUI hinzufügen, mit ON/OFF Buttons. Dies ist der dynamische Part, damit ich mal 2, mal 4, oder 9 Clients haben kann - also nicht festgelegt, um nicht jedes mal den Code anpassen zu müssen..

     

    Um die Buttons bedienen zu können muss man sich ja die Koordinaten merken - zumindest wenn man das selbst, ohne deine API, schreiben würde... Dazu wollte ich mir die Zeile merken indem ich 'reactorTXT' als Array (oder Table) anlege und die Zeilennummer dort als Key setze -> 'rcount'.

     

    Wäre sowas mit deiner API möglich?

  12. Btw is it possible to generate lable / lablebox 's dynamic ?

     

    Something like:

    reactorTXT = {}
    reactorTXT[rcount] = gui.label(2,rcount,30,2,101,rgb.orange,rgb.black,nil,nil,txt)

    If i try that ill get an error 'not enough memory' :(

×
×
  • Create New...

Important Information

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