The ALL lua console.

  • devast8a
    28th Mar 2012 Former Staff 0 Permalink

    The ALL lua-console.



    Latest: (V8.2) https://gist.github.com/3274035

    How to install
    Create a file called autorun.lua and copy the contents of this script into that file and save.

    VERSION 8 http://pastebin.com/8PMCU3VP
    VERSION 7 http://pastebin.com/biaaQjSf
    VERSION 6 http://pastebin.com/Dp6swzdh
    VERSION 5 http://pastebin.com/f3szBNQm
    VERSION 4 http://pastebin.com/behvHtzH

    Firstly, the major difference. The text is purple, the best color of all the colors.

    image


    This console supports by default 500 lines of text 85 characters in length (Total of 42, 500 characters).
    It allows you to scroll up, down, left or right through the console buffer (using page up/down, home and end keys)
    It supports multiple colors (any allowed by powder-toy) including binding text to a color class rather than directly to a color.
    Binding written text to "error" allows the user to override the error text color with a color of their own choice.

    Commands
    !help - displays help information
    !color <color> - set console foreground to color supported input.
    !color <class> <color> - set class to given color
    !r <file> - Shorthand for dofile("file"), file does not need to end in .lua

    Supported color names:
    blue, cyan, gray, green, purple, red, white, yellow.darkblue, darkcyan, darkgreen, darkpurple, darkred, darkyellow

    Color classes
    command - Currently typed command
    foreground - default text foreground
    background - default text background
    error - Error text foreground
    errorbg - Error text background
    backdrop - The color behind the console (the slightly black see through color)
    border - Color of the border around the console
    line - Line separating the console input and output
    hud_motd - All Lua Console's Message of the day color
    hud_debug - All Lua Console's HUD debug color
    hud_close - Close message color when old console is opened

    For lua script writers
    You can either continue to use tpt.log or you can use console.writeln/console.write to display your output

    console.write( text [, foreground [, background] ) - Write text to console (does not append text with a new line)
    console.writeln( text [, foreground [, background] ) - Write text to console

    console.active - get active state of console
    0 = Not Active
    1 = Console Opened
    2 = Old Console Opened

    If you need to open the old consoleconsole.old.open()

    Colors can be represented by the following
    nil- use default text color
    table- with 3 entries (RGB) eg. {255,0,0}
    table - with 4 entries (RGBA) eg. {255,255,255,178}
    color - eg. console.colors.red
    string - A string containing a valid color name or color class (eg. "red" or "error")

    To make your own color class simply copy the following line.
    console.colors.name_of_your_class = {255,255,255,255}

    A color class must be a table with 4 entries (RGBA)
    All colors and color classes are stored in console.colors

    == Issues & Workarounds ==
    Keymapping is done in script, as a result your keyboard maybe unsupported.
    The console does support multiple mappings. The following keyboards are supported: US

    == Bugs that are likely impossible to fix with only lua ==
    -- pressing ctrl while in the console still changes simulation save and browse buttons to local save and browse buttons
    -- when the mouse moves over menu elements they'll still react as per normal (clicking them does nothing)
    -- Entering old console and click the X button in the top-left corner will close old console however lua-console won't be able to detect this (press escape twice to fix it)
    -- The MOTD is not blacked out by the console background
    -- You can still change the shape of the cursor by holding shift

    == Bugs that might be possible to fix ==
    -- Any other script using draw commands will probably draw over the top of lua-console

    == Change log ==
    V8
    added better keybinding support
    fixed issue with being able to select a cursor that doesn't exist

    V7
    write/writeln now prints non string input
    fixed bugs with using old buffer lines
    console command now scrolls to provide input larger than screen width

    V6
    Current command supports coloring
    Added cursor to current command (left/right keys)

    V5
    left/right buffer movement (home/end keys)
    multiple colors and color classeslines over buffer.width in length are automatically moved to a new line

    V4
    First Release
  • devast8a
    28th Mar 2012 Former Staff 0 Permalink
    Released V6
  • mniip
    28th Mar 2012 Developer 0 Permalink
    ive found 2 things that break your console
    Thing 1:
    print{}
    Thing 2:
    print(string.rep("",1000000)) --have to wait a bit
  • devast8a
    2nd Aug 2012 Former Staff 0 Permalink
  • ThunderSt
    2nd Aug 2012 Member 0 Permalink

    This should be the official console :D

     

    Putting it in autorun.lua!

     

    Just 2 things... it needs all-keyboard support and... whats the key to open it?

  • Veldin
    2nd Aug 2012 Banned 0 Permalink
    This post is hidden because the user is banned
  • devast8a
    2nd Aug 2012 Former Staff 0 Permalink
    Yes it is an autorun script.

    @ThunderSt (View Post)
    Same as the normal console key.

    If any key doesn't work or is incorrect.
    press D when the console is not opened to switch to debug mode,
    press the key, then jot down the number in the corner and tell me the character it should actually show instead.
  • ThunderSt
    2nd Aug 2012 Member 0 Permalink

    @devast8a (View Post)

     

    The normal console key for me is

     

    And when I use it the old console appears instead.

     

     

    I also pressed D before opening (screenshot).

  • Veldin
    2nd Aug 2012 Banned 0 Permalink
    This post is hidden because the user is banned
  • ThunderSt
    2nd Aug 2012 Member 0 Permalink

    @Veldin (View Post)

     

    That only slighly decreases my brush's size.