Page MenuHomeFeedback Tracker

setVariable with thisList or (list trg) will cause it to update with the list
Closed, ResolvedPublic

Description

Using setVariable with the list of a trigger will cause the variable to update simultaneously with the list . Ergo when the triggerlist changes, the value of the variable will change as well.

Details

Legacy ID
3980780943
Severity
None
Resolution
No Bug
Reproducibility
Always
Category
Scripting
Steps To Reproduce

Place a Trigger
Act: Anybody
onAct: player setVariable ["Test1", thisList,true];

Walk into trigger > Variable will update [player]

Walk out of trigger > Variable will update again []

Event Timeline

DerZade edited Steps To Reproduce. (Show Details)Jan 23 2016, 10:02 PM
DerZade set Category to Scripting.
DerZade set Reproducibility to Always.
DerZade set Severity to None.
DerZade set Resolution to No Bug.
DerZade set Legacy ID to 3980780943.May 8 2016, 1:33 PM

This is because array is passed by reference. You need to make a copy using +.

player setVariable ["Test1", +thisList, true];

^^^^ should do the trick.

DerZade added a subscriber: DerZade.May 8 2016, 1:33 PM

Thanks for the quick reply. It worked out for me.