Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site forums as they ran on Ultimate Bulletin Board, 1998–2001. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 2005 site & forums

  Apolyton Civilization Site Forums
  CtP2-Creation
  any suggestions? (slic)

Post New Topic  Post A ReplyPost A Reply In A New Window

profile | register | preferences | faq | search next newest topic | next oldest topic bottom of page
Author
Topic:   any suggestions? (slic) Format for Better Printing
kaan
Settler
Denmark
Mar 2001
posted March 27, 2001 10:23   Click Here to See the Profile for kaanClick Here to Email kaan  send a private message to kaan Visit kaan's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Im currently having my first experience programming slic, the goal is to remove that silly bug with internet wonder and computer centers still being build, when done it should work for all that type of wonders.
here is what it does for now:

HandleEvent(BeginTurn) 'WonderLookup' post {
int_t i;
int_t inetplayer;
city_t tmpCity;

inetPlayer = WonderOwner(WonderDB(WONDER_INTERNET));

if(inetPlayer != -1) {
//remove computer center from inetPlayer buildlists
for( i = 0 ; i < PlayerCityCount(inetPlayer); i = i + 1 ){
GetCityByIndex(inetPlayer, i, tmpCity);
KillBuildingFromBuildList(tmpCity, BuildingDB(IMPROVE_COMPUTER_CENTER));
}
}
}

as you can see it identifies the player that owns the wonder (if any) each turn and then procedes to remove all computer centers from the build lists of all cities the player own. it works for human players and AI alike.
i could really use a couple of tips on how to prevent computer center from appearing on the build lists at all.
but as it is now it should still prove usefull, i hate going trough all my build lists and manually removing buildings when i build such a wonder.

Locutus
Prince
Apolyton Borg Hengelo/Enschede, The Netherlands
Nov 1999
posted March 28, 2001 14:40   Click Here to See the Profile for LocutusClick Here to Email Locutus  send a private message to LocutusSend a Message to UIN: 52912776 Visit Locutus's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
I'm way ahead of you, kaan, you're reinventing the wheel. I already fixed that bug for the MedMod a few weeks ago (and in a much more elegant way too, if I may say so myself). Check out the MM2_scenario.slc file for my solution.

It looks like you could be a good SLIC coder though, we could use more people like you on these forums...

kaan
Settler
Denmark
Mar 2001
posted March 28, 2001 15:49   Click Here to See the Profile for kaanClick Here to Email kaan  send a private message to kaan Visit kaan's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
hmmm, ill look it up.
meanwhile look at my solution to the problem, its a bit bulky but ill slimm it down later.

