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

EderV

Members
  • Content Count

    18
  • Joined

  • Last visited

Posts posted by EderV

  1. On 7/28/2019 at 12:09 AM, Nexarius said:

    I've had that problem too so I made a small program to automatically fix it. (It works for any screen size)

    
    pastebin run B9Enk6qp

    Just write this line and thats it. :)

     

    It works with Tier 1, 2 and 3 screens.

    spacer.png

    If you want to code a program on your own to monitor your railcraft tanks then you can stop reading here but if you just want to have a program thats already finished for doing it then you can try out mine.

     

    Nice solution! Can you explain how did you do that?? I'm refering to the resizeable screen haha

  2. On 7/24/2019 at 9:52 PM, Molinko said:

    So there are two ways to do this. The first is a little more complex. You can simply have two screens and one gpu and switch which screen the gpu is bound to and draw. The second and probably better way is to have two gpus, one for each screen.

    
    -- # 2 screens 1 gpu
    local component = require "component"
    local prim_screen = component.gpu.getScreen()
    local sec_screen
    
    -- # get the second(non primary or unbound) screen address from the dev fs
    local f = assert(io.open "/dev/components/by-type/screen/1/address")
    sec_screen = f:read "*a" -- # read the file which has the component address
    f:close() -- # clean your room
    
    -- # the goods
    print "this is one screen 1"
    compnent.gpu.bind(sec_screen)
    print "gpu is bound to screen 2 now"
    component.gpu.bind(prim_screen)
    print "back to screen 1"
    
    -- # 2 gpus
    local component = require "component"
    local gpu1 = component.gpu
    local gpu2_address, scr2_address
    
    for address, ctype in component.list() do
      if ctype == 'gpu' and address ~= gpu1.address then
        gpu2_address = address
      elseif ctype == 'screen' and address ~= gpu1.getScreen() then
        scr2_address = address
      end
      if gpu2_address and scr2_address then break end -- # quit early if we have the second gpu & screen pair
    end
    
    local gpu2 = component.proxy(gpu2_address)
    gpu2.bind(scr2_address) -- # bind the second screen to the second gpu
    
    gpu1.set(3, 3, "this is on screen 1")
    gpu2.set(3, 3, "this is on screen 2")

    Hope this gets you started. Feel free to ask more if you like :)

    Thank you :) I'll give a try 

    On 7/25/2019 at 6:26 AM, Fingercomp said:

    TL;DR: set the resolution to 159×28.

    Displays automatically scale the content to fit the screen's inner area. If you decrease the resolution height, the display area will occupy more horizontal space.

    I'll assume that your screen is 8×3. The aspect ratio of the screen's inner area is (2 × (8×16 - 4.5)) : (3×16 - 4.5) = 494×87. The "- 4.5" terms are the screen borders, and the width is doubled because the cell width is half its height. If you set the resolution proportional to this ratio, it will fill the whole screen. Of course, you can't do this, as the maximum resolution is 160×50. So we have to compromise and choose the resolution that fits the screen the best.

    
    local function round(num)
      local integer, frac = math.modf(num)
    
      if frac >= 0.5 then
        integer = integer + 1
      end
    
      return integer
    end
    
    local data = {}
    
    for w = 1, 160, 1 do
      local h = math.max(math.min(round(w * 87 / 494), 160 * 50 / w, 160), 1)
      local area = w * h
      local delta = (w / h) - 494 / 87
    
      table.insert(data, {delta, area, ("%d×%d"):format(w, h)})
    end
    
    table.sort(data, function(lhs, rhs)
      return lhs[1] < rhs[1]
    end)
    
    local f = io.open("./data", "w")
    
    for k, v in ipairs(data) do
      f:write(("%.6f %d %s\n"):format(v[1], v[2], v[3]))
    end
    
    f:close()

    The above code creates an array and fills it with 160 possible resolutions by choosing a width and calculating the height such that the aspect ratio is the closest to what we're trying to achieve (494:87). Then it writes the data to a file so that we can plot it. Here's what we get:

    spacer.png

    Now it's clear that the best resolution is 159×28. Its aspect ratio differs from 494/87 by ~0.000411, which is really small. Let's go ahead and calculate the thickness of the black area.

    1. Let dw, dh be the dimensions of the display area, and iw, ih the dimensions of the inner area.
    2. dw/dh = 159/28; iw/ih = 494/87.
    3. 159/28 > 494/87, so the display area height is less than the screen's inner area height. Therefore, the width of the black area is dw = iw.
    4. The height equals 0.5 × (ih - dh) = 0.5 × (87/494 × iw - 28/159 × dw) = 0.5 × iw × (87/494 - 28/159) = 0.5 × 494/87 × ih × (87/494 - 28/159) = 1/27666 × ih.

    In other words, the height of the black area is 1/27666th of the whole inner area height, which is negligible.

    Curious and usefull explanation, thank you :)!

  3. Im trying to develop a tankAPI to monitor my railcraft tanks.

    I want to put in the screen all tanks together so I need to create an ultra wide screen to show all but I don't know how to print graphics in the whole ultra wide screen

    As you can see in the picture, I can only display colors in that green area.

    Can someone help me? 

    Thanks

    2019-07-23_20.08.58.png

  4. 16 hours ago, Molinko said:

    It's hard to tell just from what you've described but it sounds like the computer doesn't have an energy source...

    The computer is conected to a creative cell from thermal expansion.

    If you want, we can talk in a private chat to fix my problem. Or can you send me a construccion and a lua program to run the ticket machine?

    THX

  5. On 3/9/2019 at 12:20 AM, payonel said:

    fixed in our next dev build: https://ci.cil.li/job/OpenComputers-MC1.12/154/

    please test a bunch. there are a LOT of things you can do with robot.use, and it is difficult to test everything

    it will be helpful to know if this looks good for everything so we can push out a new release sooner

    Okay thanks.

    I'm going to test robot.use() in that new version and if I find new bugs I will post it here

  6. Just now, Molinko said:

    Have you tried it in the tool slot  and in an inventory slot(while selected)? I'm gonna try it and get back to you..

    Try it and tell if it works but I think there is a bug. I tried the same comand (robot.use()) in opencomputers v1.7.2.67 and works perfectly but with the version 1.7.4.158 doesn't work. 

  7. I have a robot with a water bucket in the tool slot and I want to place water under thr robot. Under the robot there is space to place water. 

    I tryed robot.use(sides.down) robot.useDown() robot.swing(sides.down) robot.swingDwon() robot.place() ... but nothing happends, the function returns false every time and I don't know why.

    What am I doing wrong?

    Thanks

  8. 22 minutes ago, Molinko said:

    I'm not sure exactly but the leading slash may be throwing you off..

    Follow my instructions from your home dir so we can be sure to replicate what I just tested.

    On source computer:

    /home # cp ./main.lua /mnt/38d/test.lua

    /home # ls /mnt/38d  #this is to check we're not crazy and the file has been copied to the floppy

    On robot:

    /home # cp /mnt/38d/test.lua ./main.lua

    /home # ls . #list the current dir to check that we have copied our file successfully

     

    Run man cp to get a better grip on what the cp command can do.

    Many thanks, now works :)

    You will see me more in this forum haha

  9. 27 minutes ago, Molinko said:

    Insert the floppy into a drive then in the Shell run ls /mnt to find your floppy. Let's say it was /mnt/5ae.

    Run cp my_file /mnt/5ae/my_file

    I may be rusty so if you need help on shell programs run the man program with the name of a program for usage instructions.

    man cp

    I wrote this in my computer: (38d is my floppy I think, bcos I tried to run the ls comand whit the floppy and without it and 38d it's the number that appear and disappear)

    /mnt # cp main.lua /38d/test.lua  (And the computer didn't show an error so okay)

     

    Then I went to my robot with the floppy and I wrote this

    /mnt # cp /38d/test.lua testfloppy.lua

     

    And the robot said: No such file or directory

     

    What am I doing wrong?

     

  10. Hi,

    I'm new in this mod. I'm trying to program robots but the editor it's very small and I prefer to develop my programs in a computer with the shedit editor.  I know that there is a way to copy the programs that I've deloped into a floppydisk and then copy that program from the floppydisk to my robot but I tried a few comands and I can't do that.

    What comands should I use?

    What tipe of floppydisk I need to use?

     

    Thanks

  11. 5 minutes ago, LoganDark said:

    That's certainly not right. It says right in the usage "pastebin get <id> <file>". Are you sure your install isn't messed up?

    I don't know, I'm pretty new with this mod of Open Computer. I just copy paste this in a simple computer.

    Should I've done something before trying to install this?

×
×
  • Create New...

Important Information

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