Difference between revisions of "GetEffectString"

From NWN Lexicon
Jump to: navigation, search
(Created page with "{{DISPLAYTITLE:GetEffectString(effect, int)}}__NOTOC__ Retrieves an string parameter of an effect. <nwscript> void GetEffectString( effect eEffect, int nIndex ); </nws...")
 
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
Retrieves an string parameter of an effect.
 
Retrieves an string parameter of an effect.
 
<nwscript>
 
<nwscript>
void GetEffectString(
+
string GetEffectString(
 
     effect eEffect,
 
     effect eEffect,
 
     int nIndex
 
     int nIndex
Line 8: Line 8:
 
</nwscript>
 
</nwscript>
  
===Parameters===
+
====Parameters====
  
 
;eEffect
 
;eEffect
Line 16: Line 16:
  
  
===Description===
+
====Description====
  
 
Get the float parameter of eEffect at nIndex.
 
Get the float parameter of eEffect at nIndex.
Line 25: Line 25:
  
  
===Remarks===
+
====Remarks====
  
 
This digs into an effect to get some values that are currently set on it. For instance [[EffectSwarm]] you can figure out what resrefs the effect is using. These strings may dynamically change during runtime.
 
This digs into an effect to get some values that are currently set on it. For instance [[EffectSwarm]] you can figure out what resrefs the effect is using. These strings may dynamically change during runtime.
Line 31: Line 31:
 
See the other types of effect values with [[GetEffectInteger]], [[GetEffectFloat]], [[GetEffectObject]] and [[GetEffectVector]].
 
See the other types of effect values with [[GetEffectInteger]], [[GetEffectFloat]], [[GetEffectObject]] and [[GetEffectVector]].
  
The experimentation of this function has been documented on the lexicon; you can find GetEffectInteger information on the [[:Category:Effects Functions|Effect Constructor Functions]].
+
The experimentation of this function has been documented on the lexicon; you can find GetEffectString information on the [[:Category:Effects Functions|Effect Constructor Functions]].
  
 
The functions this applies to are:
 
The functions this applies to are:
Line 42: Line 42:
  
  
===Version===
+
====Version====
  
 
{{patchnwnee|patch=1.83.8193.21|link=https://steamcommunity.com/games/704450/announcements/detail/4622354803159314301}}
 
{{patchnwnee|patch=1.83.8193.21|link=https://steamcommunity.com/games/704450/announcements/detail/4622354803159314301}}
  
  
===Example===
+
====Example====
  
 
<nwscript>
 
<nwscript>
Line 72: Line 72:
 
</nwscript>
 
</nwscript>
  
===See Also===
+
====See Also====
  
 
{| class="seealso"
 
{| class="seealso"

Latest revision as of 17:18, 13 March 2021

Retrieves an string parameter of an effect.

string GetEffectString(
    effect eEffect,
    int nIndex
);

Parameters

eEffect
The effect to check a parameter of
nIndex
The index of the parameter. Valid values 0 through 5.


Description

Get the float parameter of eEffect at nIndex.

nIndex bounds: 0 >= nIndex < 6.

Returns: the value or "" on error/when not set.


Remarks

This digs into an effect to get some values that are currently set on it. For instance EffectSwarm you can figure out what resrefs the effect is using. These strings may dynamically change during runtime.

See the other types of effect values with GetEffectInteger, GetEffectFloat, GetEffectObject and GetEffectVector.

The experimentation of this function has been documented on the lexicon; you can find GetEffectString information on the Effect Constructor Functions.

The functions this applies to are:

Note to retrieve the effects tag use GetEffectTag, not this function.


Version

This function was added in 1.83.8193.21 of NWN:EE.


Example

// OnUsed event to tell the person their EffectSwarm resrefs.
void main()
{
    object oUser = GetLastUsedBy();
 
    effect eEffect = GetFirstEffect(oUser);
    while(GetIsEffectValid(eEffect))
    {
        if(GetEffectType(eEffect) == EFFECT_TYPE_SWARM)
        {
            string sResRef1 = GetEffectString(eEffect, 0);
            string sResRef2 = GetEffectString(eEffect, 1);
            string sResRef3 = GetEffectString(eEffect, 2);
            string sResRef4 = GetEffectString(eEffect, 3);
 
            SendMessageToPC(oUser, "Swarm effect found. 1st ResRef: [" + sResRef1 + "] 2nd ResRef: [" + sResRef2 + "] 3rd ResRef: [" + sResRef3 + "] 4th ResRef: [" + sResRef4 + "]");
        }
        eEffect = GetNextEffect(oUser);
    }
}

See Also

functions:

Effect Constructor Fucntions

GetEffectInteger, GetEffectFloat, GetEffectObject, GetEffectVector

constants:

Various constants, see Effect Constructors.