I've read in a couple different places that certain functions can cause issues in-game. Is there a list of these functions anywhere?
Bad Functions
Débuté par
Karma
, août 08 2011 03:34
#1
Posté 08 août 2011 - 03:34
#2
Posté 08 août 2011 - 07:17
I'm not aware of such a list but then I wasn't aware there were such dangerous functions. Could you give a couple of example?
#3
Posté 08 août 2011 - 02:50
I've seen GetObjectByTag() and DestroyObject() mentioned as potentially troublesome. I've used both without any noticeable problems, but the mention of it in a couple mod change logs made me wonder (a) how true it is and (
if it is true, what other functions are potentially problematic.
#4
Posté 08 août 2011 - 05:55
I think for DestroyObject(), they suggest using Safe_Object_Destroy(), because the former doesn't respective the 'plot' and 'isImmortal' attributes of object to be destroyed.
Not sure about GetObjectByTag(). I use that all the time with no issues...
Not sure about GetObjectByTag(). I use that all the time with no issues...
#5
Posté 08 août 2011 - 06:17
There are quite a few comments scattered through out the core includes that are intended for BioWare's Technical Designers rather than us. DestroyObject is probably one of those after all it shouldn't respect Immortal or Plot as they are, respectively, intended to prevent death by damage and any damage.
I think I know where the distrust of GetObjectByTag stems from. In the Party_GetFollowerByTag function (party_h) we find the following comment:
I think I know where the distrust of GetObjectByTag stems from. In the Party_GetFollowerByTag function (party_h) we find the following comment:
// We have to retrieve the follower like this. Trying to do it with // GetObjectByTag proved to mess up lots of stuff. -- yaron.However "mess up lots of stuff" isn't a particularly useful turn of phrase given as it is rather lacking in specifics so I'm not sure how much weight to give it.
Modifié par Sunjammer, 08 août 2011 - 06:43 .
#6
Posté 08 août 2011 - 09:57
I suspect GetObjectByTag() calls an iteration. Party_GetFollowerByTag() -- if I can judge it by the name -- seems to have fewer to iterate through as it looks in your list of followers. I have used GetObjectByTag() to get followers too, and it hasn't crapped out on me.
Modifié par Gisle Aune, 08 août 2011 - 09:57 .
#7
Posté 08 août 2011 - 11:38
GetObjectByTag is almost certainly not done by iteration. If memory serves GetObjectByTag was implemented as a hash table in NWN and it is unlikely BioWare would change it to make it less efficient. Conversely as Party_GetFollowerByTag is a derived function we know uses iteration and string comparison.
#8
Posté 09 août 2011 - 08:41
But it still have to iterate through that hash table, right? I am really interested to know how this can be done without iteration, if that's not the case.
#9
Posté 09 août 2011 - 12:41
I don't believe it does. The tag will be hashed to generate an index in the hash table that will point to the first object with that tag. Depending on the implementation of the hash table GetObjectByTag's Nth parameter will then point to the correct object id. However I'm pretty sure you weren't referring to the specific ADT implementation being used in your original statement so, while interesting, such a discussion is probably straying off-topic.
To return to the matter in hand I was always intending to compile a list of broken functions (i.e. those that don't work or, at least, don't work as advertised) for LEX/the Toolset Wiki. Is it worth also compiling a list of functions have "warnings" like the two mentioned above?
To return to the matter in hand I was always intending to compile a list of broken functions (i.e. those that don't work or, at least, don't work as advertised) for LEX/the Toolset Wiki. Is it worth also compiling a list of functions have "warnings" like the two mentioned above?
Modifié par Sunjammer, 09 août 2011 - 01:00 .
#10
Posté 09 août 2011 - 01:47
Sunjammer wrote...
To return to the matter in hand I was always intending to compile a list of broken functions (i.e. those that don't work or, at least, don't work as advertised) for LEX/the Toolset Wiki. Is it worth also compiling a list of functions have "warnings" like the two mentioned above?
Absolutely.





Retour en haut







