Use any in-game icon inside your scripts

  • nucular
    30th Mar 2014 Member 3 Permalink
    With this little thingy you add any icon that is being used inside the game to the strings of your script, for example inside button labels. Theoretically you could have done that anyways, but this thing simplifies it pretty much.
    It also works with colors (even mid-string)!

    PASTEBIN LINK


    Example usage:


    local b = Button:new(50,50, 100,15, tptools.text("{blue}Navigate left {lblue}{left}"))
    ui.addComponent(b)


    results in:

    image



    Color codes will color the following characters until you use {reset}.

    {white}, {green}, {yellow}, {red}, {lred}, {blue}, {lblue}



    Most icons that are used inside the game are available. These are just a few examples:

    {votedown}, {voteup}, {left}, {right}, {pause}, {reload}

    {electronics}, {explosives}, {liquids}, {gasses}, {radioactive}, {powders}, {solids}, {life}...

    This code is MIT licensed so you can rip stuff out of it and use it in your own scripts. Be fair and give credit/don't say it would all your work.

    EDIT: formatting...
    Edited 4 times by nucular. Last: 30th Mar 2014
  • cccp3
    6th Apr 2014 Member 1 Permalink

    Well that is coool as h*ll

  • CeeJayBee
    6th Apr 2014 Member 0 Permalink

    So that would be how someone was on TPTMP with the nick UPVOTE^ :D

     

    EDIT: It either doesn't work with cracker64's Script Manager or I'm epically failing. Let me check.

    EDIT EDIT: I'm failing. I thought it worked on in-game client-created signs. Ignore the last edit.

    Edited 2 times by CeeJayBee. Last: 6th Apr 2014
  • mniip
    6th Apr 2014 Developer 0 Permalink
    @nucular (View Post)
    1. >what are locals
    2. No need to
    %
    braces.
    3. That's a terrible parser with a lot of useless code. You shouldn't be splitting parse of commands of the same format across 3 different functions
  • nucular
    6th Apr 2014 Member 0 Permalink
    @mniip (View Post)
    1. I have one global object that works as a module namespace. Nothing more.
    2. Guess I feel safer with them :P
    3. At least it's readable. Also, the splitted functions are a relict from the previous parsing thingy (really bad, it just iterated all over the tag lists) where it were a speed improvement to only iterate over the needed tags (only color, only icons or both). I will fix that now.
  • jacob1
    6th Apr 2014 Developer 0 Permalink
    @CeeJayBee (View Post)
    no, I looked in the source on my own to make that nick :p. I also joined as downvote, then as some spam with every single icon, then a cool looking blue gradient with a newline in it.
  • CeeJayBee
    6th Apr 2014 Member 0 Permalink

    @jacob1 (View Post)

     Oh lol, it was you XD