PDA

View Full Version : Token sources and addToken()



joshuha
June 15th, 2007, 04:44
Both rulesets\[ruleset]\tokens\[folder] and tokens\host\[folder] can have tokens.

I notice that tokens from both sources above are shown in my tokenbag as a GM. One interesting note is that if both sources have the same folder name you get a combined token bag although if the tokens were the same name you get duplicates.

My question is how do I access the ones in the ruleset via the script with the addToken() function on an imagecontrol?

This works:


imagewindow.image.addToken("tokens\host\test\test.png", x, y);


This does not work:


imagewindow.image.addToken("rulesets\custom\tokens\test\test.png", x, y);


Any ideas? I realize the tokenroot tag in the base.xml tells the ruleset where to get non-ruleset tokens but it doesn't seem to use or need that for the addToken command (i.e you need the full path).

Goblin-King
June 15th, 2007, 07:03
You can check this by creating a script snippet that outputs the name when the token is dropped somewhere, or just placing the token on a token control or map and seeing what it gets saved as in the db.xml file. In your case, it should be "ruleset/tokens/test/test.png".

Officially, you should not be processing token names by hand, but rather treat all these strings as abstract identifiers. There are no guarantees the scheme won't get modified, although there is nothing such planned at this time.