setCurrentMap: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Changed language to "bash" to see if it gets rid of syntax error.)
m (Conversion script moved page SetCurrentMap to setCurrentMap: Converting page titles to lowercase)
 
(2 intermediate revisions by the same user not shown)
Line 13: Line 13:
|usage=
|usage=
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
setCurrentMap(mapName)
setCurrentMap(mapRef)
</syntaxhighlight>
</syntaxhighlight>
|examples=
|examples=

Latest revision as of 23:59, 9 February 2023

setCurrentMap() Function

Introduced in version 1.3b60
Designates the given map as the current one, allowing initiative to be moved from map to map.

WARNING: This function changes an internal variable used by MapTool to keep track of which map is current and this change takes place immediately. However, changes to tokens are queued up and only occur when the macro finishes execution (well, sort of). The end result is that if a token is being modified on map "A" and your macro calls setCurrentMap() to switch to map "B", when the macro finishes and the token changes are executed they will be processing a token on map B! If there was no such token on map B a new one will be created, thus mysteriously duplicating tokens!

Therefore, do NOT modify any token properties, states, names, notes, or any other token-specific values after calling setCurrentMap(). Or make sure that the first thing your macro does is call setCurrentMap() so that all tokens accessed later will be on the map that is current when the macro finishes.

Search http://forums.rptools.net/ for setCurrentMap to find some discussion threads on this topic.

Usage

setCurrentMap(mapRef)

Examples

[h: status = input("NewMap|" + getAllMapNames() + "|Map to switch to|LIST|VALUE=STRING")]
[h:abort(status)]
[h:setCurrentMap(NewMap)]

See Also