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 > Need help in 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
Jules is offline Jules
Chieftain
Chairman & CEO, Dallas Oil Company
Jul 2001
time: 00:14
Question  Old Post 21-07-2001 09:29 Visit Jules's homepage!
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
Need help in SLIC Support Apolyton, buy Civilization III: Complete

I'm trying to write a program that will warn the player whenever they discover an advance the makes a building obsolete. The popup message will tell the player the advance, the building made obsolete, and the replacement building. Here's a sample of my code:

code:
messagebox 'BUILDING_OBSOLETE_1_MSG' { Text(ID_BUILDING_OBSOLETE_1); Show(); } HandleEvent(GrantAdvance) 'BuildingExpires' post { int_t advanceType; advanceType = value[0]; advance[0] = advanceType; if (advanceType == AdvanceDB(ADVANCE_ECONOMICS)) { building[0] = BuildingDB(IMPROVE_BAZAAR); building[1] = BuildingDB(IMPROVE_BROKERAGE); Message(player[0], 'BUILDING_OBSOLETE_1_MSG'); } }


Then in "info_str.txt" I have the following string:

BUILDING_OBSOLETE_1 "Our knowledge of {advance[0].name} has made the improvement {building[0].name} obsolete. However we can now build the {building[1].name} improvement instead."

Now everything works except when I get the popup message in-game, where it should say "Bazaar" it says "{building[0].name}" and where it should say "Brokerage" it says "{building[1].name}". I don't get it.

Please help!

Immortal Wombat is offline Immortal Wombat
Prince
in perpetuity
Dec 2000
time: 05:14
  Old Post 21-07-2001 20:14 Visit Immortal Wombat's homepage!
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Remove this text

I think this is caused when you have DebugSlic set to No. Its one of those annoying things that Activision didn't think much about.
Try it, I'm fairly sure that will help.

Peter Triggs is offline Peter Triggs
Prince
Gone Fishin, Canada
Jan 2000
time: 05:14
  Old Post 21-07-2001 20:59
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Help yourself to an AD-FREE life

Jules,

For your specific example, you could use:

code:
HandleEvent(GrantAdvance) 'BuildingExpires' post { advance[0]=value[0]; if (value[0] == AdvanceDB(ADVANCE_ECONOMICS)) { Message(player[0], 'BUILDING_OBSOLETE_1_MSG'); } }


with:

BUILDING_OBSOLETE_1 "Our knowledge of {advance[0].name} has made the improvement {BuildingDB(IMPROVE_BAZAAR)} obsolete. However we can now build the {BuildingDB(IMPROVE_BROKERAGE)} improvement instead."

But you'll then have to do this over again for each advance that makes a building obsolete. As there's quite a few of them you might want to set up a mapping from advances to buildings via a system of arrays. This is what I did in my UnitUpdater. In your case it would look something like this:

obsadv[0]=AdvanceDB(ADVANCE_ECONOMICS) ;
OBS_BUILDING_TYPE[0]= BuildingDB(IMPROVE_BAZAAR);
NEW_BUILDING_TYPE[0]= BuildingDB(IMPROVE_BROKERAGE);

obsadv[1]=AdvanceDB(ADVANCE_whatever) ;
OBS_BUILDING_TYPE[1]= BuildingDB(IMPROVE_whatever);
NEW_BUILDING_TYPE[1]= BuildingDB(IMPROVE_whatever);

obsadv[2]=AdvanceDB(ADVANCE_and so on) ;
OBS_BUILDING_TYPE[2]= BuildingDB(IMPROVE_and so on);
NEW_BUILDING_TYPE[2]= BuildingDB(IMPROVE_and so on);

Your handler would then look like:

code:
// Globals: int_t BUILDING_INDEX; int_t OBS_BUILDING_TYPE[]; int_t NEW_BUILDING_TYPE[]; HandleEvent(GrantAdvance) 'BuildingExpires' post { int_t i; int_t obsadv[]; // the above data arrays can go here for(i=0; i


with:

BUILDING_OBSOLETE_1 "Our knowledge of {advance[0].name} has made the improvement {BuildingDB(OBS_BUILDING_TYPE[BUILDING_INDEX])} obsolete. However we can now build the {BuildingDB(NEW_BUILDING_TYPE[BUILDING_INDEX])} improvement instead."


This is assuming that no advance obsoletes more than one type of building. It's a bit more complicated if you allow that to happen. No guarentees the above code will work as it stands; I might have forgotten something.

