macro Speed

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
Sydious
Giant
Posts: 155
Joined: Sun Aug 21, 2011 2:27 am

macro Speed

Post by Sydious »

So I have achived success on random image buttons.

I use two following macros and come up with 32 image buttons in a grid (6x6)
Spoiler

Code: Select all

[h, MACRO("getTTImages@Lib:DQ"):""]
<html>
<form>
[h: num = 1]

<table border = "1" align = "center" style="background-color:yellow;">

[r,count(6,""),code:
{
  <tr>
    [r, for(i,1,6,1,""), code:{ 
		[h: tokenName = listGet(macro.return, num)]
		[r: button = strformat('<td><input type="image" src="%s" name="btnChoice" value="TreasureValue"></td>',getImage(tokenName))]
		[h: num = num +1]
		 } ]
  </tr>
}]

</table>
</form>
</html>
called macro:
Spoiler

Code: Select all

[h: ttDeck = getLibProperty("DECK_TT", "Lib:DQ")]
[h: tokenNameList = ""]
[h: deckCount = listCount(ttDeck)]

[r, for(i,1,deckCount +1,1,""), code:{
	[h: tokenName = "image:Treasure_Token_" +  i]
	[h: tokenNameList = listAppend(tokenNameList, tokenName)]
}]

[h: treasureTokenImages = json.fromList(tokenNameList)]
[h: newTreasureTokenImages = json.shuffle(treasureTokenImages)]

[r: macro.return = newTreasureTokenImages]
You that are experienced my already guess that this macro is very slow. It takes a long time to open the dialog window. I assume it is all the images, becuase when I use just 1 it opens quickly.

Is there anything I can do to speed this process up?

Post Reply

Return to “Macros”