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 > accessing constants in DB files
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
ahenobarb is offline ahenobarb
Prince

Nov 2001
time: 05:26
  Old Post 17-03-2003 01:17
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
accessing constants in DB files Avatar Enlargement: We've got the solution

Does anyone know how to access the numerical constants in the non-unit database files?

If you want to get the constants for the unit.txt file you can ues this method:

UnitRecord[0] = UnitDB(UNIT_WARRIOR);
tmpArm = UnitDB(UnitRecord[0]).Armor;

But the unit database file is set up like this:

## UNIT 0
UNIT_ABOLITIONIST {
...
Firepower 1
Armor 1
...
}

How would you access the constants in the terrain file when the values there are set up like this?

TERRAIN_FOREST {
EnvBase {
Score 50
Food 10
Shield 5
Gold 10
}
}

I noticed in the Greatlibrary.txt file, they just wrote in the values by hand, but I'm hoping there is a way for SLIC to access the information without needing to be told what the values are.

Immortal Wombat is offline Immortal Wombat
Prince
in perpetuity
Dec 2000
time: 05:26
  Old Post 17-03-2003 02:37 Visit Immortal Wombat's homepage!
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Support Apolyton buy from Amazon

I'm pretty sure you can use the method above, replacing unitrecord[0] with value[0].

ahenobarb is offline ahenobarb
Prince

Nov 2001
time: 05:26
  Old Post 17-03-2003 02:44
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Tired of ads?

quote:
Originally posted by Immortal Wombat
I'm pretty sure you can use the method above, replacing unitrecord[0] with value[0].


Thanks, IW. I'll give it a try.

ahenobarb is offline ahenobarb
Prince

Nov 2001
time: 05:26
  Old Post 17-03-2003 02:54
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

The game launches but hangs when a game is started with:

Value[0] = TerrainDB(TERRAIN_FOREST);
tmpAtt = TerrainDB(Value[0]).food;

I think the problem is how to get the values inside the second set of brackets.

code:
TERRAIN_FOREST { EnvBase { Score 50 Food 10 Shield 5 Gold 10 } }


How to make "TerrainDB(Value[0]).food" into "TerrainDB(Value[0]).EnvBase.food"? Obviously this syntax won't work, so I tried a double hop with:

Value[0] = TerrainDB(TERRAIN_FOREST);
Value[1] = TerrainDB(Value[0]).Envbase;
tmpAtt = TerrainDB(Value[1]).food;

But this just causes another game hang. ANy ideas?

Last edited by ahenobarb on 17-03-2003 at 03:07

Immortal Wombat is offline Immortal Wombat
Prince
in perpetuity
Dec 2000
time: 05:26
  Old Post 17-03-2003 03:11 Visit Immortal Wombat's homepage!
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Support Apolyton or Terrorists Win

Ah. oops. Problem:

from the docu:
quote:
Any bitfield, integer, or floating point value that is in the main body of a record (NOT values in sub-structures!)

That would be a substructure you're trying to access.

ahenobarb is offline ahenobarb
Prince

Nov 2001
time: 05:26
  Old Post 17-03-2003 03:25
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Support Apolyton

quote:
Originally posted by Immortal Wombat
Ah. oops. Problem:

from the docu:
quote:
Any bitfield, integer, or floating point value that is in the main body of a record (NOT values in sub-structures!)

That would be a substructure you're trying to access.


Bummer.

Since, I've got you here. What about accessing the non-integer constant values in the "userprofile.txt" file. For instance, if you want the number of players.

tmpNum = preference("NumPlayers");

What about the "Yes" and "No" fields. I've tried to use them as binary 1/0 numbers, but no go. Also, StringCompare always seems to return false. Even more frustrating, StringCompare returns false (0) for:

x = StringCompare("Yes", "Yes");

Immortal Wombat is offline Immortal Wombat
Prince
in perpetuity
Dec 2000
time: 05:26
  Old Post 17-03-2003 03:42 Visit Immortal Wombat's homepage!
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

StringCompare is junk. It doesn't work for anything useful, and it seems not always for anything useless.

I've no idea about the other preferences.

ahenobarb is offline ahenobarb
Prince

Nov 2001
time: 05:26
  Old Post 17-03-2003 03:54
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Support Apolyton, buy Call to Power 2

quote:
Originally posted by Immortal Wombat
StringCompare is junk. It doesn't work for anything useful, and it seems not always for anything useless.

I've no idea about the other preferences.


Thanks for confirming my opinion of StringCompare! and the other help as well. If I figure out how to get the Yes/No to work, I'll let everyone know.

Peter Triggs is offline Peter Triggs
Prince
Gone Fishin, Canada
Jan 2000
time: 05:26
  Old Post 17-03-2003 04:05
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Support Apolyton or Terrorists Win

While we're talking functions, what about "IsContinentBiggerThan(location,size)"? I seem to have had it returning 1's and 0's for the same location and the same size

ahenobarb is offline ahenobarb
Prince

Nov 2001
time: 05:26
  Old Post 17-03-2003 04:25
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Put an end to popups!

quote:
Originally posted by Peter Triggs
While we're talking functions, what about "IsContinentBiggerThan(location,size)"? I seem to have had it returning 1's and 0's for the same location and the same size


What values are you putting in the parenthesis? I haven't used it but I think it should be:

x = IsContinentBiggerThan(tmpLoc, 54);

So it should check the size of the landmass that tmpLoc is part of and determine if there are more than 54 land squares that form the continent. 1 if there are, 0 if there is not.

My 2c, without knowing what values have been entered.

Peter Triggs is offline Peter Triggs
Prince
Gone Fishin, Canada
Jan 2000
time: 05:26
  Old Post 17-03-2003 05:26
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Suffering from ads?

That's the theory. But, IIRC, I tried it with size=100 and size=10000 (bigger than the map area) and got incomprehensible results.

I wanted to use it in a function to find the areas of the oceans (it's supposed to work with oceans too) that two water locations are in so that if the areas were the same, I would know that they were in the same ocean.

ahenobarb is offline ahenobarb
Prince

Nov 2001
time: 05:26
  Old Post 17-03-2003 06:06
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Support Apolyton buy from Amazon

quote:
Originally posted by Peter Triggs
That's the theory. But, IIRC, I tried it with size=100 and size=10000 (bigger than the map area) and got incomprehensible results.

I wanted to use it in a function to find the areas of the oceans (it's supposed to work with oceans too) that two water locations are in so that if the areas were the same, I would know that they were in the same ocean.


Hmmm. Didn't know that about the oceans, but it makes sense I suppose. One problem may be however, that the question is whether the continent is "bigger", so if it is the same size, the answer is no. You may have to do a size -1 equation to get the result?

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:26.
Apolyton Time is 00:26.
    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.0398 seconds (87.42% PHP - 12.58% 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