Thread Tools
Old September 25, 2002, 17:26   #1
J Bytheway
Call to Power PBEMCall to Power II Democracy GameCTP2 Source Code Project
Emperor
 
J Bytheway's Avatar
 
Local Time: 09:33
Local Date: November 1, 2010
Join Date: Jul 2001
Location: England
Posts: 3,826
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:
File Type: zip slctp.zip (19.7 KB, 16 views)
J Bytheway is offline  
Old September 25, 2002, 21:57   #2
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 05:33
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
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
Pedrunn is offline  
Old December 9, 2002, 19:27   #3
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 09:33
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
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
Immortal Wombat is offline  
Old December 10, 2002, 15:03   #4
J Bytheway
Call to Power PBEMCall to Power II Democracy GameCTP2 Source Code Project
Emperor
 
J Bytheway's Avatar
 
Local Time: 09:33
Local Date: November 1, 2010
Join Date: Jul 2001
Location: England
Posts: 3,826
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...]
J Bytheway is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 04:33.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team