This is the first Post of this Topic in english:
Because I needed a script which can handle a techtree for my planned RTS "Planets - Unification" I wrote it myself ^^

It isn't 100% complete... at the moment it is more a InGame Help or something like this.

I wanted to create the script very modular, so i can take it out of my game and place it in any other project without
big changes.

Nevertheless I want to share it with you ( and also the later versions of this script)

Code:
 

/*
* Techtree.wdl - Version 0.2
*
* module for reading ans using techtrees out of a textfile
*
* How to usw techtree.wdl:
* 1. include ( include<techtree.wdl>; )
* 2. set the name of your techtreefile through setTechFilename("DATEINAME") [default:techtree.txt]
* 3. initTechtree("seperator"); to initialize the techtree ( recommended: ";")
* 4. get your information with the get*-functions and process them as you like
*
* example techtree.txt with two lines :
* mining;300;1000;2000;3000;Is needed for:;Oremine,Deuteriumsynthesizer,;crystalmine
* Laser;300;150;1111;3333;Provides your army with;laserweapons and laserguided;missles.
*
* Syntax (after the last Info ENDLINE(Return) instead of semikolon(;)
* name;buildtime;cost_ore;cost_crystal;cost_deuterium;description1;description2;description3
*
* This script can be uses in (non-)commercial projects without credits. Have fun with it !
*
*/

var techtreefile; //Handle for Techtreefile
string techFilename = "techtree.txt"; //Name of the file with the techtreedata

var counter=1; //Linecounter

// declaration of the needed Strings
string techName;
string techCostErz;
string techCostKristall;
string techCostDeuterium;
string techTime;
string techDescription;

function initTechtree(seperator) //only changes the seperator at the moment
{
str_cpy(delimit_str,seperator);
}

function setTechFilename(newname) //here you can change the filename of your techtreefile
{
str_cpy(techfilename,newname);
}

function getTechName(Position) //returns the name of a technology
{
Position = 1+((Position-1)*8);
techtreefile = file_open_read(techFilename);
while(counter<=Position)
{
file_str_read(techtreefile, techName);
counter+=1;
}
file_close(techtreefile);
counter=1;
return(techName);
}

function getTechTime(Position) //returns the building or researchtime for a tech
{
Position = 2+((Position-1)*8);
techtreefile = file_open_read(techFilename);
while(counter<=Position)
{
file_str_read(techtreefile, techTime);
counter+=1;
}
file_close(techtreefile);
counter=1;
return(techTime);
}

// The following 3 functions are returning the needed ammount of ressource (Ore,Crystal,Deuterium) for building or researching
function getTechCostErz(Position)
{
Position = 3+((Position-1)*8);
techtreefile = file_open_read(techFilename);
while(counter<=Position)
{
file_str_read(techtreefile, techCostErz);
counter+=1;
}
file_close(techtreefile);
counter=1;
return(techCostErz);
}

function getTechCostKristall(Position)
{

Position = 4+((Position-1)*8);
techtreefile = file_open_read(techFilename);
while(counter<=Position)
{
file_str_read(techtreefile, techCostKristall);
counter+=1;
}
file_close(techtreefile);
counter=1;
return(techCostKristall);
}

function getTechCostDeuterium(Position)
{
Position = 5+((Position-1)*8);
techtreefile = file_open_read(techFilename);
while(counter<=Position)
{
file_str_read(techtreefile, techCostDeuterium);
counter+=1;
}
file_close(techtreefile);
counter=1;
return(techCostDeuterium);
}


// Gets the Line of the techdescription
function getTechDescription(Position,Line)
{
if((Line>=4)||(Line<=0))
{return ("");
}
else
{
Position = (Line+5)+((Position-1)*8);
techtreefile = file_open_read(techFilename);
while(counter<=Position)
{
file_str_read(techtreefile, techDescription);
counter+=1;
}
file_close(techtreefile);
counter=1;
return(techBeschreibung);
}
}




So I just translated it and I hope I havent overseen a german variable or comment in this script.
I hope you understand my bad english comments ^^
Maybe I won't translate every Version of this script because it costs me a vast ammount of time (I could spend in finishing it).
But every big "release" will be translated.

I didn't test this script after translating it, so if you do please report any bug you found.

Right now I am working on a function which is able to compare the players techlevel with the needed techs
for a technology. This way it becomes a REAL techtreescript.

If there is a newer Version of this script, I will contribute it here.

Critics&Comments are welcome.