Generating a equipment data map from internal datafiles.

Nightmist

Member
Basically this script just grabs equipment.txt and modifiers.txt and mashes them together in a map to form a map... It doesn't actually do anything in terms of your KoL character but I suppose some people might find the data they can get from it useful for some other purpose. (Yeah I know some of these things are already handled in some ASH functions)

It maps these values:
Code:
Record EquipmentDataRec
{
 int Power;
 stat EquipStat;
 int MinEquipNum;
 int Handedness;
 float InitMod;
 float MeatMod;
 float ItemMod;
 float StatMod;
 int DamAsbMod;
 int DamResMod;
 int ColdResMod;
 int HotResMod;
 int SleazeResMod;
 int SpookyResMod;
 int StenchResMod;
 int ManaRedMod;
 int FamWeightMod;
 int MonLevelMod;
 int CombatFreqMod;
};
I'll leave you to decipher what they are, (If your using this chances are you know should know enough about whats stored in the datafiles to figure out what value goes with what)

Oh and it creates 3 maps's and saves them as "TempEquipMap.txt" (which is a equipment.txt in a map), "TempModsMap.txt" (a map of modifiers.txt) and then "EquipmentDataMap.txt" which is the map which is the point of the script.

Script was made in a few hours so most likely buggy and possibly some weird formatting in the datafiles which I haven't adapted the script to use.

Edit: I added a "Commented" version of the script now. I just wrote the comments in a few minutes so bear with the spelling errors but it should help you understand what section of the code does what.
 

darius180

Member
Thanks Nightmist! That sounds like just what I need for my stuff!

EDIT: WOAH is that more complicated than I expected...
 

Nightmist

Member
[quote author=darius180 link=topic=759.msg3646#msg3646 date=1171030589]
EDIT: WOAH is that more complicated than I expected...
[/quote]
Heh if you are not used to using "record based maps" then you can always just load it into a map with this format:
Code:
int [ item, int, stat, int, int, float, float, float, float, int, int, int, int, int, int, int, int, int, int] MapName;
(I'm not sure if you can just "Map = Map" but you can always (map_to_file -> file_to_map)

Oh and the reason its more complicated than expected is probably because its made to handle various possible "errors" I found in the modifiers.dat file which was fixed. (Some double <tab>ing, extra "," characters and lack of "," characters) I figured I would keep them in there in case errors like that appeared again so it would still be able to handle it instead of throwing a error. If you need help figuring out any of it I'll be happy to try and help.
 

darius180

Member
Yeah... I honestly can't get a lot of the code you're useing, but i figure that if I change the filename to include the charactername + "_rollover equipment" I might be able to get it working for me ( i need to to work for my chars and my g/f's). I guess I'll just have to create a rought script and play around w one of my characters after I've gotten some code down and their inventory written down.
 

Nightmist

Member
modifiers.txt and equipment.txt both do NOT contain adventure++ stats, so in terms of rollover gear your going to have to make up something for that.

Edit: This is really for use by people very familiar to ASH to show a method of mashing different datafiles into a single ASH map. But if you do intend to use this script I highly recommend you become familiar with modifiers.txt as that will show you what the script does and doesn't store.
 

Nightmist

Member
[quote author=efilnikufecin link=topic=759.msg3668#msg3668 date=1171152903]
Hmm, I wonder how many times "string_to_item( Equipment)" gets called total through executing that script :p
[/quote]
2050 times using my current datafiles =P. Yeah sure its a bit excessive... (Okay a little more then a bit excessive) but thats what you get when the modifiers are not listed <tab> separated >>. (The whole having 737 different items it parses might do that to it too... come to think of it I would of expected more equips then this but its running off the equips found in equipment.txt so *shrug*)

If your wondering how I found out...
Added this to the top:
Code:
int StICount = 0;
item string_to_item( string Tempstring, string Null)
{
 StICount = StICount+1;
 return( string_to_item(Tempstring));
}
This to the bottom:
Code:
print( StICount);
And did a "search and replace text"
Code:
Search: string_to_item( Equipment)
Replace with: string_to_item( Equipment, "Null")
 
Top