Results 1 to 7 of 7

Thread: Finicky conditions

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Quinn Inuit's Avatar Artifex
    Join Date
    Sep 2006
    Location
    Virginia, USA
    Posts
    4,968

    Default Finicky conditions

    I've spent longer than I'd like to admit figuring this out, so I thought I'd put it out there for others to spare them such toils.

    This script will work:
    Code:
    monitor_event SettlementTurnStart SettlementName Roma
        and GarrisonToPopulationRatio > 0.049
        things happen...
    end_monitor
    This script will not work:
    Code:
    monitor_event SettlementTurnStart SettlementName Roma
        if GarrisonToPopulationRatio > 0.049
        things happen...
        end_if
    end_monitor
    I can't explain why, but there you have it. I tried all kinds of permutations of the latter before realizing that I'd only seen the former phrasing functioning, and upon switching the code to the former phrasing it worked perfectly.
    RTR Platinum Team Apprentice, RTR VII Team Member, and Extended Realism Mod Team Coordinator. Proud member of House Wilpuri under the patronage of Pannonian

    The ExRM forum: come for the mod, stay for the Classical History discussions. Or vice versa.

    My writing-related Twitter feed.

  2. #2
    HouseOfHam's Avatar Primicerius
    Join Date
    Apr 2007
    Location
    Minnesota, USA
    Posts
    3,030

    Default Re: Finicky conditions

    This condition requires an object exported by the event, so I suspect it depends on how many of these ifs you have in your monitor. If there is just one, I would probably work. If more than one, it won't.
    RTR website/SVN admin

    - Settlement coordinate locator -for RTW/M2TW
    - EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
    - RTW scripting tutorials
    - n-turns per year script generator

  3. #3
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,751
    Blog Entries
    3

    Default Re: Finicky conditions

    As far as I'm aware if (and while) statements can only use conditions that have no requirements, GarrisonToPopulationRatio requires settlement to be exported and so cannot be used in either an if or a while statement.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  4. #4
    Quinn Inuit's Avatar Artifex
    Join Date
    Sep 2006
    Location
    Virginia, USA
    Posts
    4,968

    Default Re: Finicky conditions

    I'm curious, what does "export" mean, and why does that mess with "if" statements? I saw that a few nights ago in the BI_docs description of GarrisonToPopulationRati, but I don't know what it means.
    RTR Platinum Team Apprentice, RTR VII Team Member, and Extended Realism Mod Team Coordinator. Proud member of House Wilpuri under the patronage of Pannonian

    The ExRM forum: come for the mod, stay for the Classical History discussions. Or vice versa.

    My writing-related Twitter feed.

  5. #5
    Muizer's Avatar member 3519
    Patrician Artifex

    Join Date
    Apr 2005
    Location
    Netherlands
    Posts
    10,795

    Default Re: Finicky conditions

    Events export variables. In the docudemon file the variables are listed after "exports". Conditions import variables. In the docudemon file these are listed after "trigger requirements"
    When you code a trait trigger or script monitor, you must make sure that the conditions you want to use get the appropriate input variables from the event you're monitoring. If not, the condition won't work.

    I've also come across the phenomenon that such event-condition combinations do not work in combination with if-end_if brackets. Sadly, you will have to programme a separate monitor for every alternative. (If not, I'd sure like to know about it too!).

    There are conditions which do not rely in imported variables from events. In the docudemon file they are the ones that start with I_. As long as you use only this type of condition, you can use if-end_if brackets.

    Anyway, that's my understanding.
    Last edited by Muizer; August 12, 2011 at 05:23 AM.
    "Lay these words to heart, Lucilius, that you may scorn the pleasure which comes from the applause of the majority. Many men praise you; but have you any reason for being pleased with yourself, if you are a person whom the many can understand?" - Lucius Annaeus Seneca -

  6. #6
    Quinn Inuit's Avatar Artifex
    Join Date
    Sep 2006
    Location
    Virginia, USA
    Posts
    4,968

    Default Re: Finicky conditions

    Interesting. Thanks for the explanation.
    RTR Platinum Team Apprentice, RTR VII Team Member, and Extended Realism Mod Team Coordinator. Proud member of House Wilpuri under the patronage of Pannonian

    The ExRM forum: come for the mod, stay for the Classical History discussions. Or vice versa.

    My writing-related Twitter feed.

  7. #7
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,751
    Blog Entries
    3

    Default Re: Finicky conditions

    I believe there are also a few condition that have no requirements that don't start with I_, but those might be limited to M2TW.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •