Code: Select all
[H: "<!-- get a list of selected tokens -->"]
[H: ids = getSelected()]
[H: "<!-- if we have more than one token selected, output error and exit -->"]
[h: doAbort = if(listCount(ids)==0,0,1)]
[h: abort(doAbort)]
[h: assert(listCount(ids) == 1,"<font color=red><b>" + getMacroName() + "</b> may only be run on one token at at time.</font>",0)]
[H: "<!-- at this point we should only have one token id in our list so grab the first and only token id -->"]
[h: token=listGet(ids, 0)]
[H: "<!-- getOwnerOnlyVisible state -->"]
[h: Vis=getOwnerOnlyVisible(token)]
[H: "<!-- if we are set to OwnerOnlyVisible then we need to toggle -->"]
[h: Vis=if(Vis==1, 0, 1)]
[H: "<!-- set the Invisible state to correspond with our toggled OwnerOnlyVisible state -->"]
[h: setState("Invisible", Vis,token)]
[H: "<!-- setOwnerOnlyVisible to our toggle OwnerOnlyVisible state -->"]
[h: setOwnerOnlyVisible(Vis,token)]
[H: "<!-- create Disappear/Appear message -->"]
[h: msg=if(Vis==1,"Disappears!!","Appears!!")]
[h: msg=getName(token) + " " + msg]
[H: "<!-- send Disappear/Appear message to everyone only if we are a player. GM toggles should be silent. -->"]
[h, if(isGM()==0), Code: {
[h: outputTo("all",msg)]
}]