Jump to content

Iterative resource collection


DavidW

Recommended Posts

While I'm gauging interest in esoteric power tools, here's another that might be of use to about 2 people ever (and I won't package it until one of them asks me, because it's a bit tangled up in the rest of my overgrown function library):

 

"iter_resource" collects all non-animation, non-sound resources (that is: in the list 2da, eff, ini, spl, itm, dlg, bcs, sto, wmp, are, cre) used by the file on which you call it - and then collects all resources used by *those* resources, and so on. So for Spiritual Hammer

LAF iter_resource STR_VAR to_check=sppr213.spl RET to_check=to_check END

we get "sppr213.spl shamme1.itm shamme2.itm shamme3.itm". For Monster Summoning I (in IWD):

LAF iter_resource STR_VAR to_check=sppr309.spl RET to_check=to_check END

we get "spwi309.spl msummo1.2da ms1fb.cre ms1goba.cre ms1gobm.cre gnsummm.bcs p1-4.itm gnsummb.bcs bow05.itm arow01.itm p1-6.itm"

 

The code

LAF iter_resource STR_VAR to_check="worldmap.wmp expmap.wmp" RET to_check=to_check END

returns a really long string listing all the (non-ruleset) resources used in IWD.

Link to comment

Named but non-existent is easy; there's no need to iterate, non-existent files don't require resources.

 

Animations is easy in principle but not that useful since so many animation files are hardcoded - just because an animation isn't linked to by a file doesn't mean it's not being used somewhere.

Link to comment
Named but non-existent is easy; there's no need to iterate, non-existent files don't require resources.
Erhm, you are looking it from the wrong direction... as they might be required by something, and they'll crash the game if the named animation doesn't exist, which is where the function would come in usage, as they can be detected, and fixed. Fixed perhaps by adding an empty animation frame to where they are needed.
Link to comment
Named but non-existent is easy; there's no need to iterate, non-existent files don't require resources.
Erhm, you are looking it from the wrong direction... as they might be required by something, and they'll crash the game if the named animation doesn't exist, which is where the function would come in usage, as they can be detected, and fixed. Fixed perhaps by adding an empty animation frame to where they are needed.

I'm not sure what you're talking about. I didn't say anything about the usefulness of such a function, only that it doesn't require iteration.

Link to comment
I'm not sure what you're talking about. I didn't say anything about the usefulness of such a function, only that it doesn't require iteration.
Well, yeah... the non-existing resources don't, correct, but the trick sometimes is that you have no idea where to go and search for the non-existing ones.

 

The Idea is that you could throw this function a crashed area file, and it would sort things in the decreeing likelihood of being missed, and then hightlights the missing files, without misleading that those could be the only causes of the problems. First it takes the .are, then the files related to it: .web, the .tis, the .bcs, ... then the .cre's ... then the animations the .cre uses, items present... .ico's those use ... the whole nine yards.

Link to comment
I'm not sure what you're talking about. I didn't say anything about the usefulness of such a function, only that it doesn't require iteration.
Well, yeah... the non-existing resources don't, correct, but the trick sometimes is that you have no idea where to go and search for the non-existing ones.

 

The Idea is that you could throw this function a crashed area file, and it would sort things in the decreeing likelihood of being missed, and then hightlights the missing files, without misleading that those could be the only causes of the problems. First it takes the .are, then the files related to it: .web, the .tis, the .bcs, ... then the .cre's ... then the animations the .cre uses, items present... .ico's those use ... the whole nine yards.

 

Got it.

 

Okay, sure, I can do something like that. (I can't sort in decreasing likelihood, but I can input an area file and output a list of resources missing from it, or from files referenced by it, or from files referenced by them, or...)

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...