Announcement

Collapse
No announcement yet.

Yet another grossly unfair SLIC thread

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Yet another grossly unfair SLIC thread

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

  • #2
    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...
    Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

    Comment


    • #3
      Argh!!! I've just spent six or seven hours sorting out a bug. Here's the source:

      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:

      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?

      Comment


      • #4
        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

        Comment


        • #5
          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

          Comment


          • #6
            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).
            Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

            Comment

            Working...
            X