HandleEvent(BeginTurn) 'WonderLookup' post {
// general vars
int_t i;
int_t hasrunonce;
int_t adv;
city_t tmpCity;

// vars for internet fix
int_t B;
int_t inetPlayer;
int_t oldInetPlayer;

// vars for national shield fix
int_t C;
int_t shieldPlayer;
int_t oldShieldPlayer;

// vars for central matter decompiler fix
int_t D;
int_t compPlayer;
int_t oldCompPlayer;

// vars for hagnia sophia fix
int_t E;
int_t hagnPlayer;
int_t oldHagnPlayer;

if(hasrunonce != 0){
oldInetPlayer = -2;
oldShieldPlayer = -2;
oldCompPlayer = -2;
oldHagnPlayer = -2;
hasrunonce = 0;
}

inetPlayer = WonderOwner(WonderDB(WONDER_INTERNET));
adv = AdvanceDB(ADVANCE_BUGFIX_B);

if(inetPlayer == -1 && oldInetPlayer != -2){
// see if wonder has been destroyed, then clean up
RemoveAdvance(oldInetPlayer, AdvanceDB(ADVANCE_BUGFIX_B));
oldInetPlayer = -2;
}

if(inetPlayer != -1 && inetPlayer != oldInetPlayer) {
// see if a new player has the wonder, then sell buildings
// then remove building from lists and clean up
B = 0;
for( i = 0 ; i < Cities(inetPlayer); i = i + 1 ){
GetCityByIndex(inetPlayer, i, tmpCity);
if(CityHasBuilding(tmpCity, "IMPROVE_COMPUTER_CENTER")){
B = B + 1200;
}
}
AddGold(inetPlayer, B);
if(oldHagnPlayer != -2){
RemoveAdvance(oldInetPlayer, adv);
}
GrantAdvance(inetPlayer, adv);
oldInetPlayer = inetPlayer;
}

shieldPlayer = WonderOwner(WonderDB(WONDER_NATIONAL_SHIELD));
adv = AdvanceDB(ADVANCE_BUGFIX_C);

if(shieldPlayer == -1 && oldShieldPlayer != -2){
// see if wonder has been destroyed, then clean up
RemoveAdvance(oldShieldPlayer, AdvanceDB(ADVANCE_BUGFIX_C));
oldShieldPlayer = -2;
}

if(shieldPlayer != -1 && shieldPlayer != oldShieldPlayer) {
// see if a new player has the wonder, then sell buildings, then remove building from lists and clean up
C = 0;
for( i = 0 ; i < Cities(shieldPlayer); i = i + 1 ){
GetCityByIndex(shieldPlayer, i, tmpCity);
if(CityHasBuilding(tmpCity, "IMPROVE_FORCEFIELD")){
C = C + 5000;
}
}
AddGold(shieldPlayer, C);
if(oldHagnPlayer != -2){
RemoveAdvance(oldShieldPlayer, adv);
}
GrantAdvance(shieldPlayer, adv);
oldShieldPlayer = shieldPlayer;
}

compPlayer = WonderOwner(WonderDB(WONDER_CENTRAL_MATTER_DECOMPILER));
adv = AdvanceDB(ADVANCE_BUGFIX_D);

if(compPlayer == -1 && oldCompPlayer != -2){
// see if wonder has been destroyed, then clean up
RemoveAdvance(oldCompPlayer, AdvanceDB(ADVANCE_BUGFIX_D));
oldCompPlayer = -2;
}

if(compPlayer != -1 && compPlayer != oldCompPlayer) {
// see if a new player has the wonder, then sell buildings, then remove building from lists and clean up
D = 0;
for( i = 0 ; i < Cities(compPlayer); i = i + 1 ){
GetCityByIndex(compPlayer, i, tmpCity);
if(CityHasBuilding(tmpCity, "IMPROVE_MATTER_DECOMPILER")){
D = D + 2250;
}
}
AddGold(compPlayer, D);
if(oldHagnPlayer != -2){
RemoveAdvance(oldHagnPlayer, adv);
}
GrantAdvance(compPlayer, adv);
oldCompPlayer = compPlayer;
}

hagnPlayer = WonderOwner(WonderDB(WONDER_HAGIA_SOPHIA));
adv = AdvanceDB(ADVANCE_BUGFIX_E);

if(hagnPlayer == -1 && oldHagnPlayer != -2){
// see if wonder has been destroyed, then clean up
RemoveAdvance(oldHagnPlayer, AdvanceDB(ADVANCE_BUGFIX_E));
oldHagnPlayer = -2;
}

if(hagnPlayer != -1 && hagnPlayer != oldHagnPlayer) {
// see if a new player has the wonder, then sell buildings, then remove building from lists and clean up
E = 0;
for( i = 0 ; i < Cities(hagnPlayer); i = i + 1 ){
GetCityByIndex(hagnPlayer, i, tmpCity);
if(CityHasBuilding(tmpCity, "IMPROVE_SHRINE")){
E = E + 135;
}
}
AddGold(hagnPlayer, E);
if(oldHagnPlayer != -2){
RemoveAdvance(oldHagnPlayer, adv);
}
GrantAdvance(hagnPlayer, adv);
oldHagnPlayer = hagnPlayer;
}
}

kaan
Settler
Denmark
Mar 2001
posted March 28, 2001 16:18   Click Here to See the Profile for kaanClick Here to Email kaan  send a private message to kaan Visit kaan's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
hmmmmm an unducumentet function call with a very long "case of" (switch, whatever its called in your local programming language).
very nice :-)

a note to the above,
i have added to buildings.txt :
ObsoleteAdvance ADVANCE_BUGFIX_"X"
for those building that apply
and added techs to advance.txt as follows

ADVANCE_BUGFIX_A {

Prerequisites ADVANCE_BUGFIX_F

Cost 36272
Icon ICON_ADVANCE_QUANTUM_MECHANICS
Branch 0
Age AGE_ONE
GLHidden
}

ADVANCE_BUGFIX_B {

Prerequisites ADVANCE_BUGFIX_A

Cost 36272
Icon ICON_ADVANCE_QUANTUM_MECHANICS
Branch 0
Age AGE_ONE
GLHidden
}

ADVANCE_BUGFIX_C {

Prerequisites ADVANCE_BUGFIX_A

Cost 36272
Icon ICON_ADVANCE_QUANTUM_MECHANICS
Branch 0
Age AGE_ONE
GLHidden
}

ADVANCE_BUGFIX_D {

Prerequisites ADVANCE_BUGFIX_A

Cost 36272
Icon ICON_ADVANCE_QUANTUM_MECHANICS
Branch 0
Age AGE_ONE
GLHidden
}

ADVANCE_BUGFIX_E {

Prerequisites ADVANCE_BUGFIX_A

Cost 36272
Icon ICON_ADVANCE_QUANTUM_MECHANICS
Branch 0
Age AGE_ONE
GLHidden
}

