This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Vilsol's profile picture

Sapi - Screen Api. Connect Monitors Together!

Started by Vilsol, 20 September 2013 - 04:04 PM
Vilsol #1
Posted 20 September 2013 - 06:04 PM
sAPI

Hello everyone. I present to you sAPI. It is used to connect multiple screens in a single one and use it as a whole. It has all the same commands that a monitor peripheral does, and it uses full x, y coordinate system, which means that you have to write your code as if the screen was one huge.

Planned Features:
  • Event handler, which would return the screens coordinates.
  • Drawing of different shapes.
  • Different monitor size support.
API:
Spoilerhttp://pastebin.com/BctNZuKM

pastebin get BctNZuKM sAPI
  • sAPI.setMonitors(monitortable)
  • Takes a monitor table as an argument. In the table you have to have a table for each row, even if you have only one. Inside the rows you only have to list the monitor ID's not the full names. Example table: {{"25", "19"}, {"18", "24"}}
  • sAPI.printNames()
  • Finds all connected monitors and prints their network names on the screens.
  • sAPI.getSize()
  • Returns the size of the whole screen (All monitors summed up together).
  • sAPI.setCursorPos(x, y)
  • Sets the cursor position to the x and y coordinates.
  • sAPI.getCursorPos()
  • Returns the current cursor position.
  • sAPI.writeText(text)
  • Writes text starting from the current cursor position.
  • sAPI.printText(text)
  • Writes text starting from the current cursor position but also wraps the text if it is longer than the screen width (divided by spaces if possible).
  • sAPI.slowPrintText(text, delay)
  • Same as sAPI.printText, but you can set the delay between each character.
  • sAPI.clear()
  • Clears the entire screen.
  • sAPI.clearLine(y)
  • Clears the specified line.
  • sAPI.setBackgroundColor(color)
  • Sets the screens background color.
  • sAPI.setTextColor(color)
  • Sets the screens text color.
  • sAPI.fillBox(x, y, width, height, character)
  • Draws a box at the specified coordinates with the specified width, height and character.
  • sAPI.setTextScale(scale)
  • Sets the scale on the entire screen.

Example Program:
Spoilerhttp://pastebin.com/uUn88TrP

pastebin get uUn88TrP example
Example output:
robotica34 #2
Posted 21 September 2013 - 04:12 AM
Three words:
This. Is. Amazing.
Ristyo #3
Posted 21 September 2013 - 05:44 AM
I haven't tried this, but sapi means cow in my country's language.
Vilsol #4
Posted 21 September 2013 - 10:25 AM
I haven't tried this, but sapi means cow in my country's language.

I don't know why but I can't change it to sAPI it changes back to Sapi.
theoriginalbit #5
Posted 21 September 2013 - 10:44 AM
I don't know why but I can't change it to sAPI it changes back to Sapi.

Your answer
Vilsol #6
Posted 21 September 2013 - 10:46 AM
I don't know why but I can't change it to sAPI it changes back to Sapi.

Your answer

I've had an IP board before and I had this problem as well. It was in setting something like force lowercase or something.
Larsg310 #7
Posted 22 September 2013 - 05:13 AM
Very nice if you yould need a HUGE monitor for your program.
mrdawgza #8
Posted 24 September 2013 - 12:43 PM
This is good, I like it. I would use it in multiple worlds or on a server.
Vilsol #9
Posted 24 September 2013 - 12:50 PM
Updates!

Added:
  • sAPI.slowPrintText(text, delay)
  • Same as sAPI.printText, but you can set the delay between each character.
  • sAPI.clearLine(y)
  • Clears the specified line.
  • sAPI.setTextScale(scale)
  • Sets the scale on the entire screen.
Updates:
  • sAPI.printText(text)
  • Now it tries dividing by spaces.
distantcam #10
Posted 10 November 2013 - 11:39 AM
I'm having trouble hooking this up.

How do you get the monitors id?