Trying to figure this out but getting stuck.
Here's my power cards macro:
I can create a simple handout with this API script I found by searching the forum:
Is there a way to getObj(#macroName) ? Or some way of kicking off the macro and then creating a handout based on the macro's output?
Here's my power cards macro:
!power {{ --emote|Creating Character... --format|default --name|[[ [TXT] 1t[Occupation] ]] --leftsub|Birth Auger --rightsub|[[ [TXT] 1t[luckyRoll] ]] --Strength:|~R[[ 3d6 ]]~R --Agility:|~R[[ 3d6 ]]~R --Stamina:|~R[[ [$S] 3d6 ]]~R --Personality:|~R[[ 3d6 ]]~R --Intelligence:|~R[[ 3d6 ]]~R --Luck:|~R[[ 3d6 ]]~R -- ?? $S == 3 ?? Hit Points:|~R[[ 1d4 - 3]]~R -- ?? $S >= 4 AND $S <= 5 ?? Hit Points:|~R[[ 1d4 - 2]]~R -- ?? $S >= 6 AND $S <= 8 ?? Hit Points:|~R[[ 1d4 - 1]]~R -- ?? $S >= 9 AND $S <= 12 ?? Hit Points:|~R[[ 1d4 ]]~R -- ?? $S >= 13 AND $S <= 15 ?? Hit Points:|~R[[ 1d4 +1 ]]~R -- ?? $S >= 16 AND $S <= 17 ?? Hit Points:|~R[[ 1d4 +2 ]]~R -- ?? $S == 18 ?? Hit Points:|~R[[ 1d4 +3 ]]~R --Starting Copper:|~R[[ 5d12 ]]~R }}I'm trying to use the API to create a handout when the macro is ran or from the data in the macro itself. I can't figure a way of doing the variable interpolation + conditionals in a non power cards way.
I can create a simple handout with this API script I found by searching the forum:
on('ready',function(){ "use strict"; on('chat:message',function(msg){ var player,handout; if('api' === msg.type && msg.content.match(/^!handout/) ){ player=getObj('player',msg.playerid); if(player){ handout=createObj('handout',{ name: 'Handout for '+player.get('displayname'), inplayerjournals: "all", controlledby: (playerIsGM(msg.playerid) ? '' : msg.playerid) }); sendChat('','/w "'+player.get('displayname')+'" Created a handout for you: <a href="http://journal.roll20.net/handout/'+handout.id+'" style="color:blue;text-decoration:underline;">Handout for '+player.get('displayname')+'</a>'); } } }); });
Is there a way to getObj(#macroName) ? Or some way of kicking off the macro and then creating a handout based on the macro's output?