ADVANCE_BUGFIX_F {

Prerequisites ADVANCE_BUGFIX_A

Cost 36272
Icon ICON_ADVANCE_QUANTUM_MECHANICS
Branch 0
Age AGE_ONE
GLHidden
}

Locutus
Prince
Apolyton Borg Hengelo/Enschede, The Netherlands
Nov 1999
posted March 29, 2001 05:34   Click Here to See the Profile for LocutusClick Here to Email Locutus  send a private message to LocutusSend a Message to UIN: 52912776 Visit Locutus's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Well, it's undocumented but it's frequently used in the official Activision scenario's, so you could easily have known about it. There's a lot more to learn about SLIC from examples of the code (the Activision scenarios, the MedMod, the Diplomod, etc) than from the documentation.

What *are* you trying to do with that enourmous chunk of code? It seems like you're giving whoever owns the building-wonders a special advance and as soon as the wonder changes owner, you give the new owner a certain amount of money for every accompanying wonder-building he owns. What's the advance good for? Why give money to the new owner? If you're trying to sell the buildings it would be much better to actually destroy the building as well using the event DestroyBuilding or do it differently altogether by calling the event SellBuilding, which takes the money-part out of your hands altogether. In that case, the code would look something like this:

code:

for( i = 0 ; i < Cities(inetPlayer); i = i + 1 ){
GetCityByIndex(inetPlayer, i, tmpCity);
if(CityHasBuilding(tmpCity, "IMPROVE_COMPUTER_CENTER")){
Event:SellBuilding(tmpCity, BuildingDB(IMPROVE_COMPUTER_CENTER));
}
}

And the AddGold and B variable could be left out entirely. Note that I didn't test this and that I'm not sure if this is actually your intention, but I *think* it does what you're looking for.

kaan
Settler
Denmark
Mar 2001
posted March 29, 2001 06:27   Click Here to See the Profile for kaanClick Here to Email kaan  send a private message to kaan Visit kaan's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
thats exacly what that piece of code is used for :-) thanks for pointing the actual procedure out.

the key to the fix is as you noted the "bugfix" advances. they refer only to themselves and dont appear in great library, so the player wont notice them unless they cheat.
these advances makes the computer center (or whatever) obsolete.
if we take the internet example then the timeline is as follows

this is only a crude model of my script, but a picture can sometimes say more than a thousand words ;-)

klaus

Locutus
Prince
Apolyton Borg Hengelo/Enschede, The Netherlands
Nov 1999
posted March 29, 2001 06:55   Click Here to See the Profile for LocutusClick Here to Email Locutus  send a private message to LocutusSend a Message to UIN: 52912776 Visit Locutus's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Ah, it seems like we have another RRose user (right?) in the house I think you just scared away any non-CS students and non-ITers that might have been following this thread

Ok, now I get it. But in that case you're probably better off with my solution: that keeps the units out of the buildqueues as well but without all the hassle, a simple if-clause does the trick there. But of course, you already wrote this so I can see how you might want to keep it, it seems like it would work just as well as my solution.

kaan
Settler
Denmark
Mar 2001
posted March 29, 2001 07:14   Click Here to See the Profile for kaanClick Here to Email kaan  send a private message to kaan Visit kaan's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
As we say in school, RRR (Rational Rose Rules), and those non techies were scared long time ago ;-)

assuming that both solutions works equally well, and only playtesting will show that, the only difference between the two scripts could be effeciency and since that is impossible to determine without the .exe source then we will never know. but most likely is that an undocumentet feature from activision has been tested to be efficient, then again, what did they really test before shipping ;-)

I also admit that your solution is much more elegant and easyer to use for most people.

klaus kaan
[This message has been edited by kaan (edited March 29, 2001).]

Apolyton Civilization Site Forums
> > > CtP2-Creation Forum

next newest topic | next oldest topictop of page

All times are EDT

Administrative Options: Close Topic | Archive/Move | Delete Topic | Top
Post New Topic  Post A ReplyPost A Reply In A New Window
Hop to:

Contact Us
Apolyton Civilization Site

Powered by: Ultimate Bulletin Board, Version 5.44a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 2000.

AltaVista Type or paste text or Web address (beginning with http://) here:
Powered
by Systran
Translate from: 

Front Page | Civilization III | Dinosaurs | Civilization II | Call to Power | Call to Power II | Alpha Centauri | Alternative Civs | Misc | Links | About ACS | GameStats
GameLeague | Scenario League | HAC | Civilization Scenario Collection | Spanish CivII Site | Clash of Civs | CtP Maps | Art of War | WesW's Ctp1/2 Site