Announcement

Collapse
No announcement yet.

SLIC Template Processor

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SLIC Template Processor

    In response to a request by Pedrunn (sort of..) and because I'd been intending to do something like this I have written a program to process templates intended to duplicate sections of SLIC code. This is not as powerful as I had hoped at present, but to go any further I'd have to incorporate the system into CTPEd (something I intend to do, but people would probably want a seperate program).

    The basic intent is to generalize the program that I previously wrote for helping with the advance with city capture code for other purposes.

    This amounts to generating repetetive code based of the contents of the data files.

    Now you can make template files (I suggest .slt) which are processed into complete and final .slc files, removing the intermediate copy-paste step that there was before. I have also added further functionality to access the fields within the entries (in a limited way) and supply the number of the entry for use with array indicies and such like.

    Attached is the executable, zipped with a sample template file including details of how to use this and the processed SLIC file which should be output from the sample template.

    Any feedback welcome - there are no doubt some things I could quickly add if they are desired but haven't thought of.

    Here's a short sample of output, based on something Pedrunn was wanting:

    Code:
    PEDRUNN_PILLAGED_IMPROVEMENT[0] = TerrainImprovementDB(TILEIMP_ADVANCED_FARMS);
    PEDRUNN_PILLAGE_BONUS[0] = 500;
    
    PEDRUNN_PILLAGED_IMPROVEMENT[1] = TerrainImprovementDB(TILEIMP_ADVANCED_MINES);
    PEDRUNN_PILLAGE_BONUS[1] = 800;
    
    PEDRUNN_PILLAGED_IMPROVEMENT[2] = TerrainImprovementDB(TILEIMP_ADVANCED_UNDERSEA_MINES);
    PEDRUNN_PILLAGE_BONUS[2] = 1000;
    
    PEDRUNN_PILLAGED_IMPROVEMENT[3] = TerrainImprovementDB(TILEIMP_AIR_BASES);
    PEDRUNN_PILLAGE_BONUS[3] = 1000;
    
    PEDRUNN_PILLAGED_IMPROVEMENT[4] = TerrainImprovementDB(TILEIMP_AUTOMATED_FISHERIES);
    PEDRUNN_PILLAGE_BONUS[4] = 1400;
    Attached Files

  • #2
    Will start playing with it now
    I dont think i need to say it will be very useful

    -Thanks
    "Kill a man and you are a murder.
    Kill thousands and you are a conquer.
    Kill all and you are a God!"
    -Jean Rostand

    Comment


    • #3
      I've just had a quick go at this for hex's LOTR scenario, and I can't seem to get it working. I'm using this as a template, and hex's LOTR_units.txt:

      Code:
      elseif(tmpUnit.type == UnitDB(@)) {
      	~@Unit = tmpUnit;
      }
      (The ~ is just there so I can do a search/replace for ~UNIT_ later on.)

      But it doesn't seem to work. It goes to the first unit, then hangs there for ages. Possibly forever.

      ??
      Concrete, Abstract, or Squoingy?
      "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

      Comment


      • #4
        The syntax is different in this version - you need to use something like the following:
        Code:
        SlcTP
        SlcTPSource
        LOTR_Units.txt
        SlcTPTemplate
        if(tmpUnit.type == UnitDB(@Name*)) {
        	~@Name*Unit = tmpUnit;
        }
        
        SlcTPBetween
        else
        SlcTPEnd
        That will give the output:

        Code:
        if(tmpUnit.type == UnitDB(UNIT_SAURON)) {
        	~UNIT_SAURONUnit = tmpUnit;
        }
        elseif(tmpUnit.type == UnitDB(UNIT_SHELOB)) {
        	~UNIT_SHELOBUnit = tmpUnit;
        }
        elseif(tmpUnit.type == UnitDB(UNIT_BALROG)) {
        	~UNIT_BALROGUnit = tmpUnit;
        }
        elseif(tmpUnit.type == UnitDB(UNIT_WATCHER)) {
        	~UNIT_WATCHERUnit = tmpUnit;
        }
        [and so forth...]

        Comment

        Working...
        X