January 31, 2002, 14:27
|
#1
|
Prince
Local Time: 21:02
Local Date: October 31, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
Yet another grossly unfair SLIC thread
Quote:
|
From the SLIC scripting language modification page
SLIC provides direct read-only access to much of the data contained in the game databases. Here is the list of databases than can be used:
[snip]
But it doesn't stop there. Many fields from each database are also accessible. Any bitfield, integer, or floating point value that is in the main body of a record (NOT values in sub-structures!) can be used. Floating point values are multiplied by 100 and converted to ints, since SLIC does not otherwise support floating point variables.
Examples:
tankAttack = UnitDB(UNIT_TANK).Attack;
costOfAdvInfantryTactics = AdvanceDB(ADVANCE_ADV_INFANTRY_TACTICS).Cost;
minimumHappinessForDefaultStrategy = StrategyDB(STRATEGY_DEFAULT).MinimumHappiness;
Please explore the database text files to see what data you might be interested in. There are far too many fields available to enumerate here.
|
Has anyone had any luck using these? Because I tried using things like that for some SLIC a while ago, and it didn't work. If they can be accessed, then GovernmentDB(GOVERNMENT_MONARCHY).MaximumCityLimit (for example  )could come in very handy...
|
|
|
|
January 31, 2002, 14:41
|
#2
|
Deity
Local Time: 22:02
Local Date: October 31, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
|
I think that is *exactly* what you're looking for (that was actually what I was going to suggest in my email but you beat me to it  ). I know it works well with (at least some) entries from units.txt (used it for the unit repair code in the MedMod) but I haven't tested it for the governments...
|
|
|
|
February 21, 2002, 21:54
|
#3
|
King
Local Time: 20:02
Local Date: October 31, 2010
Join Date: Jan 2000
Location: Gone Fishin, Canada
Posts: 1,059
|
Argh!!! I've just spent six or seven hours sorting out a bug. Here's the source:
Quote:
|
int_t denotes an integer argument that corresponds to a player. Ints and players are mostly interchangeable in SLIC, they are listed specially here for clarity.
|
"mostly"!!! Never had any problems with this before (well, I think so but now I'm a bit worried). But here's a context where ints and players are not interchangeable:
[code]
trigger 'HumanAcceptsAICounter' on "DipWizard.ViewButtons.AcceptButton" when (AI_COUNTER) {
//stuff
}
If you try to use "player[0]" and "player[1]" in here, nothing happens. Nothing. No error messages, just nothing. Replace them with int_t types (or, hmm, I suppose "player[0].owner" and "player[1].owner") and it works. Makes me wonder where else they're not interchangeable.
BTW, in a quote above in this thread, Joe said:
Quote:
|
Any bitfield, integer, or floating point value that is in the main body of a record (NOT values in sub-structures!) can be used.
|
I've never managed to get anything except integers. Anybody else had any luck on this?
|
|
|
|
February 22, 2002, 10:11
|
#4
|
Prince
Local Time: 21:02
Local Date: October 31, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
Quote:
|
Originally posted by Peter Triggs
I've never managed to get anything except integers. Anybody else had any luck on this?
|
No, not at all.
Its annoying about the substructures as well. It renders most of the tile improvement data useless, as its all sub-grouped by terrain.
__________________
Concrete, Abstract, or Squoingy?
"I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis
|
|
|
|
February 22, 2002, 10:39
|
#5
|
Prince
Local Time: 21:02
Local Date: October 31, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
When I was making the Tile Improvement Rush Option code for Sir Ralph, I found that the CreateImprovement event triggered once or twice at the beginning of every turn. And it seems the improvement created is #1. In the normal game: an Advanced Mine (or two, I forget).
I had to re-order the tileimp.txt so that a dummy TI was #1, then set the code not to trigger on CreateImprovement(1,xy,1,0);
Wierd. And why is the last number always 0?
__________________
Concrete, Abstract, or Squoingy?
"I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis
|
|
|
|
February 22, 2002, 19:53
|
#6
|
Deity
Local Time: 22:02
Local Date: October 31, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
|
That's very...interesting, Peter. I will certainly look into that in more detail at some point.
No, I haven't been able to get non-integer values from the database either.
Ben,
Aha, I was wondering where that check for value[?] == 1 (or whatever it was) was for, thanks for clearing that up.
I'm doing this from the top of my head but usually the last argument of an event indicates a reason (why does the event take place?). It can have any value, won't affect the game one bit AFAIK (but 0 is a nice safe number, better not take any risks - after all, it's still SLIC).
|
|
|
|
Posting 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
|
|
|
All times are GMT -4. The time now is 16:02.
|
|