RPTools.net

Discussion and Support

Skip to content

It is currently Wed May 22, 2013 11:53 am 






Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

Previous topic | Next topic 

  Print view

Author Message
User avatar  Offline
Deity
 
Joined: Tue Jul 01, 2008 6:48 pm
Posts: 6235
 Post subject: Macro Deletion Utility
PostPosted: Mon Jun 29, 2009 11:02 am 
I think this belongs in "User Creations," but if not, Azhrei please feel free to move it.

I work with a framework that has a "standard set" of macros, but frequently not all macros are needed for each token (say, NPCs don't always need all the same macros PCs need). So I'm often deleting unnecessary macros. Doing it occasionally is no big deal, but if you have to delete a bunch, it can get laborious with right-click, delete, confirm.

In any case, I figured I'd write a macro to do it, and found out that - as far as I could find - there were no functions to:

a) easily get the labels of a macro in a particular macro group
b) get the names of the macro groups on a particular token, or
c) get the label of a macro from its index

(of course, there could be undocumented functions that do this, in which case, this would have been WAY simpler). In any case, I hacked at it for a while and what resulted is a macro that presents a tabbed dialog containing all the macros on the token, sorted into tabs for each group, with a checkbox next to them, like so:

See post below for updates to Code and Undo Delete macro

Download Delete Macros Utility: Delete Macros

Download Undo Delete utility: Undo Delete Macros


delmacros-shot.jpg
delmacros-shot.jpg [ 22.46 KiB | Viewed 4248 times ]

_________________

What I'm Working On

MapTool Tutorials:
Introduction to Tokens
Introduction to Properties
Introduction to Macro Writing
Introduction to Light and Sight


Last edited by Rumble on Tue Jun 30, 2009 2:18 pm, edited 7 times in total.
Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Jul 01, 2008 6:48 pm
Posts: 6235
 Post subject: Re: Macro Deletion Utility
PostPosted: Mon Jun 29, 2009 11:37 am 
Ah, one thing I forgot to add: this breaks (at the moment) if there are multiple macros with the same label on the token. I will fix that!

Edit: fixed. It will now handle multiple duplicate macros.

_________________

What I'm Working On

MapTool Tutorials:
Introduction to Tokens
Introduction to Properties
Introduction to Macro Writing
Introduction to Light and Sight


Top
 Profile  
 
User avatar  Offline
Cave Troll
 
Joined: Wed Sep 17, 2008 1:29 pm
Posts: 75
 Post subject: Re: Macro Deletion Utility
PostPosted: Tue Jun 30, 2009 7:31 am 
Wow. Thank you! Learning as I go with macros, but this was one thing that was already getting a little tedious. Looks like it solves it brilliantly.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Jul 01, 2008 6:48 pm
Posts: 6235
 Post subject: Re: Macro Deletion Utility
PostPosted: Tue Jun 30, 2009 8:03 am 
Haman wrote:
Wow. Thank you! Learning as I go with macros, but this was one thing that was already getting a little tedious. Looks like it solves it brilliantly.


I'm glad it'll come in handy. I'm going to upload the latest version (I think the one here may ignore macros that aren't in a named group, which is a bit of an oversight). The filename will be the same and all, just some tweaks to the code (it also will include tooltips from the macro, in case you have any configured).

I'm toying with the notion of a version that lets you edit a macro. There are, I think, enough functions to let you check off a macro, edit it, and save it (well, delete and recreate it). Might not work, but it'd be interesting to play with.

_________________

What I'm Working On

MapTool Tutorials:
Introduction to Tokens
Introduction to Properties
Introduction to Macro Writing
Introduction to Light and Sight


Top
 Profile  
 
User avatar  Offline
Site Admin
 
Joined: Mon Jun 12, 2006 12:20 pm
Posts: 11622
Location: Tampa, FL
 Post subject: Re: Macro Deletion Utility
