CONTEXT

From 4Dimensions
Revision as of 04:00, 26 January 2016 by Isibot (talk | contribs) (Bot: Automated import of articles)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

CONTEXT

CONTEXT

CONTEXT

CONTEXT


Usage: context number

  • This little script will make sure one %has_said_hello% exist for each player.

context %actor.id% set has_said_hello 1

global has_said_hello

  • now only scripts running with context = %actor.id% can access this particular
  • variable. however - it's a better idea to use vars set on players: help remote.

Changes the "context" of a script to this value. When first run, a script's

context is 0. When a variable is made global, it is given the current context.

When a variable is accessed, if it must be searched for globally, a "found"

variable must either have context 0 or the current context. The net result of

this is you may have many global variables in a single script, with the same

name, differing only by context. Players may have variables; this mostly

removes the need for variable context. Previously, a player's ID could be used

as variable context to allow a script to service multiple players at once.


See Also: REMOTE