Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Miscellaneous > Archive > CtP2-Creation/AI/Mods/Scenarios-Archive > any suggestions? (slic)
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!

bottom of page
  
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
kaan is offline kaan
Prince
Aarhus
Mar 2001
time: 05:14
Post  Old Post 27-03-2001 20:23
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
any suggestions? (slic) Support Apolyton, buy Alpha Centauri

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 is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:14
Post  Old Post 29-03-2001 00:40 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Support Apolyton, buy Civilization 2

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 is offline kaan
Prince
Aarhus
Mar 2001
time: 05:14
Post  Old Post 29-03-2001 01:49
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Increase Your PM Length

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_DECOMPI
LER));
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 is offline kaan
Prince
Aarhus
Mar 2001
time: 05:14
Post  Old Post 29-03-2001 02:18
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Browse Apolyton AD-FREE

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 is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:14
Post  Old Post 29-03-2001 15:34 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

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 is offline kaan
Prince
Aarhus
Mar 2001
time: 05:14
Post  Old Post 29-03-2001 16:27
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Get a bigger avatar today!

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 is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:14
Post  Old Post 29-03-2001 16:55 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Support Apolyton buy from Amazon

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 is offline kaan
Prince
Aarhus
Mar 2001
time: 05:14
Post  Old Post 29-03-2001 17:14
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

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).]

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:14.
Apolyton Time is 00:14.
    top of page
Rate This Thread:
archivepost
Forum Jump:
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0357 seconds (88.53% PHP - 11.47% MySQL) with 31 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net