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

tromp_

Members
  • Content Count

    4
  • Joined

  • Last visited

Posts posted by tromp_

  1. On 12/24/2021 at 9:53 PM, mattia said:

    For read the user input you must use io.read().

    Read the io guide Input and Output Facilities for more details.

    I dont think the io library is avaliable when writing your own operating system based of https://ocdoc.cil.li/tutorial:custom_oses 
     

    I suspect you will need to create your own implementation that looks at keyboard and mouse events using computer.pullSignal().

    I'd recommend creating your own implementation of the event library before you really worry about user input. I havent really gotten far enough into the development of my own OS to really help you through experience here but thats my speculation at least

  2. would you be able to clarify what you mean? Do you mean duplicate what is drawn on one screen to other screens or have a second seperate screen that can 'extend' the first one?

  3. On 6/16/2019 at 5:03 PM, howardivanbaltazar said:

    I would like to execute both if statements in the same time so that it can light up both redstone lamp at the same time

    I would like to execute both if statements in the same time so that it can light up both redstone lamp at the same time

    What you can do is perform all the calculations and then after computing the desired redstone states, you can then update all the states
     

    local states = {}
    
    -- Compute all your conditions and store the resulting state for future use
    if states.x < 5 then states.x = states.x + 1 else states.x = 0 end
    if states.y < 5 then states.y = states.y + 1 else states.y = 0 end

     

    Then you would just use something like 

    component.redstone.setOutput(states)

     

    and this would then push your state to a redstone card. 
    Please note that the above code will not work as setOutput expects a numerical index rather than "x" or "y". If your using bundled you would need to adjust it as required.
    Though I dont understand how this is an issue for you as you can call 20 component functions per game tick (or so i think, based of an answer I recieved when asking if you could use multiple GPUs to speed up rendering to a single screen)

    Edit 1: Fixed Typo

  4. late reply and you have probably lost interest in this project but...
    you could use 

    local writeTo = {}
    local ignoreDrives = {}
    
    -- If the address is contained within a list of drive addresses to be ignored, return false
    -- Otherwise return true. Used to filter out RAID arrays, local disks, or other floppies you do not wish to write to
    function filter(addr)
    	return not ignoreDrives[addr]
    end
    
    -- Loop over all drives, and if they are not blacklisted add them to a list to write to
    for _,addr in pairs(component.list("filesystem")) do 
    	if filter(addr) then table.insert(writeTo, addr) end 
    end
    
    -- Loop over all drives that are going to be written to and write to them
    -- This is a bit more pesudo-code than actual code as I dont really know how your internal structure for data representations may vary (i.e; writing multiple files that are name sensitive)
    -- This function could also be 'inlined' with the loop checking whether a filesystem should be written to
    for _,addr in pairs(writeTo) do 
    	write(writeTo, data)
    end

     

    Sure its a pain to get the address of every drive you dont want to write to but its easier than having to change the recorded address every time you insert a new floppy.  You can minimise the amount of blacklisting you would need to do by using a machine (likely a server) that is connected to as few filesystems as possible. 
    You would apply a similar approach for unmanaged drives as well, though I suspect they are not as common and you may get away with not needing to create a blacklist for them.

×
×
  • Create New...

Important Information

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