Thread Tools
Old August 22, 2001, 13:39   #1
St Leo
Scenario League / Civ2-CreationApolytoners Hall of Fame
 
St Leo's Avatar
 
Local Time: 08:43
Local Date: October 31, 2010
Join Date: Jul 2005
Location: In search of pants
Posts: 5,085
My C++ Events Generator
Anzac asked for my C++ thingie, so here it is. It allows great dynamic event generation and compiles to virus-sized DOS executables.

P.S. I've only made the procedures that I needed.
P.P.S. Edit Post to see proper tabbing.




//Leons Petrazickis
//Roman Riots II Events Generator
//Uses St Leo's Civ++ Event Engine V1.0

#include
#include //Delete this

ofstream fout("events.txt"); //creates a variable of type ofstream

//Triggers
void citytaken(char city[255],
char attacker[255],
char defender[255]);
void negotiation(char talker[255],
char talkertype[255],
char listener[255],
char listenertype[255]);
void randomturn(int denominator);
void scenarioloaded();
void turn(int turn);
void unitkilled(char unit[255],
char attacker[255],
char defender[255]);

//Actions
void createunit(char owner[255],
char unit[255],
char veteran[255],
char homecity[255],
char loc[255]);
void justonce();
void noschism(char defender[255]);
void playwavefile(char filename[255]);
void text(char text[32000]);

//Keywords
void beginevents();
void endevents();
void IF();
void THEN();
void ENDIF();
void debug();

//Useful Variable
char civs[8][256] = {
"Roman Legion",
"Rebels",
"Invaders",
"English",
"Spaniards",
"French",
"Independents",
"Barbarians"};

void main(){
//Scenario-specific variables
char answer = ' '; //Answer to prompts
int x=0; //Index for loops
int number = 5;
int engfreq = 3;
int galfreq = 4;
int generalinterval = 15;
char assloc[] = "70,106";

cout << "Welcome to the Setup Program for Roman Riots 2:\n";
cout << "\t-Answer in lowercase and follow up with an [Enter]\n";
cout << "\t-Run it again whenever needed\n";
cout << "\t-If it summons aliens from Alpha Centauri, it is not my fault\n\n";

beginevents();
//debug();

IF();
noschism("ANYBODY");
THEN();
ENDIF();

IF();
negotiation("ANYBODY","HUMANORCOMPUTER","ANYBODY","HUMANORCOMPUTER");
THEN();
ENDIF();

IF();
randomturn(5);
THEN();
createunit("Rebels","Pachyderms","Yes","NONE","76,44");
ENDIF();
IF();
randomturn(5);
THEN();
createunit("Rebels","Dark Furies","Yes","NONE","76,44");
ENDIF();
IF();
randomturn(5);
THEN();
createunit("Rebels","Rebel Skirmisher","Yes","NONE","76,44");
ENDIF();
IF();
randomturn(10);
THEN();
createunit("Rebels","Scout","Yes","NONE","76,44");
ENDIF();
IF();
randomturn(5);
THEN();
createunit("Rebels","Rebel Skirmisher","Yes","NONE","29,15");
ENDIF();
IF();
randomturn(5);
THEN();
createunit("Rebels","Rebel Skirmisher","Yes","NONE","1,47");
ENDIF();
IF();
randomturn(15);
THEN();
createunit("Roman Legion","Praefect III","Yes","NONE","36,2");
text("^An expert defensive unit has arrived.");
ENDIF();


endevents();
fout.close();
}

void createunit(char owner[255],
char unit[255],
char veteran[255],
char homecity[255],
char loc[255]){
fout << "CreateUnit\n";
fout << "owner=" << owner << "\n";
fout << "unit=" << unit << "\n";
fout << "veteran=" << veteran << "\n";
fout << "homecity=" << homecity << "\n";
fout << "locations\n" << loc << "\nendlocations\n";
}

void unitkilled(char unit[255],
char attacker[255],
char defender[255]){
fout << "UnitKilled\n";
fout << "unit=" << unit << "\n";
fout << "attacker=" << attacker << "\n";
fout << "defender=" << defender << "\n";
}

void randomturn(int denominator){
fout << "RandomTurn\n";
fout << "denominator=" << denominator << "\n";
}

void turn(int turn){
fout << "Turn\n";
fout << "turn=" << turn << "\n";
}

void negotiation(char talker[255],
char talkertype[255],
char listener[255],
char listenertype[255]){
fout << "Negotiation\n";
fout << "talker=" << talker << "\n";
fout << "talkertype="<< talkertype << "\n";
fout << "listener="<< listener << "\n";
fout << "listenertype="<< listenertype << "\n";
}

void text(char text[32000]){
fout << "Text\n";
fout << text << "\n";
fout << "EndText\n";
}


void beginevents(){
fout << "@BEGINEVENTS\n";
}

void endevents(){
fout << "@ENDEVENTS\n";
}

void IF(){
fout << "@IF\n";
}

void THEN(){
fout << "@THEN\n";
}

void ENDIF(){
fout << "@ENDIF\n";
}

void justonce(){
fout << "JustOnce\n";
}

void noschism(char defender[255]){
fout << "NoSchism\n";
fout << "defender=" << defender << "\n";
}

