View previous topic :: View next topic |
Author |
Message |
Extreme
Joined: 28 Nov 2007 Posts: 135
|
Posted: Wed Oct 01, 2008 15:47 Post subject: SetTag |
|
|
I have not changed over to the nwnx_funcs yet, cause im lazy and havnt gotten to it, but is there a bug with SetTag?
Im using it in my forge and setting tags OnAcquire and i have noticed that the tags will never be set longer then 12-14 characters. But its weird that it tends to vary as to how many characters it will use.
Here is my function to change the tags. You will notice alot have had to be shortened. I was just curious if a known bug existed
Code: | void SetUpForgeTags(object oAcquired)
{
string sNewTag;
////////////////////////////////////////////////////////////////////////////////
//:: 55 Primary Componenets :://
////////////////////////////////////////////////////////////////////////////////
//ABILITY_BONUS
if(GetTag(oAcquired) == "x2_it_cmat_adam") sNewTag = "PRIMARY_00"; //Bar of Adamantine
//AC_BONUS
else if(GetTag(oAcquired) == "zep_holy_water") sNewTag = "PRIMARY_01"; //Holy Water
////////////////////////////////////////////////////////////////////////////////
//:: Secondary Components :://
////////////////////////////////////////////////////////////////////////////////
else if(GetTag(oAcquired) == "NW_IT_MPOTION015") sNewTag = "ABILITY_STR"; //Potion of Bull's Strength
else if(GetTag(oAcquired) == "NW_IT_MPOTION014") sNewTag = "ABILITY_DEX"; //Potion of Cat's Grace
else if(GetTag(oAcquired) == "NW_IT_MPOTION013") sNewTag = "ABILITY_CON"; //Potion of Endurance
else if(GetTag(oAcquired) == "NW_IT_MPOTION017") sNewTag = "ABILITY_INT"; //Potion of Fox Cunning
else if(GetTag(oAcquired) == "NW_IT_MPOTION018") sNewTag = "ABILITY_WIS"; //Potion of Owl's Wisdom
else if(GetTag(oAcquired) == "NW_IT_MPOTION010") sNewTag = "ABILITY_CHA"; //Potion of Eagle's Splendor
SetTag(oAcquired, sNewTag);
} |
I removed the majority cause not everyone can know the recipies |
|
Back to top |
|
|
acaos
Joined: 08 May 2007 Posts: 153
|
Posted: Thu Oct 02, 2008 0:57 Post subject: |
|
|
Yes, there is a bug with the nwnx_functions SetTag() where it cannot extend the length of the existing tag.
The one in nwnx_funcs has a different bug, where it may leak memory (it does not de-allocate the existing tag, but simply creates a new tag). Unfortunately, I found that de-allocating the existing tag sometimes crashes the server.
On Higher Ground, we only set tags rarely, and since there are at most 64 bytes per tag, the leak is not a concern for us. If you were setting them on thousands of objects, that might be more of an issue.
Acaos |
|
Back to top |
|
|
Extreme
Joined: 28 Nov 2007 Posts: 135
|
Posted: Thu Oct 02, 2008 6:14 Post subject: |
|
|
well i revamped my forge to use variables instead of SetTag so that i can offer it to others easily. But i just wanted to ask to make sure it was known |
|
Back to top |
|
|
|