Functions on the Macro
- Set Stage - This is your image chooser. Token comes default with "Magic Gate".
- Setup - This sets the image chooser to the images on the token.
- Reset - If you have not altered the portrait or handout image, this will restore the token image and clear the token properties. This is good to do when saving the token for later, but it won't break anything if you don't.
**You can recover the image by exporting the campaign and manually editing that file to get the image back. I put instructions on the token, but it's a pain.
This one is good for image portability, but for a lib to drop in to your campaign that relies on your image asset cache try using Disguise. It has an unlimited number of image changes.
Macros
Code: Select all
@@Set Stage
@PROPS@ autoExecute=true ; color=blue ; fontColor=white ; group=Run ; includeLabel=false ; sortBy=6 ; index=2 ; fontSize=1.00em ; minWidth= ; playerEditable=true ; maxWidth= ; tooltip= ; applyToSelected=true ;
[H: currentStage = getProperty("h.currentStage")]
[H, if(json.isEmpty(currentStage)), code: {
[H, macro("Setup@this"):""]
[H: currentStage = getProperty("h.currentStage")]
};{}]
[H: assetList = json.append("",getProperty("h.stage1"),getProperty("h.stage2"),getProperty("h.stage3"))]
[H: hasInput = input("stage| "+json.toList(assetList)+"||LIST|ICON=TRUE TEXT=FALSE SPAN=TRUE ICONSIZE=100 SELECT="+(currentStage-1))]
[H, if(hasInput), code: {
[H: imgID = getProperty("h.stage"+(stage+1))]
[H: setTokenImage(imgId)]
[H: setProperty("h.currentStage",stage+1)]
};{}]
@@Reset
@PROPS@ autoExecute=true ; color=cyan ; fontColor=black ; group=Setup ; includeLabel=false ; sortBy=7 ; index=3 ; fontSize=0.95em ; minWidth= ; playerEditable=true ; maxWidth= ; tooltip= ; applyToSelected=false ;
[H: currentImage = getTokenImage()]
[H: portraitImg = getTokenPortrait()]
[H: handoutImg = getTokenHandout()]
[H: stage1Image = getProperty("h.stage1")]
[H: stage2Image = getProperty("h.stage2")]
[H: stage3Image = getProperty("h.stage3")]
[H, if(stage1Image != ""), code: {
[H: setTokenImage(stage1Image)]
[H: resetProperty("h.stage1")]
};{}]
[H: flag = 0]
[H, if(stage2Image != "" && portraitImg == stage2Image): resetProperty("h.stage2"); flag = 1]
[H, if(stage3Image != "" && handoutImg == stage3Image): resetProperty("h.stage3"); flag = 1]
[H, if(flag), code: {
[H: hasInput = input("confirm||<html>Your token images do not match the originals or token has already been reset.<br><br>The originals could be lost... are you sure?</html>|LABEL|TEXT=FALSE")]
[H, if(1), code: {
[H, if(!isPropertyEmpty("h.stage2")): resetProperty("h.stage2")]
[H, if(!isPropertyEmpty("h.stage3")): resetProperty("h.stage3")]
[H, if(!isPropertyEmpty("h.currentStage")): resetProperty("h.currentStage")]
};{
[H: inputStr = "junk||<html>If you do not have those images in your reference library,<br>it may be possible to recover them by exporting them as a<br>campaign repository file. Change the file created extension<br>to .zip (for windows), open and browse the asset folder and<br>look for the following ids. You can save/move them in to<br>your repository and add to appropriate image slot.<br><br><b>Portrait Image = "+substring(stage2Image,9)+"<br>Handout Image = "+substring(stage3Image,9)+"</b></html>|LABEL|TEXT=FALSE"]
[H: input(inputStr)]
}]
};{
[H, if(!isPropertyEmpty("h.currentStage")): resetProperty("h.currentStage")]
}]
@@Setup
@PROPS@ autoExecute=true ; color=red ; fontColor=white ; group=Setup ; includeLabel=false ; sortBy=12 ; index=1 ; fontSize=0.95em ; minWidth= ; playerEditable=true ; maxWidth= ; tooltip= ; applyToSelected=false ;
[H: currentStage = getProperty("h.currentStage")]
[H: tokenImg = getTokenImage()]
[H: portraitImg = getTokenPortrait()]
[H: handoutImg = getTokenHandout()]
[H: hasInput = input("choice|Are you sure you want to rewrite the images to the current configuration?||LABEL|SPAN=TRUE",
"token_| "+tokenImg+"|Token Image|LABEL|ICON=TRUE ICONSIZE=100",
"portrait_| "+portraitImg+"|Portrait Image|LABEL|ICON=TRUE ICONSIZE=100",
"handout_| "+handoutImg+"|Handout Image|LABEL|ICON=TRUE ICONSIZE=100")]
[H, if(hasInput), code: {
[H: setProperty("h.stage1",tokenImg)]
[H: setProperty("h.stage2",portraitImg)]
[H: setProperty("h.stage3",handoutImg)]
[H: setProperty("h.currentStage",1)]
};{}]