Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 29

Thread: Best way to load questslog.txt

  1. #1
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,441

    Question Best way to load questslog.txt

    I would like to access all the quest steps in questslog.txt for a script I'm working on. I tried:

    Code:
          string[string] qs;
          file_to_map("questslog.txt",qs);
    Thinking that would give me the property name as the index, and all the other fields (complete with tabs) as the remaining string. I seem to recall a time when that used to work. Then I could just do a split_string(qs[<property>],"\t") to get all my quest steps in a row, no matter how many there are.

    Unfortunately, this only gives me the first string (in this case, the quest title) -- nothing after the first tab.

    There are some quests with upwards of 30 steps. What sort of map can I use to read the questslog.txt file without losing steps?
    Last edited by zarqon; 04-24-2017 at 12:11 PM.
    Sig by JakAtk
    My scripts: One-Click Wossname | Om******t (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mer********d (?!) | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | CanAdv | Script Registry | Map Manager | About Bats
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  2. #2
    Senior Member ckb's Avatar
    Join Date
    Mar 2006
    Posts
    739

    Default

    There are some quests with upwards of 30 steps. What sort of map can I use to read the questslog.txt file without losing steps?
    Originally Posted by zarqon View Post
    Based on my experience with importing mafia datafiles with file_to_map(), I believe you would need

    Code:
    string[string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string] qs;
    file_to_map("questslog.txt",qs);
    Ugly, but functional. Then you can parse 'qs' into other smaller maps for each quest.

  3. #3
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,441

    Default

    Thanks ckb. Was afraid I'd have to resort to something like that. The other option that comes to mind (which retains a single map key) is using a record with dozens of string fields, but that's even harder to use because the fields can't be foreached.
    Sig by JakAtk
    My scripts: One-Click Wossname | Om******t (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mer********d (?!) | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | CanAdv | Script Registry | Map Manager | About Bats
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  4. #4
    Developer
    Join Date
    Aug 2009
    Posts
    2,675

    Default

    Maybe a dumb question, but why can't you rely on Mafia's built-in quest tracking?

  5. #5
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,441

    Default

    I wish to list all the steps for an informational script. The data file is rather difficult to parse as a human, so I'd like to present it as a table with "unstarted", "step2", etc. on the left and the associated text on the right.

  6. #6
    Senior Member ckb's Avatar
    Join Date
    Mar 2006
    Posts
    739

    Default

    I wish to list all the steps for an informational script.
    Originally Posted by zarqon View Post
    This makes me think of loading it as part of a relay script, where you parse and format the text with regex rather than use file_to_map(). You would probably need something (javascript?) to load questslog.txt, but if anyone can do that, its probably zarqon.

  7. #7
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,441

    Default

    It is for a relay script. Unfortunately since questslog.txt is actually in the mafia .jar rather than /data, I lack the kung fu to access it that way. I also don't want to rely on hitting Sourceforge to access the source file there, given its relative sluggishness and propensity for taking vacation.

    It's looking like string[string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string] is the only way to go. *sigh* ... *plays Factorio*
    Sig by JakAtk
    My scripts: One-Click Wossname | Om******t (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mer********d (?!) | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | CanAdv | Script Registry | Map Manager | About Bats
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  8. #8
    Developer
    Join Date
    Apr 2010
    Posts
    4,051

    Default

    Also bear in mind some of those entries aren't full quest text, as smaller sections were used to match different classes text where that differs.

  9. #9
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,441

    Default

    Ended up going with the record:

    Code:
    record queststeps {      // need this for reading questslog.txt
       string title;
       string started;
       string step1;   string step2;   string step3;   string step4;   string step5;
       string step6;   string step7;   string step8;   string step9;   string step10;
       string step11;  string step12;  string step13;  string step14;  string step15;
       string step16;  string step17;  string step18;  string step19;  string step20;
       string step21;  string step22;  string step23;  string step24;  string step25;
       string step26;  string step27;  string step28;  string step29;  string step30;
       string step31;  string step32;  string step33;  string step34;  string step35;    // hopefully there will never be more than 35 steps (presently Nemesis has 30)
    };
    Due to difficulties in parsing a many-dimensional map into 2D. Wrote a nifty recursive function to do it, but ASH got flummoxed by my attempt to foreach an "aggregate".

    Now that I can see the questlog info, I note evidence of some things being hardcoded behind the scenes, i.e. places where the steps probably don't all seem to map directly to the usual quest step progression.

    For example, I assume that the last THREE steps of questL12War, rather than mapping to step2, step3, and finished, respectively, instead all map to finished. Are there any other oddities that anyone knows about?
    Sig by JakAtk
    My scripts: One-Click Wossname | Om******t (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mer********d (?!) | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | CanAdv | Script Registry | Map Manager | About Bats
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  10. #10
    Developer
    Join Date
    Apr 2010
    Posts
    4,051

    Default

    Looks to me like the War may be the main place that happens (though some steps cannot be inferred from quest log, which is another issue), doesn't actually look like the information is used, though, just additionally checks the text and sets to FINISHED, rather than looking at the identified quest step and setting to FINISHED.

    The bits of mafia to look at though are QuestDatabase, QuestLogRequest and QuestManager.

Posting Permissions

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