Jules is offline Jules
Chieftain
Chairman & CEO, Dallas Oil Company
Jul 2001
time: 00:14
  Old Post 22-07-2001 02:15 Visit Jules's homepage!
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Increase the size of your Attachments

Thanks Peter! Your suggestion worked.

Immortal: Don't you have to have DebugSLIC set to "no" in order to run the Med Mod? But that's a moot point now since I got it to work.

For anyone with the Med Mod interested in implementing this little bit of SLIC, here's the full code:

code:
messagebox 'BUILDING_OBSOLETE_1_MSG' { Text(ID_BUILDING_OBSOLETE_1); Show(); } messagebox 'BUILDING_OBSOLETE_2_MSG' { Text(ID_BUILDING_OBSOLETE_2); Show(); } int_t BUILDING_INDEX; int_t OBS_BUILDING_1_TYPE[]; int_t OBS_BUILDING_2_TYPE[]; int_t NEW_BUILDING_TYPE[]; HandleEvent(GrantAdvance) 'BuildingExpires' post { int_t i; int_t obsadv[]; int_t advanceType; advanceType = value[0]; advance[0] = advanceType; obsadv[0] = AdvanceDB(ADVANCE_ECONOMICS); OBS_BUILDING_1_TYPE[0] = BuildingDB(IMPROVE_BAZAAR); NEW_BUILDING_TYPE[0] = BuildingDB(IMPROVE_BROKERAGE); obsadv[1] = AdvanceDB(ADVANCE_DIGITAL_ENCRYPTION); OBS_BUILDING_1_TYPE[1] = BuildingDB(IMPROVE_BANK); NEW_BUILDING_TYPE[1] = BuildingDB(IMPROVE_E_BANK); obsadv[2] = AdvanceDB(ADVANCE_MASS_MEDIA); OBS_BUILDING_1_TYPE[2] = BuildingDB(IMPROVE_CITY_CLOCK); NEW_BUILDING_TYPE[2] = BuildingDB(IMPROVE_TELEVISION); obsadv[3] = AdvanceDB(ADVANCE_PUBLIC_EDUCATION); OBS_BUILDING_1_TYPE[3] = BuildingDB(IMPROVE_ACADEMY); NEW_BUILDING_TYPE[3] = BuildingDB(IMPROVE_ORBITAL_LABORATORY); obsadv[4] = AdvanceDB(ADVANCE_COMPUTER); OBS_BUILDING_1_TYPE[4] = BuildingDB(IMPROVE_PUBLISHING_HOUSE); NEW_BUILDING_TYPE[4] = BuildingDB(IMPROVE_COMPUTER_CENTER); obsadv[5] = AdvanceDB(ADVANCE_OIL_REFINING); OBS_BUILDING_1_TYPE[5] = BuildingDB(IMPROVE_MILL); NEW_BUILDING_TYPE[5] = BuildingDB(IMPROVE_OIL_REFINERY); obsadv[6] = AdvanceDB(ADVANCE_ROBOTICS); OBS_BUILDING_1_TYPE[6] = BuildingDB(IMPROVE_FACTORY); NEW_BUILDING_TYPE[6] = BuildingDB(IMPROVE_ROBOTIC_PLANT); obsadv[7] = AdvanceDB(ADVANCE_NANO_ASSEMBLY); OBS_BUILDING_1_TYPE[7] = BuildingDB(IMPROVE_OIL_REFINERY); NEW_BUILDING_TYPE[7] = BuildingDB(IMPROVE_NANITE_FACTORY); obsadv[8] = AdvanceDB(ADVANCE_FUSION); OBS_BUILDING_1_TYPE[8] = BuildingDB(IMPROVE_NUCLEAR_PLANT); NEW_BUILDING_TYPE[8] = BuildingDB(IMPROVE_FUSION_PLANT); obsadv[9] = AdvanceDB(ADVANCE_FUEL_CELLS); OBS_BUILDING_1_TYPE[9] = BuildingDB(IMPROVE_PUBLIC_TRANSPORTATION); NEW_BUILDING_TYPE[9] = BuildingDB(IMPROVE_ECO_TRANSIT); obsadv[10] = AdvanceDB(ADVANCE_MOLECULAR_SYNTHESIS); OBS_BUILDING_1_TYPE[10] = BuildingDB(IMPROVE_RECYCLING_PLANT); NEW_BUILDING_TYPE[10] = BuildingDB(IMPROVE_MATTER_DECOMPILER); obsadv[11] = AdvanceDB(ADVANCE_NEURAL_REPROGRAMMING); OBS_BUILDING_1_TYPE[11] = BuildingDB(IMPROVE_COURTHOUSE); NEW_BUILDING_TYPE[11] = BuildingDB(IMPROVE_BEHAVIORAL_MOD_CENTER); obsadv[12] = AdvanceDB(ADVANCE_AI_SURVEILLANCE); OBS_BUILDING_1_TYPE[12] = BuildingDB(IMPROVE_CORRECTIONAL_FACILITY); NEW_BUILDING_TYPE[12] = BuildingDB(IMPROVE_SECURITY_MONITOR); obsadv[13] = AdvanceDB(ADVANCE_MILITARY_ENGINEERING); OBS_BUILDING_1_TYPE[13] = BuildingDB(IMPROVE_CITY_WALLS); NEW_BUILDING_TYPE[13] = BuildingDB(IMPROVE_BASTION); obsadv[14] = AdvanceDB(ADVANCE_ELECTRICITY); OBS_BUILDING_1_TYPE[14] = BuildingDB(IMPROVE_THEATER); OBS_BUILDING_2_TYPE[14] = BuildingDB(IMPROVE_ARENA); NEW_BUILDING_TYPE[14] = BuildingDB(IMPROVE_CIVIC_CENTER); obsadv[15] = AdvanceDB(ADVANCE_UNIFIED_PHYSICS); OBS_BUILDING_1_TYPE[15] = BuildingDB(IMPROVE_BALLISTA_TOWERS); OBS_BUILDING_2_TYPE[15] = BuildingDB(IMPROVE_BASTION); NEW_BUILDING_TYPE[15] = BuildingDB(IMPROVE_FORCEFIELD); for (i = 0; i < 16; i = i + 1) { BUILDING_INDEX = i; if (i == 14 || i == 15) { if (advanceType == obsadv[i]) { message(player[0], 'BUILDING_OBSOLETE_2_MSG'); } } elseif (advanceType == obsadv[i]) { message(player[0], 'BUILDING_OBSOLETE_1_MSG'); } } }