PostPosted: Tue Jun 30, 2009 1:20 pm 
Rumble, I think this is a fine place for it. :) Perhaps a link here from the wiki? Or the other way around? This is useful enough that I'm going to at least sticky it for now...

And I agree that something like this is sorely needed. I, too, have felt the sting of repetitive stress syndrome with all the right-click-and-left-click to delete individual macros. ;)

_________________
Interested in Time Magazine's Best Invention of 2008 Unix-powered laptop? No crashes or lockups. In fact, that series of articles has two such machines. The other is a Dell netbook. :)


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Jul 01, 2008 6:48 pm
Posts: 6235
 Post subject: Re: Macro Deletion Utility
PostPosted: Tue Jun 30, 2009 1:34 pm 
Azhrei wrote:
Rumble, I think this is a fine place for it. :) Perhaps a link here from the wiki? Or the other way around? This is useful enough that I'm going to at least sticky it for now...

And I agree that something like this is sorely needed. I, too, have felt the sting of repetitive stress syndrome with all the right-click-and-left-click to delete individual macros. ;)


Hey, thanks. I'll put it in the code cookbook on the Wiki, and links can go both ways. Long as everybody knows there's no "undo" (although...you know...I could make one - just save all the macro properties to a Lib:Token, and then you could recreate the deleted macro...fascinating).

_________________

What I'm Working On

MapTool Tutorials:
Introduction to Tokens
Introduction to Properties
Introduction to Macro Writing
Introduction to Light and Sight


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Jul 01, 2008 6:48 pm
Posts: 6235
 Post subject: Re: Macro Deletion Utility
PostPosted: Tue Jun 30, 2009 2:12 pm 
Okay, an update: I realized that with this macro, it was in fact entirely possible to create an "undo" option. It's a separate macro, but basically, it lets you undo the most recent set of deletions (only the most recent set! If you run Delete Macros, and then run it again, only the latest set of "undo's" is saved). But, it will remember all the macros you delete in a single go, so it's handy if you goof up.

Code:
<!--General method to get macro groups and labels on a tokenThis version is to delete unwanted or unneeded macros-->
<!--
but it is possible to use this information for whatever purpose you might think of-->

<!--
Get a list of all macros on a token-->
[
h,if(getMacros() != ""): fullMacList getMacros(); assert(0"There are no macros on the token <b>"+token.name+"</b>"0)]
[
h:fullMacList listSort(fullMacList,"N+")]
[
h:fullMacList json.fromList(fullMacList))]
[
h:macList json.unique(fullMacList)]

<!--
Initialize a few variables that will be used later on-->
[
h:inputParams ""]
[
h:groupArray "[]"]
[
h:macrosInGroup "{}"]

<!--
Loop through the list of macros, and extract the GROUP property from the result of getMacroProps()-->

[
h:tmpArray ""]

<!--
Get the list of all groups that belong to all macros on the token-->
[
h,foreach(macro,macList),CODE:
{
    [
indexes getMacroIndexes(macro)]
    [foreach(
index,indexes): tmpArray = if(getStrProp(getMacroProps(index),"group") == ""json.append(tmpArray"Top Level"), json.append(tmpArraygetStrProp(getMacroProps(index), "group")))]
}]

<!--
Since we need only the names of each unique group, use json.unique() to return list of the unique entries in groupArray-->
[
h:uniqueGroupArray json.unique(tmpArray)]
[
h:uniqueGroupList json.toList(uniqueGroupArray)]
[
h:uniqueGroupList listSort(uniqueGroupList"N+")]

