Need help testing something (flag related)

Discussion in 'General Modification' started by Sitra Achara, Nov 5, 2006.

Remove all ads!
  1. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    There are a few things I want to find out. The script below is meant to test them.

    First: It seems to me that there's a gap in the flags used by Troika, between 230 and 277. At least that's what I get from scanning through the dlg/py files and the encounter file. So far I haven't run into anything in that range with the test script, but since I've wiped all my game saves recently I only have relatively fresh savegames. So if you have a near endgame save, please run the script - it stores the number of the first set flag after 231 into global_vars[500].

    Second: Likewise, from scanning the files, the Troika flags seem to end at about 370. The script below searches for the first flag set above 380 (took a safety buffer there, just in case I missed a few) and stores its number at vars[501]. So far I've only run into flags in the 700s when testing this one.

    Third: I wanted to find out what's the last flag number we can use. So far it seems that flags[3200] is always set, and afterwards it's random - changse every time you load the game (even on the same savegame, flags above 3200 change after restarting ToEE). Again, I'd like to see if you get the same result. So similar to the previous two tests I ran a while loop that stops when you reach a set flag, beginning at 1001. This can be modified to test for variables too, BTW (seems that up to vars[1999] it's safe, afterwards you get crazy numbers).

    So if you're willing to help out, please stick this script into some Hommlet NPC's dialogue and run it, and check vars 500 through 502 in the console. Thanks.

    Code:
    def flagtest():
    	game.global_vars[500]=0; #first flag set above 231
    	game.global_vars[501]=0; #first flag set above 380
    	game.global_vars[502]=0; #first flag set above 1001
    
    	flagno=231;
    	while (game.global_flags[flagno] == 0):
    		flagno = flagno + 1;
    	game.global_vars[500]=flagno;
    
    	flagno=380;
    	while (game.global_flags[flagno] == 0):
    		flagno = flagno + 1;
    	game.global_vars[501]=flagno;
    
    	flagno=1001;
    	while (game.global_flags[flagno] == 0):
    		flagno = flagno + 1;
    	game.global_vars[502]=flagno;
    
    	#check the vars in console!
    
    	return SKIP_DEFAULT
    
     
  2. Cerulean the Blue

    Cerulean the Blue Blue Meanie Veteran

    Joined:
    Apr 23, 2005
    Messages:
    1,962
    Likes Received:
    0
    I'm glad you are taking an interest in what flags are used in the game. We all need that information. But there is a flaw in your method. Flags are often set back to zero by various things in the game, and since it is impossible to do every single quest in ToEE with a given party, you can never set all the flags used to 1. The only reliable method for telling if a flag is used in the game is to search all the dlg and py files for a reference to it.

    rufnredde started a project a while back to make a spreadsheet of all the flags and variables used in the game and what they were for. He was forced to take a leave of absence before it was completed, but some of us have the unfinished version. I would be happy to share it with you.

    I'm thinking of writing a python script that will search for all the flags and vars in the game and output them to a file. I'll let you know if I do.
     
  3. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    I'm combing through the dlg and py files as well - too bad I didn't know about ruf's initiative earlier, would have probably saved me some time :p

    Here are my findings so far:

    View attachment flags and variables.zip

    And of course I'd love to compare/merge with what ruf's done :)

    As for the script test - while not perfect, it should give at least a good estimate of what's used and unused. It's also best to attach the test script to Lareth's diary or some other note so that you can trigger it anywhere and (almost) anytime. And from what I've seen so far, the utter majority of flags are only set and never reset, or belong to the "is dead" class which only reset on resurrection (and those are easy enough to find in the py scripts).
     
Our Host!