void citytaken(char city[255],
char attacker[255],
char defender[255]){
fout << "CityTaken\n";
fout << "city=" << city << "\n";
fout << "attacker=" << attacker << "\n";
fout << "defender=" << defender << "\n";
}

void playwavefile(char filename[255]){
fout << "PlayWaveFile\n";
fout << filename << "\n";
}

void scenarioloaded(){
fout << "ScenarioLoaded\n";
}

void debug(){
fout << "@DEBUG\n";
}
__________________
Blog | Civ2 Scenario League | leo.petr at gmail.com
St Leo is offline  
Old August 22, 2001, 14:33   #2
Jimmywax
Scenario League / Civ2-Creation
Prince
 
Jimmywax's Avatar
 
Local Time: 06:43
Local Date: October 31, 2010
Join Date: Apr 2001
Location: in an undisclosed strip club
Posts: 737
Huh ???
Okay, pretend for a second that I have no idea how to use C++ and all that events lingo confuses me to no end. Now pretend that you need to explain all this to me.

P.S. just remember that I said pretend, I know what you're talking about. I am just seeing if you know what you're about.
__________________
"I would rather have a German division in front of me than a French one behind me." -- General George S. Patton
"Guinness sucks!" -- Me
Jimmywax is offline  
Old August 22, 2001, 16:59   #3
St Leo
Scenario League / Civ2-CreationApolytoners Hall of Fame
 
St Leo's Avatar
 
Local Time: 08:43
Local Date: October 31, 2010
Join Date: Jul 2005
Location: In search of pants
Posts: 5,085
This is basically just an interactive preprocessor for the CivII macro language. You can use C++ loops and other control structures and the syntax is much cleaner.
__________________
Blog | Civ2 Scenario League | leo.petr at gmail.com
St Leo is offline  
Old August 23, 2001, 00:22   #4
Jimmywax
Scenario League / Civ2-Creation
Prince
 
Jimmywax's Avatar
 
Local Time: 06:43
Local Date: October 31, 2010
Join Date: Apr 2001
Location: in an undisclosed strip club
Posts: 737
Are you saying that I can copy this down and put it right in an events file and it will work?

Or do I have to make it into a batch file or something?
__________________
"I would rather have a German division in front of me than a French one behind me." -- General George S. Patton
"Guinness sucks!" -- Me
Jimmywax is offline  
Old August 23, 2001, 08:58   #5
The ANZAC
Civilization II PBEMCivilization II Democracy Game: Red FrontScenario League / Civ2-Creation
King
 
The ANZAC's Avatar
 
Local Time: 07:43
Local Date: October 31, 2010
Join Date: Jan 2000
Location: The Rodina!
Posts: 2,334
Thanks St. Leo, though I somewhat understand it. But I think when I get Fictional Americas and see how it works in the field, I will be able to really implement it. Thanks
__________________
Georgi Nikolai Anzyakov, Commander Grand Northern Front, Red Front Democracy Game
The ANZAC is offline  
Old August 23, 2001, 11:00   #6
techumseh
Civilization II PBEMScenario League / Civ2-Creation
Emperor
 
techumseh's Avatar
 
Local Time: 06:43
Local Date: October 31, 2010
Join Date: Apr 1999
Location: of the frozen North.
Posts: 4,197
Is this anything like Angelo Scottos' CPSL?
techumseh is offline  
Old August 23, 2001, 11:00   #7
techumseh
Civilization II PBEMScenario League / Civ2-Creation
Emperor
 
techumseh's Avatar
 
Local Time: 06:43
Local Date: October 31, 2010
Join Date: Apr 1999
Location: of the frozen North.
Posts: 4,197
Is this anything like Angelo Scottos' CPSL?
techumseh is offline  
Old August 23, 2001, 11:34   #8
Shadowstrike
Emperor
 
Shadowstrike's Avatar
 
Local Time: 07:43
Local Date: October 31, 2010
Join Date: Jul 2000
Location: The Glorious Land of Canada
Posts: 3,234
I think this simply randomizes event you get..... for example, I suppose you could set it so that say you could get extra money every 5, 10 or 20 years, depndig on a randomized factor.... *tries to remember more from puny collection of C++ knowledge*
__________________
*grumbles about work*
Shadowstrike is offline  
Old August 23, 2001, 11:54   #9
St Leo
Scenario League / Civ2-CreationApolytoners Hall of Fame
 
St Leo's Avatar
 
Local Time: 08:43
Local Date: October 31, 2010
Join Date: Jul 2005
Location: In search of pants
Posts: 5,085
Is this anything like Angelo Scottos' CPSL?

No, CSPL messes with Civ2's memory to create new events. This simply generates a custom events file. Note: I don't know how to run delevent.exe for a C++ file, so you might have to combine this with a batch file for mutli-event file scenarios.

I think this simply randomizes event you get..... for example, I suppose you could set it so that say you could get extra money every 5, 10 or 20 years, depndig on a randomized factor....

That certainly is possible, but in Fictional Americas and Imperial Ambition I used this to create a distinct file based on who's human and who's not, while in Roman Riots II I simply used it because I prefer C++ function syntax.
__________________
Blog | Civ2 Scenario League | leo.petr at gmail.com
St Leo 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 08:43.


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