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

CoderPuppy's Programs and APIs -- Text Escapes and SitDown

Started by CoderPuppy, 03 June 2013 - 06:36 PM
CoderPuppy #1
Posted 03 June 2013 - 08:36 PM
Programs
SpoilerSitdown
SpoilerMulti file downloader It can download an entire directory structure from an HTTP server with one command. Pastebin: pastebin get 3tqG4Vg8 sitdown Instructions:
Spoiler
  1. Create files list
    SpoilerSitdown uses a .files file to determine what files it need to download. Each line in it represents a file or directory. If it's a directory the the directory has to have .files file in it. You can generate one by running "sitdown sit test" replacing test with what directory you want to generate the files list for. It will generate a files list in the directory listing all the files in the directory.
  2. Upload directory to server
  3. Download
    SpoilerRun "sitdown down http://example.com example". Replace example.com with where the directory is located on the server and example with were to download it to. If you don't specify were to download it to it will attempt to figure it out. Eg: "sitdown down http://coderpuppy.ko...om/sitdown-test" would download to "sitdown-test"
Chat System
SpoilerBetter chat for ComputerCraft, features include colors (using text escapes) and bot support Server: Pastebin: pastebin get 4s5XemYx chatd Gist: 10176291 Client: Requires the chatbot API and my textEscapes API Pastebin: pastebin get dgJadwuS chatc Gist: 10176089 Chat Bot API: Pastebin: pastebin get iw3J1Fgg chatbot Gist: 10158696 API:
Spoiler
  • createBot(hostname, username) – Create a bot and connect to a server. Bot:
    Spoiler
    • id – Random identifier, hopefully unique to the bot
    • handle(ev) – Handle an event (ev must be in the form { event name, event parameters… })
    • send(msg) – Send a message
    • logout(reason = 'Quit') – Logout with an optional reason
    Events:
    Spoiler
    • bot_user_message – Fired when anyone says anything, params: bot.id, username, msg, userid
    • bot_user_action – Fired when anyone uses /me, params: bot.id, username, action, userid
    • bot_user_nickchange – Fired when anyone changes their nick, params: bot.id, oldusername, newusername, userid
    • bot_user_join – Fired when anyone joins, params: bot.id, username, userid
    • bot_user_leave – Fired when anyone says leaves, params: bot.id, username, reason, userid
    • bot_user_action – Fired when anyone says anything, params: bot.id, username, action, userid
    • bot_quit – Fired when the bot disconnects for any reason, params: bot.id, reason
APIS
SpoilerText Escapes
SpoilertextEscapes lets you print strings with escape codes to, for example, change the text color in the middle of a string. Pastebin: pastebin get F7hL1ite textEscapes Gist: 9906482 Examples:
 -- Print "Hello World!" in lime textEscapes.print(textEscapes.textLime .. "Hello World!" .. textEscapes.textWhite) -- Print "HI!!!" in grey with a yellow background textEscapes.print(textEscapes.textGrey .. textEscapes.backYellow .. "HI!!!" .. textEscapes.reset) 
API:
Spoiler
  • write(text, opts) – Like normal write except uses' escapes, Options:
    Spoiler
    • textColor – Whether text color escapes work
    • backColor – Whether background color escapes work
    • moveCursor – Whether cursor escapes work
    • scroll – Whether scroll escapes work
    • blink – Whether blink escapes work
    • clear – Whether clear escapes work
    • clearLine – Whether clearLine escapes work
  • print(text, opts) – Like normal print except uses' escapes
  • text`Color` – Escape code for changing the text color to `color`
  • back`Color` – Escape code for changing the background color to `color`
  • reset – Escape code for changing the text color to white and the background color to black
  • clear – Escape code for clearing the screen
  • clearLine – Escape code for clearing the line (see term.clearLine)
  • blinkOn – Escape code for turning blink on
  • blinkOff – Escape code for turning blink off
  • textColor(color) – Get the escape code for changing the text color to `color`
  • backColor(color) – Get the escape code for changing the background color to `color`
  • moveCursor(x, y) – Get the escape code for moving the cursor to `x`, `y`
  • scroll(n) – Get the escape code for scrolling `n` rows
  • hexColor(color) – Get `color` in hexadecimal
TODO:
  • Documentation
  • Drop-in single file config function – Saves the config in the same file
Edited on 20 January 2016 - 05:14 AM
Sammich Lord #2
Posted 03 June 2013 - 08:39 PM
Don't you think it would be a better idea to give a little more information about this?
Creeper367 #3
Posted 03 June 2013 - 10:13 PM
What is this supposed to even be?
All i see is 2 links that lead to download pages/pastebin
Im not getting this if there is no info about it
CoderPuppy #4
Posted 03 June 2013 - 10:36 PM
Updated with documentation
JustPingo #5
Posted 04 June 2013 - 04:39 PM
It's funny, because "nom" is name in French ^^

Anyway, it looks nice. Great for multi-files downlodable programs.
CoderPuppy #6
Posted 04 June 2013 - 05:54 PM
Thanks
CoderPuppy #7
Posted 01 April 2014 - 03:49 AM
New API: textEscapes, lets you print strings with escape codes to, for example, change the text color in the middle of a string
TechMasterGeneral #8
Posted 04 April 2014 - 03:03 AM
pretty nice stuff you got there…
CoderPuppy #9
Posted 08 April 2014 - 08:35 PM
New program / API: Chat System - Better chat for ComputerCraft, features include colors (using text escapes) and bot support

pretty nice stuff you got there…
Thanks!