<!--
A stupidly complex group of loops and ifs to sort macros out into groups and avoid duplication-->
[
h,foreach(uniqueGroupuniqueGroupList),CODE:
{
    [
tempObj ""]
    [
h,foreach(macro,macList),CODE:
    {
       [
indexes getMacroIndexes(macro)]
       [
h,foreach(indexindexes): tempObj 
              if(
                  if(
getStrProp(getMacroProps(index),"group")=="""Top Level"getStrProp(getMacroProps(index),"group")) == uniqueGroup,
        
listAppend(tempObjmacro), tempObj)]
    }]
    [
h:macrosInGroup json.set(macrosInGroupuniqueGrouptempObj)]
}]

<!--
Build the input string for the tabs and checkboxes-->
[
h,foreach(uniqueGroupuniqueGroupList),CODE:
{  
   [
macroLabels listSort(json.get(macrosInGroupuniqueGroup), "N+")]
   [
h:inputParams json.append(inputParams"group_"+roll.count+"|"+uniqueGroup+"||TAB")]
   [
h:inputParams json.append(inputParams".|<html><b>Select the Macros you wish to delete. Note: There is no undo!</b></html>||LABEL|SPAN=TRUE")]
   [foreach(
macroLabelmacroLabels),CODE:
   {
      [
idx getMacroIndexes(macroLabel)]
      [foreach(
indexidx): inputParams =if(if(getStrProp(getMacroProps(index),"group")=="""Top Level"getStrProp(getMacroProps(index),"group")) == uniqueGroupjson.append(inputParams"macro_"+index+"|0|<html>"+macroLabel+" "+if(getStrProp(getMacroProps(index),"tooltip")=="""(no tooltip available)""("+getStrProp(getMacroProps(index),"tooltip")+")")+"</html>|CHECK"), inputParams)]
   }]
}]

<!--
Convert inputParams from a JSON string array to a string list, using ## as the list delimiter (required for this trick)-->
[h:inputParams json.toList(inputParams"##")]

<!--
pass inputParams to the input() function to generate an input dialog with tabs for each macro group, and the macros listed-->
[
h:status input(inputParams)]
[
h:abort(status)]


<!--
Finallygo through each macro on the token (again!) and, if its box is checkeddelete it.-->
[
h:delMacroUndo "{}"]
[
h,foreach(macro,macList),CODE:
{
    [
macroIndexes =getMacroIndexes(macro)]
    [foreach(
indexmacroIndexes),code:
    {
       [
checked = eval("macro_"+index)] 
       [if(
checked): delMacroUndo json.set(delMacroUndomacrogetMacroProps(index"json"))]
       [if(
checked): removeMacro(index)]
     }]
}]

<!--
Set a hidden property on the token that will hold the undo list-->
[
h:setProperty("Rumble.DeleteMacroUndo"delMacroUndo)]
Macro(sremoved.
 


Code:
[h:deletedMacros getProperty("Rumble.DeleteMacroUndo")]

[
h:deletedMacroList json.fields(deletedMacros)]

[
h:status input("macToRestore|"+deletedMacroList+"|Choose Macro to Restore|LIST|SELECT=0 VALUE=STRING")]
[
h:abort(status)]

[
h:restoreProps json.get(deletedMacrosmacToRestore)]

[
h:createMacro(restoreProps)]
 


These are standalone macros - they require no library token or anything. They should get all token groups, and be framework- and campaign-agnostic; I put them in my Global Macros panel.

_________________

What I'm Working On

MapTool Tutorials:
Introduction to Tokens
Introduction to Properties
Introduction to Macro Writing
Introduction to Light and Sight


Last edited by Rumble on Wed Jul 01, 2009 7:35 am, edited 1 time in total.

Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Jul 01, 2008 6:48 pm
Posts: 6235
 Post subject: Re: Macro Deletion Utility
PostPosted: Tue Jun 30, 2009 11:42 pm 
Another modification: Macro Copier. With this utility, you:

1. Select a destination token
2. Add a suffix - if desired - to distinguish copied macros from originals on the destination token.
3. Select one or more macros to be copied from the source token to the destination token.

Basically, it's just the macro deletion utility, with the delete part stripped out, and a "macro copying" procedure in its place. I made it so that I could copy multiple macros to another token without macro import/export or dragging and dropping one at a time. For moving a single macro, drag and drop is still quicker. And besides, I don't sleep much...:p

Code:
<!--General method to get macro groups and labels on a tokenThis version is to delete unwanted or unneeded macros-->
<!--
but it is possible to use this information for whatever purpose you might think of-->

<!--
Get a list of all macros on a token-->
[
h,if(getMacros() != ""): fullMacList getMacros(); assert(0"There are no macros on the token <b>"+token.name+"</b>"0)]
[
h:fullMacList listSort(fullMacList,"N+")]
[
h:fullMacList json.fromList(fullMacList))]
[
h:macList json.unique(fullMacList)]

<!--
Initialize a few variables that will be used later on-->
[
h:inputParams ""]
[
h:groupArray "[]"]
[
h:macrosInGroup "{}"]

<!--
Loop through the list of macros, and extract the GROUP property from the result of getMacroProps()-->

[
h:tmpArray ""]

[
h,foreach(macro,macList),CODE:
{
    [
indexes getMacroIndexes(macro)]
    [foreach(
index,indexes): tmpArray = if(getStrProp(getMacroProps(index),"group") == ""json.append(tmpArray"Top Level"), json.append(tmpArraygetStrProp(getMacroProps(index), "group")))]
}]

<!--
Since we need only the names of each unique group, use json.unique() to return list of the unique entries in groupArray-->
[
h:uniqueGroupArray json.unique(tmpArray)]
[
h:uniqueGroupList json.toList(uniqueGroupArray)]
[
h:uniqueGroupList listSort(uniqueGroupList"N+")]

[
h,foreach(uniqueGroupuniqueGroupList),CODE:
{
    [
tempObj ""]
    [
h,foreach(macro,macList),CODE:
    {
       [
indexes getMacroIndexes(macro)]
       [
h,foreach(indexindexes): tempObj 
              if(
                  if(
getStrProp(getMacroProps(index),"group")=="""Top Level"getStrProp(getMacroProps(index),"group")) == uniqueGroup,
        
listAppend(tempObjmacro), tempObj)]
    }]
    [
h:macrosInGroup json.set(macrosInGroupuniqueGrouptempObj)]
}]

[
h,foreach(uniqueGroupuniqueGroupList),CODE:
{  
   [
macroLabels listSort(json.get(macrosInGroupuniqueGroup), "N+")]
   [
h:inputParams json.append(inputParams"group_"+roll.count+"|"+uniqueGroup+"||TAB")]
   [
h:inputParams json.append(inputParams".|<html>Select the Macros you wish to copy. Make sure to configure the copy settings in the <b>Copy Settings</b> tab.</html>||LABEL|SPAN=TRUE")]
   [foreach(
macroLabelmacroLabels),CODE:
   {
      [
idx getMacroIndexes(macroLabel)]
      [foreach(
indexidx): inputParams =if(if(getStrProp(getMacroProps(index),"group")=="""Top Level"getStrProp(getMacroProps(index),"group")) == uniqueGroupjson.append(inputParams"macro_"+index+"|0|<html>"+macroLabel+" "+if(getStrProp(getMacroProps(index),"tooltip")=="""(no tooltip available)""("+getStrProp(getMacroProps(index),"tooltip")+")")+"</html>|CHECK"), inputParams)]
   }]
}]

<!--
Add a Tab to hold the Copy Target info-->
[
h:inputParams json.append(inputParams"copyTab|Copy Settings||TAB")]
[
h:inputParams json.append(inputParams"copyTo|"+getTokenNames()+"|Select destination token|LIST|SELECT=0 VALUE=STRING")]
[
h:inputParams json.append(inputParams"appendInc|0|Add suffix to macro label (so that duplicate macros are not created)|CHECK")]
[
h:inputParams json.append(inputParams"suffix|(copy)|Enter suffix to append")]

<!--
Convert inputParams from a JSON string array to a string list, using ## as the list delimiter (required for this trick)-->
[h:inputParams json.toList(inputParams"##")]

<!--
pass inputParams to the input() function to generate an input dialog with tabs for each macro group, and the macros listed-->
[
h:status input(inputParams)]
[
h:abort(status)]


<!--
Finallygo through each macro on the token (again!) and, if its box is checkedcopy it to the new token.-->

[
h,foreach(macro,macList),CODE:
{
    [
macroIndexes =getMacroIndexes(macro)]
    [foreach(
indexmacroIndexes),code:
    {
       [
macProps getMacroProps(index"json")]
       [
currLabel json.get(macProps"label")]
       [
newLabel currLabel suffix]
       [
checked = eval("macro_"+index)] 
       [if(
appendInc): macProps json.set(macProps"label"newLabel)]
       [if(
checked),token(copyTo): createMacro(macProps)]
     }]
}]

Macros copied.
 

_________________

What I'm Working On

MapTool Tutorials:
Introduction to Tokens
Introduction to Properties
Introduction to Macro Writing
Introduction to Light and Sight


Top
 Profile  
 
User avatar  Offline
Site Admin
 
Joined: Mon Jun 12, 2006 12:20 pm
Posts: 11622
Location: Tampa, FL
 Post subject: Re: Macro Deletion Utility
PostPosted: Wed Jul 01, 2009 2:04 pm 
Rumble wrote:
Another modification: Macro Copier.

Now this I can use right now. Thank you very much!

Tomorrow night I implement the latest lmarkus' campaign file and I'm including my spell macros. But it's currently a pain if you're playing a spellcaster who receives an entire level of spells all at once to drag-n-drop each one onto your own token. But I can add this macro to the "holding token" (the one with all the different macros on it) and add a few prompts for which spell level, then have the entire group copied over.

Or since each spell level is in its own group, just a high-level checkbox for the group? That could bring up a second Wiki: input() with the macros from that group with all of them selected by default (for divine casters) or unselected (for arcane casters).

Thanks again, Rumble!

_________________
Interested in Time Magazine's Best Invention of 2008 Unix-powered laptop? No crashes or lockups. In fact, that series of articles has two such machines. The other is a Dell netbook. :)


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Jul 01, 2008 6:48 pm
Posts: 6235
 Post subject: Re: Macro Deletion Utility
PostPosted: Wed Jul 01, 2009 2:20 pm 
Azhrei wrote:
Rumble wrote:
Another modification: Macro Copier.

Now this I can use right now. Thank you very much!

Tomorrow night I implement the latest lmarkus' campaign file and I'm including my spell macros. But it's currently a pain if you're playing a spellcaster who receives an entire level of spells all at once to drag-n-drop each one onto your own token. But I can add this macro to the "holding token" (the one with all the different macros on it) and add a few prompts for which spell level, then have the entire group copied over.

Or since each spell level is in its own group, just a high-level checkbox for the group? That could bring up a second Wiki: input() with the macros from that group with all of them selected by default (for divine casters) or unselected (for arcane casters).

Thanks again, Rumble!


You're welcome!

I was thinking about a "Copy Entire Group" option; just never got around to it. It would need tweaking to do so; at this point the copy routine just runs through the whole list and copies every checked macro, but it's possible.

_________________

What I'm Working On

MapTool Tutorials:
Introduction to Tokens
Introduction to Properties
Introduction to Macro Writing
Introduction to Light and Sight


Top
 Profile  
 
User avatar  Offline
Site Admin
 
Joined: Mon Jun 12, 2006 12:20 pm
Posts: 11622
Location: Tampa, FL
 Post subject: Re: Macro Deletion Utility
PostPosted: Wed Jul 01, 2009 6:37 pm 
Okay, I've been doing some playing around with your code. :)

First, there appears to be a problem with Wiki: createMacro(): if I pass it a macro index that already exists on the target token, it overwrites that existing macro. :( So I'm modifying your code to check first and if the index already exists, it'll assign a new one. (I'm going to try just deleting the "index" out of the JSON object and see if MapTool will assign a new one. Edit: Yes, this works. So just calling json.remove(..., "index") fixes the issue. I'll go update the wiki.)

Second, it appears that the foreach (roll option) doesn't work with JSON objects in all cases. I wanted to give the foreach loop an array of JSON objects and have the variable be an object each time through the loop, but it doesn't seem to always work. I'm trying to pin down the conditions. (Note: it's not documented to work this way, it just makes sense for it to. And yes, I tried using "json" as the delimiter. ;))

Third, I changed as much code as I could to use JSON arrays and objects hoping to speed things up, but I don't think it helps that much.

Last, I moved the Copy Tab to the front so that it can't be missed and added some formatting to the macro names.

TODO1: I'm thinking of adding a precursor input() that displays a list of all groups and asks which ones should be preselected on the next input().

TODO2: I'm also thinking of adding a checkbox that says not to copy macros with the same name and group on the existing token. Not sure how I want to handle this yet.

Code:
<!-- General method to get macro groups and labels on a token.
     
This version is for copying groups of macros -->

<!-- 
Get a list of all macros on a token -->
[
hfullMacList getMacros("json") ]
[
h, if(json.isEmpty(fullMacList)):
    
assert(0"There are no macros on the token <b>"+token.name+"</b>") ]
[
hfullMacList json.fromList(fullMacList) ]
[
hmacList json.unique(fullMacList)]

<!-- 
Put macros into a JSON object using the group name as the key
     
and a JSON array as the value. -->
[
hgroupObject "{}"]
[
h, foreach(macro,macList), CODE: {
    [
indexes getMacroIndexes(macro)]
    [foreach(
index,indexes), CODE: {
    [ 
macroGroup getStrProp(getMacroProps(index), "group") ]
    [ 
groupName = if(macroGroup == """Top Level"macroGroup) ]
    [ 
tmpArray json.get(groupObjectgroupName) ]
    <!-- 
newObject is equal to 'name: "MySpellMacro", index: "41"' -->
    [ 
newObject json.set("{}""name"macro"index"index) ]
    [ 
tmpArray json.append(tmpArraynewObject) ]
    [ 
groupObject json.set(groupObjectgroupNametmpArray) ]
    } ]
}]

[
huniqueGroups json.sort(json.fields(groupObject"json"), "asc") ]
[
huniqueGroupList json.toList(uniqueGroups) ]

<!-- 
'uniqueGroupList' is a list of groups in alphabetical order. -->
<!-- 
We loop through them and build one tab for each groupthen
     populate the tab with checkboxes 
for each macro. -->

<!-- 
Add a Tab to hold the Copy Target info -->
[
hinputParams "" ]
[
hinputParams json.append(inputParams"copyTab|Copy Settings||TAB") ]
[
hinputParams json.append(inputParams"copyTo|"+getTokenNames()+"|Select destination token|LIST|VALUE=STRING SELECT=0") ]
[
hinputParams json.append(inputParams"appendInc|0|Add suffix to macro label (so that duplicate macros are not created)|CHECK") ]
[
hinputParams json.append(inputParams"suffix|(copy)|Enter suffix to append") ]

[
h, foreach(oneGroupuniqueGroupList), CODE: {
   [ 
macroArray json.get(groupObjectoneGroup) ]
   [ 
macroArray json.sort(macroArray"asc""name") ]
   [ 
groupObject json.set(groupObjectoneGroupmacroArray) ]
   [ 
inputParams json.append(inputParams"group_"+roll.count+"|"+oneGroup+"||TAB")]
   [ 
inputParams json.append(inputParams".|<html>Select the Macros you wish to copy. Make sure to configure the copy settings in the <b>Copy Settings</b> tab.</html>||LABEL|SPAN=TRUE")]
   [ foreach(
oneMacromacroArray), CODE: {
      [ 
name json.get(oneMacro"name") ]
      [ 
index json.get(oneMacro"index") ]
      [ 
props getMacroProps(index) ]
      [ 
tooltip getStrProp(props"tooltip") ]
      [ if(
tooltip==""): tooltip "no tooltip available" ]
      [ 
inputParams json.append(inputParams,
          
"macro_" index "|0|<html><b>" name "</b> " +
          
"(" tooltip ")" "</html>|CHECK") ]
   } ]
} ]

<!-- 
Convert inputParams from a JSON string array to a string list, using ## as the list delimiter (required for this trick) -->
[hinputParams json.toList(inputParams"##") ]

<!-- 
pass inputParams to the input() function to generate an input dialog with tabs for each macro group, and the macros listed -->
[
hstatus input(inputParams) ]
[
habort(status) ]

[
hindexList "[]" ]
[
h, foreach(oneGroupuniqueGroupList), CODE: {
    [ 
macroArray json.get(groupObjectoneGroup) ]
    [ foreach(
objmacroArray), CODE: {
        [ 
index json.get(obj"index") ]
        [ 
checked = eval("macro_" index) ]
        [ if(
checked): indexList json.append(indexListindex) ]
    } ]
} ]

[
htoken(copyTo): tokenId currentToken() ]
[
h, foreach(indexindexList), CODE: {
    [ 
props getMacroProps(index"json") ]
    [ 
props json.remove(props"index") ]
    [ 
label json.get(props"label") ]
    [ if(
appendInc): props json.set(props"label"label suffix) ]
    [ 
createMacro(propstokenId) ]
} ]

Macros copied.  

_________________
Interested in Time Magazine's Best Invention of 2008 Unix-powered laptop? No crashes or lockups. In fact, that series of articles has two such machines. The other is a Dell netbook. :)


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Jul 01, 2008 6:48 pm
Posts: 6235
 Post subject: Re: Macro Deletion Utility
PostPosted: Wed Jul 01, 2009 7:05 pm 
That's much cleaner - I got lost in triply-nested CODE blocks on my first pass, and it became very gruesome. It works, but I kinda "brute-forced" it. I don't know that it will be much faster, though; there's a lot of looping going on.

As for the foreach(): thing not handling JSON objects, I just ran into that problem myself. It sometimes works, and sometimes doesn't. Haven't figured out why. But anyway, very nice!

_________________

What I'm Working On

MapTool Tutorials:
Introduction to Tokens
Introduction to Properties
Introduction to Macro Writing
Introduction to Light and Sight


Top
 Profile  
 
User avatar  Offline
TheBard
 
Joined: Tue Mar 21, 2006 7:26 pm
Posts: 3042
Location: Austin, Tx
 Post subject: Re: Macro Deletion Utility
PostPosted: Wed Jul 01, 2009 8:04 pm 
You guys rock. Thanks for sharing.

_________________
ImageImage ImageImageImageImage
MapTool/Savage Worlds Blog
Free SW/MT Modules
SW Framework for MT


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Jul 01, 2008 6:48 pm
Posts: 6235
 Post subject: Re: Macro Deletion Utility
PostPosted: Wed Jul 01, 2009 8:37 pm 
Azhrei, that is so much more elegant than mine. I have learned from it!

Also, I think it's slightly faster on the same token as my code. Not much, but a little.

_________________

What I'm Working On

MapTool Tutorials:
Introduction to Tokens
Introduction to Properties
Introduction to Macro Writing
Introduction to Light and Sight


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Sun Jun 15, 2008 1:40 pm
Posts: 444
Location: Montréal, QC
 Post subject: Re: Macro Deletion Utility
PostPosted: Wed Jul 01, 2009 9:28 pm 
RPTroll wrote:
You guys rock. Thanks for sharing.

Ditto.

Do you mind if I ask a totally naïve question?
How do you get the code in your posts to get all that coloured syntax? It doesn't do it for everyone, but all you macro-gurus seem to have it in your posts. Just curious.

_________________
"The trouble with communicating is believing you have achieved it"
[ d20 StatBlock Importer ] [ Batch Edit Macros ] [ Canned Speech UI ] [ Lib: Math ]


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there are 0 users online :: 0 registered, 0 hidden and 0 guests (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 0 guests





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman