SMTR—A tr like template editing tool

    Joined
    Jan 22, 2014
    Messages
    1,047
    Reaction score
    299
    I created a small program for basic template editing, called smtr. Its name comes from its similarities to tr, a Unix command line tool that can substitute characters in strings—which is pretty much what this tool does: It can substitute blocks in template files.
    Why is this useful? Because you can, for instance, create one template, and then quickly create more that differ only in coloring.

    Basic usage:
    Code:
    smtr -i infile.smtpl -o outfile.smtpl '286,444' '75,296'
    This reads infile.smtpl and writes the modified template to outfile.smtpl, substituting all occurences of ice crystals (/ice crystal wedges) with black hull (wedges).

    Content page

    Todo:
    • Add "block classes". Example: stmr '[:blue:]' '[:red:]'
     
    Joined
    Jul 12, 2014
    Messages
    511
    Reaction score
    57
    • Purchased!
    • Legacy Citizen 5
    Interesting, if it'll been in python I'd probably download it. ;)
    Does it have a help function to get an overview of block types (ID's) available, or does one need to get that from macro assemblers in the game?

    Greets,

    Jan
     
    Joined
    Aug 25, 2013
    Messages
    180
    Reaction score
    43
    What version of ruby does this require? I got a bunch of syntax errors when I tried it with 1.8.7.

    Edit:
    I installed the latest stable version from source and it works correctly.
     
    Last edited:

    Reilly Reese

    #1 Top Forum Poster & Raiben Jackpot Winner
    Joined
    Oct 13, 2013
    Messages
    5,140
    Reaction score
    1,365
    • Legacy Citizen 8
    • Thinking Positive
    • Purchased!
    Never heard of Ruby. Why not use Python or Java???
     
    Joined
    Jan 22, 2014
    Messages
    1,047
    Reaction score
    299
    Does it have a help function to get an overview of block types (ID's) available, or does one need to get that from macro assemblers in the game?
    The program is actually pretty stupid. It doesn't care about valid block IDs (except overflow—they will be truncated to fit into the three byte block definitions StarMade uses) by default and just does search & replace. There is a "smart mode" that utilizes an array with all valid block IDs, but having block ID lookup by names would require a complex setup (if done right) which is not suitable for a program like this.
    Edit: I'm hoping that, as soon as I've sat down on this again, block classes will remove the need to look up block IDs.

    What version of ruby does this require? I got a bunch of syntax errors when I tried it with 1.8.7.

    Edit:
    I installed the latest stable version from source and it works correctly.
    Ruby 2.0+ (I am using keyword arguments).

    Never heard of Ruby. Why not use Python or Java???
    Because Ruby is awesome. I don't like Python very much and, well, for Java there's pretty much two reasons to use it: (1) need for a certain library. (2) a distinct tendency for masochism. :p
     
    Joined
    Jul 12, 2014
    Messages
    511
    Reaction score
    57
    • Purchased!
    • Legacy Citizen 5
    The program is actually pretty stupid. It doesn't care about valid block IDs (except overflow—they will be truncated to fit into the three byte block definitions StarMade uses) by default and just does search & replace.. :p
    Okay, fair enough, I just wondered. Personally I'm not a real big fan of python either, because third party written source files are very hard to follow without variable declarations needed, but Ruby, well I couldn't get my head round that at all. lol

    Greets,

    Jan
     

    Reilly Reese

    #1 Top Forum Poster & Raiben Jackpot Winner
    Joined
    Oct 13, 2013
    Messages
    5,140
    Reaction score
    1,365
    • Legacy Citizen 8
    • Thinking Positive
    • Purchased!
    Ever heard of Paparyus? It sucks