copyToken

From RPTools Wiki
Revision as of 03:02, 12 March 2009 by Verisimilar (talk | contribs) (Initial write-up.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

 This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.

copyToken() Function

 Note: This function can only be used in a Trusted Macro

Introduced in version 1.3b53

Usage

copyToken([i]id)
copyToken([i]id, numCopies)
copyToken([i]id, numCopies, fromMap)

Parameters

  • id - The id of the token to copy.
  • numCopies - The number of copies to create, defaults to 1
  • fromMap - The name of the map to copy from, defaults to the current map.

If numCopies is 1 then the token id of the newly create token is the return value of the function, If numCopies is greater than 1 then the return is a JSON Array with all of the newly created token ids.

The naming of the tokens follows the cut/paste token method.

Although it says token it can be used for objects etc. Tokens are copied into the same layer as the original token, also with the same x,y co-ordinates, but you get the token ids as a return value so its easy to use other functions to change these.