Difference between revisions of "LUA:SetTempVariable"

(Created page with "= LUA Functions: SetTempVariable() = Sets a temporary variable for the given spawn ==== Syntax ==== SetTempVariable(param1, param2, param3) ==== Parameters ==== ; Required - ...")
 
Line 8: Line 8:
  
 
==== Parameters ====
 
==== Parameters ====
; Required - ''param1'' (Spawn), ''param2'' (String), ''param3'' (String)
+
; Required - ''param1'' (Spawn), ''param2'' (String), ''param3'' (String, Spawn, Zone, Item, or Quest)
 
: ''param1'' is the spawn we want to set a temp variable for
 
: ''param1'' is the spawn we want to set a temp variable for
 
: ''param2'' is the variable we want to set
 
: ''param2'' is the variable we want to set
Line 27: Line 27:
 
This can be used on players as well as NPC's
 
This can be used on players as well as NPC's
 
The values will not persist through zoning, camping, or zone shut down
 
The values will not persist through zoning, camping, or zone shut down
To clear a variable you can set it to ""
+
To clear a variable you can set it to "nil"

Revision as of 13:31, 25 May 2013

LUA Functions: SetTempVariable()

Sets a temporary variable for the given spawn


Syntax

SetTempVariable(param1, param2, param3)


Parameters

Required - param1 (Spawn), param2 (String), param3 (String, Spawn, Zone, Item, or Quest)
param1 is the spawn we want to set a temp variable for
param2 is the variable we want to set
param3 is the value of the variable


Usage

function hailed(NPC, Spawn)
    Say(NPC, "Setting FOO to BAR")
    SetTempVariable(NPC, "FOO", "BAR")
end

When hailed the spawn will set the variable FOO to have a value of BAR

Notes

This can be used on players as well as NPC's The values will not persist through zoning, camping, or zone shut down To clear a variable you can set it to "nil"