copyToken: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Initial write-up.)
 
m (Correct version.)
Line 3: Line 3:
|name=copyToken
|name=copyToken
|trusted=true
|trusted=true
|version=1.3b53
|version=1.3b51
|description
|description
Used to copy a token into the current map. You can use it to copy a token from another map into the current map.
Used to copy a token into the current map. You can use it to copy a token from another map into the current map.

Revision as of 03:27, 12 March 2009

 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.3b51

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.