I'm trying to set a persistent local value and use it throughout my script(s).
What I've done:
- Created var_myname.gda m2da file containing one value "NP_ITEM_LYRIUMADDICT", 0.
- I placed the m2da file in my addins/myaddin/core/override folder
- Restarted the Toolset and set var_myname as the variables file
- Edited a custom script with this code:
int nTotal = GetLocalInt(stEvent.oCaster,"NP_ITEMS_LYRIUMADDICT");
if(nTotal < 5)
{
nTotal++;
SetLocalInt(stEvent.oCaster,"NP_ITEMS_LYRIUMADDICT",nTotal);
DisplayFloatyMessage (stEvent.oCaster,"Current Potion Count: " +
IntToString(nTotal),FLOATY_MESSAGE,16777215,10.0f);
}
else
{
SetLocalInt(stEvent.oCaster,"NP_ITEMS_LYRIUMADDICT",0);
}
I think I'm misunderstanding the way these variables work because my floaty always comes back empty, as in "Current Potion Count: ()".
According to the function description, when retrieving the variable, if the variable isn't set or an error is returned, the value defaults to 0. So how comes my nTotal is still empty? I tried it with drinking multiple potions (as that's when this code triggers) but each time it returns an empty value...
Modifié par Joshua Raven, 26 novembre 2009 - 03:41 .





Retour en haut






