Hi there,
I've been testing Mr. Pokeylope's new [] format and it works very well, and I've emailed him with some initial feedback.
But aside from testing whether the function works as designed, trying to integrate it into my existing macros has led me to realize that I personally don't really use it much.
The new [] functionality works GREAT when you are typing in the chat line or using simple macros with everything calculated in-line.
If you use complicated macros where you do a lot of calculations up top (usually hidden) and then display the results down below in a specific format, it doesn't really help. Putting the [] around the calculations doesn't matter since you don't want them shown. Putting the [] at the bottom where you output the results doesn't help since it just lists "myVar=20" or whatever, rather than how the 20 was generated earlier.
What I am making real use of is the behind-the-scenes change that allows tooltips at all. By using something like:
Code: Select all
"<span title=' "+myVarDetail+" '>"+myVar+"</span>
I can keep the original roll details in a variable like myVarDetail and list that in the tooltip at the time of display, way down at the bottom of the macro.
Another thing I keep using is the looping mechanism with [c(n):blah]. That is really useful for shortening macro code. For example, in the sample code I've seen for using the health bar state overlays, there are like 20+ if statements to turn on and off the states based on your current hp percentage. With the loop mechanism, it can be reduced to 3 lines:
Code: Select all
[c(21):eval("state.HP"+(5*(roll.count-1))+"=0")]
[HPPct=5*round(max(HP,0)/MaxHP*20+0.49999)]
[eval("state.HP"+HPPct+"=1")]
Another thing I use the loop for is building a string from the results of multiple dice rolls. Let's say I need to roll 3d6 for damage but I want to display each die roll in the tooltip, like "3+1+5" or whatever I rolled.
If I do something like [c(3,"+"):myVar=1d6] the end result is that myVar just has the third roll since you keep overwriting it. What you need to do is [c(3):myVar=if( roll.count==1, 1d6, myVar+"+"+roll(1d6))]. That is not hard, but as a future enhancement maybe we could add an assignment operator. Something like [A(myVar),C(3,"+"):1d6] would roll the 1d6 three times (with "+" as the separator) and just append the final output to the variable myVar. Then myVar would be "1+5+2" or whatever the roll was.
Thanks to Mr. Pokeylope for his work, it is proving extremely useful!