nickbabcock / Pdoxcl2Sharp

A Paradox Interactive general file parser
MIT License
39 stars 13 forks source link

Storing and delaying some tokens? #34

Closed ashjack closed 3 years ago

ashjack commented 3 years ago

Hi, I've been experimenting with this for a few days now, and have been trying to use it for events, similar to how event files are structured in Paradox games. In Paradox games, events consist of lines that define the event, such as the ID, name, etc, as well as lines that dictate what happens when the event is called, when certain options are picked, what conditions the event runs in, etc.

id="testevent"
name="testevent"
desc="testevent"

option={
    name="testoption"
    desc="testoption"
    ai_chance=0

    stability = -5

    existing_province={
        name="testprov"
    }
}

This is the basic structure I have for a test event.

Some fields, such as id, name, desc and ai_chance for the option type need to be set once, and that is fine, but the fields after that, stability and existing_province (a province type based off the example code which is edited via parser.Parse) should only be changed when the option is clicked.

Obviously I'm not asking you to write any solutions to this, I was just wondering if you could point me in the right direction in coming up with a solution, as I am still quite new to Actions in C#.

Thank you!

nickbabcock commented 3 years ago

You should be able to take inspiration from this test case

You don't need to use actions if you are uncomfortable with actions. Implementing IParadoxRead is sufficient.