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

    • Lizzy Trickster

      Latest Stable OpenComputers Version   11/26/16

      The latest released version of OpenComputers is version 1.7 for MC 1.7.10, 1.8.9, 1.9.4, 1.10.2, 1.11.2 & 1.12.1. See more information here! Beta/Dev builds can be found at the Jenkins Build Server (ci.cil.li)

Dustpuppy

Members
  • Content count

    75
  • Joined

  • Last visited

  • Days Won

    13

Dustpuppy last won the day on August 17

Dustpuppy had the most liked content!

About Dustpuppy

  • Rank
    Junior Member

Recent Profile Visitors

593 profile views
  1. Print server and client for openprinter

    Btw. the functions for the virtuel network printer are the same, then for a normal openprinter. Look here
  2. While i was testing how to make the print server management for my gui, i wrote print server and a client, that will not need the gui. All you need is gamax92s vcomponent lib for the client. Install it over oppm, or get it here https://github.com/OpenPrograms/gamax92-Programs/tree/master/vcomponent Start the server first, then the client(s). Server has no queue. It will use the openprinter when data comming in. Timing is by your self. The code for the server. Start it with parameter "silent" to get it to background. local component = require("component") local event = require("event") local args = { ... } local silent = false if #args > 0 then if args[1] == "silent" then silent = true end end if not component.isAvailable("openprinter") then io.stderr:write("This program requires openprinter to run.") return end local printer = component.openprinter if not component.isAvailable("modem") then io.stderr:write("This program requires a modem to run.") return end local modem = component.modem local printServerPort = 9100 modem.open(printServerPort) local function modemCallback(_, _, from, port, distance, ...) local message = {...} if silent == false then if message[2] then print(from .. " " .. tostring(port) .. " " .. message[1] .. " " .. message[2]) else print(from .. " " .. tostring(port) .. " " .. message[1]) end end if port == printServerPort then if message[1] == "GET PRINTER" then addr = printer.address modem.send(from, printServerPort, addr) elseif message[1] == "WRITELN" then addr = message[2] if addr == printer.address then str = message[3] col = message[4] al = message[5] printer.writeln(str, col, al) end elseif message[1] == "SETTITLE" then addr = message[2] if addr == printer.address then str = message[3] printer.setTitle(str) end elseif message[1] == "GETPAPERLEVEL" then addr = message[2] if addr == printer.address then modem.send(from, printServerPort, printer.getPaperLevel()) end elseif message[1] == "GETCOLORINKLEVEL" then addr = message[2] if addr == printer.address then modem.send(from, printServerPort, printer.getColorInkLevel()) end elseif message[1] == "GETBLACKINKLEVEL" then addr = message[2] if addr == printer.address then modem.send(from, printServerPort, printer.getBlackInkLevel()) end elseif message[1] == "CLEAR" then addr = message[2] if addr == printer.address then printer.clear() end elseif message[1] == "PRINT" then addr = message[2] if addr == printer.address then printer.print() end elseif message[1] == "PRINTTAG" then addr = message[2] if addr == printer.address then str = message[3] printer.printTag(str) end end end end event.listen("modem_message", modemCallback) if silent == false then while true do os.sleep(0) end end and the code for the client. local component = require("component") local ser = require("serialization") local vcomp = require("vcomponent") local modem = component.modem local event = require("event") local printServerPort = 9100 modem.open(printServerPort) local netprinter = {} local printerList = {} function getPrinterAddress(addr) for i = 1, #printerList do if printerList[i].server == addr then -- print(printerList[i].server .. "->" .. printerList[i].printerAddress) return printerList[i].printerAddress end end end local netprinterproxy = {} local netprinterdocs = {} function netprinter.register(addr) netprinterproxy.printerAddress = function() return getPrinterAddress(addr) end netprinterproxy.writeln = function(str, col, al) modem.send(addr, printServerPort, "WRITELN", getPrinterAddress(addr), str, col, al) end netprinterproxy.setTitle = function(str) modem.send(addr, printServerPort, "SETTITLE", getPrinterAddress(addr), str) end netprinterproxy.print = function(str) modem.send(addr, printServerPort, "PRINT", getPrinterAddress(addr)) end netprinterproxy.clear = function(str) modem.send(addr, printServerPort, "CLEAR", getPrinterAddress(addr)) end netprinterproxy.getPaperLevel = function() modem.send(addr, printServerPort, "GETPAPERLEVEL", getPrinterAddress(addr)) local ev, _, from, port, distance, message = event.pull(0.5,"modem_message") if ev then if message then return message end end end netprinterproxy.getColorInkLevel = function() modem.send(addr, printServerPort, "GETCOLORINKLEVEL", getPrinterAddress(addr)) local ev, _, from, port, distance, message = event.pull(0.5,"modem_message") if ev then if message then return message end end end netprinterproxy.getBlackInkLevel = function() modem.send(addr, printServerPort, "GETBLACKINKLEVEL", getPrinterAddress(addr)) local ev, _, from, port, distance, message = event.pull(0.5,"modem_message") if ev then if message then return message end end end netprinterproxy.printTag = function(str) modem.send(addr, printServerPort, "PRINTTAG", getPrinterAddress(addr)) end vcomp.register(addr, "nprinter", netprinterproxy, netprinterdocs) end function netprinter.getPrinterList() printerList = {} modem.broadcast(printServerPort, "GET PRINTER") for i = 1, 20 do local ev, _, from, port, distance, message = event.pull(0,"modem_message") if ev then local tmpTable = {} tmpTable.server = from if message then tmpTable.printerAddress = message table.insert(printerList, tmpTable) netprinter.register(from) end end end return printerList end netprinter.getPrinterList() return netprinter a little test program local component = require("component") local netprinter = require("netprinter") local ser = require("serialization") p = component.nprinter p.clear() p.setTitle("test page") p.writeln("hallo") p.print() print("Paper : " .. p.getPaperLevel()) print("Black : " .. p.getBlackInkLevel()) print("Color : " .. p.getColorInkLevel())
  3. New ultimate Gui

    First release out. See main posting.
  4. How to set modem's address

    component.get(address: string[, componentType: string]): string | (nil, string) Tries to resolve an abbreviated address to a full address. Returns the full address on success, or nil and an error message otherwise. Optionally filters by component type.
  5. New ultimate Gui

    Give me time. In my point of view it's not finished yet. But if you want, you can port it to Plan9k. Would be great. Don't forget, that i change allways things and specialy add functions to the differend libs, that i am missing during making programs for it. When it is finished, i will have a look to move it into oppm.
  6. New ultimate Gui

    Getting forward :-) Some Monitor programs done(Memory and Energy as plugins. Working on filesystem monitor now). Getting on with the terminal window. Insert a system menu. Changed some internal stuff.
  7. New ultimate Gui

    Found a little error in the printserver driver. Have uploaded a new zip archive with correct version. If you don't want to test it your self, watch this video.
  8. New ultimate Gui

    And the documentation is also not up to date and i am busy, 2 pregnant horses outside (one is nearly finished) and a lot of work on the visual editor and...and...WHAT THE F****?!?! I need much more time.
  9. New ultimate Gui

    At the moment i am working on the gui, to get it faster in screen redraw and background buffering. I've packed my full working environment into an archive. http://carr-ireland.com/mc/all.zip Unzip it to the home directory of the oc computer and start test.lua. There are 2 frame work files. program_frame.lua is how to make a program. plugin_framework.lua is for making a symbol program. In test.lua you can see, how to insert them. After first start of test.lua open the user manager and add your self as user. Then delete line 31 ( wm.setUserName("") ) and uncomment user.login() in line 30 and restart the computer and the test.lua to get the multiuser environment running. Exit is not working at the moment, but i fix this after getting other things done. Before i forget. There's a bug in the print manager. Don't remove a printer, after add one. Close and restart the print manager first. Sometimes it hangs. And you need a modem in the computer.
  10. New ultimate Gui

    I think, i am getting crazy. Worked a bit on the gui system. It will come much easier to make (let's call them) programs for it. The gui it self is a multi user windows system with driver integration and some nice features. But still can be used as stand alone windows based gui. Multi user driver working to register user to the computer and the gui with differend level. Printer management for openprinter with print queue. Start menu. Just make you gui based programs and add them to the menu. Network driver with own messaging system Drivers will be registered to the gui. Use only, what you need. Or use it just as a simple gui, with no driver, no start menu and no managment programs.
  11. OETF #8 - Allocated Network Card Port Numbers

    And me again. I take also port 148 for internal usage of my gui, that is more and more getting a managed window system and port 4662 for short messages. Think, that i will need more, as longer i am coding on the gui
  12. OETF #8 - Allocated Network Card Port Numbers

    I take 9100 for net print service
  13. New ultimate Gui

    Print server is working :-)
  14. New ultimate Gui

    It will come. But not for making full program as source. More for making a single window, you can then put into your program. But first i finish the print manager for openprinters.
  15. New ultimate Gui

    Updated. First alpha release online now.
×