And in your "info_str.txt":
BUILDING_OBSOLETE_1 "Our knowledge of {advance[0].name} has made the improvement {BuildingDB(OBS_BUILDING_1_TYPE[BUILDING_INDEX])} obsolete. However we can now build the {BuildingDB(NEW_BUILDING_TYPE[BUILDING_INDEX])} improvement instead."
BUILDING_OBSOLETE_2 "Our knowledge of {advance[0].name} has made the improvements {BuildingDB(OBS_BUILDING_1_TYPE[BUILDING_INDEX])} and {BuildingDB(OBS_BUILDING_2_TYPE[BUILDING_INDEX])} obsolete. However we can now build the {BuildingDB(NEW_BUILDING_TYPE[BUILDING_INDEX])} improvement instead."

You'll have to change this a little bit since I use a Civic Center building to replace Theaters and Arenas after the discovery of Electrification.

Peter Triggs is offline Peter Triggs
Prince
Gone Fishin, Canada
Jan 2000
time: 05:14
  Old Post 22-07-2001 02:27
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Get a bigger avatar today!

Glad it worked. Mind you, I don't know what happened to the code I posted earlier.

Ben's right about DebugSlic. If you don't have DebugSlic=Yes you won't get proper Error messages.

Immortal Wombat is offline Immortal Wombat
Prince
in perpetuity
Dec 2000
time: 05:14
  Old Post 22-07-2001 02:58 Visit Immortal Wombat's homepage!
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

Yeah, I don't run MedMod...

Jules is offline Jules
Chieftain
Chairman & CEO, Dallas Oil Company
Jul 2001
time: 00:14
  Old Post 22-07-2001 03:36 Visit Jules's homepage!
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

Here's a different question:
Has anybody tried to implement the AddHappyTimer event? It has a city argument, and three other integer arguments. I'm guessing two of those are for amount of (un)happiness and duration, but I'm clueless as to what the third one is for. It'd be kind of neat to use this with Immortal's natural disasters code, like say random political unrest strikes a city. Like what's happening in Italy right now with the protests against the G8 summit.

  < 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.0401 seconds (89.47% PHP - 10.53% 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