RPedit - Macro Importer/Exporter and Editor [4/19/13]

These are tools and utilities that make it easier to run games. This includes Lib: macro tokens dropped into MapTool to manage the game, a conversion file for CharacterTool to allow use in MapTool, or just about anything else you can think of -- except graphics with macros and anything specific to a particular campaign framework. Those are already covered by the Tilesets subforum and the Links and External Resources forum.

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

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: RPedit - Macro Importer/Exporter and Editor [7/17/11]

Post by wolph42 »

aliasmask wrote:MapTool 1.3b89 load fix. This should be backwards compatible with b87 as well.
what exactly breaks if I would not use this update? (this is more asked in the light that with 5 different locations where i run mt, there's a great chance that i forget to update one). is it 'just' the label popping up or it also have more serious effects? I don't do this often but I have had some 'search and replace' through the 50k lines of code using your method (which is always a bit scary as it touches EVERYTHING ,but that's what backups are for) so any changes in the code will make me a bit wary.

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: RPedit - Macro Importer/Exporter and Editor [4/19/13]

Post by aliasmask »

Well, I used the 3.5/Pathfinder framework for my test case. I tested the existing copy to a new exported/imported copy to see if anything different pops up. It didn't. Also, I didn't change much in this, just the order of operation of a couple of lines and one extra line to removed command from the props before applying varsFromStrProp (which is something I probably should have done in the first place).

I've noticed a couple of wonky things with b89 that I'm still trying to figure out. One of them is with the 3.5/Pathfinder framework and his OutputTo function. There is some kind of ; conversion that is messing with some of the old output that worked fine before.

If you're going to use b89, I would not use the version before this. You'll know the error when you see it, and it will not function at all. In fact, I would use this version for b87 and before as well. I'm going to go through this thread and remove all other versions to remove any version confusion.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: RPedit - Macro Importer/Exporter and Editor [4/19/13]

Post by wolph42 »

aliasmask wrote: I'm going to go through this thread and remove all other versions to remove any version confusion.
in case you didn't know: user profile --> overview --> manage attachments. Ideal for such a clean up.

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: RPedit - Macro Importer/Exporter and Editor [4/19/13]

Post by aliasmask »

wolph42 wrote:
aliasmask wrote: I'm going to go through this thread and remove all other versions to remove any version confusion.
in case you didn't know: user profile --> overview --> manage attachments. Ideal for such a clean up.
Thanks. I have like 8 pages of attachments from over the years. Good thing I named all the files roughly the same.

Anyway, all the older versions have been removed. The OP has a link to the most recent download. If someone wants it for an older version of MT I think the code is compatible to about b73. It would just be a matter of exporting the macros from one to the other in MapTool, not RPEdit.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: RPedit - BUG!!

Post by wolph42 »

Hi Alias,

I've discovered a rather disturbing bug in rpedit, which has resulted in the BoT being broken several times. It took me a while to narrow it down but I finally was able to limit the issue to this:

Code: Select all

['test1']
["test2"] 
when this 'macro' is loaded in rpedit ONLY the first line is taken and the rest of the macro is lost. Fortunately this appears to have happened only once now (I think) but its rather disturbing as I use your editor to wade through the thousands of lines of code and if one macro is lost I don't notice it until someone reports a bug to me.
Anyway what also struck me as odd is that this is what rpedit shows in the frame:

Code: Select all

@@ @T9
@PROPS@ fontColor=black ; autoExecute=true ; fontSize=1.00em ; sortBy=7 ; color=default ; playerEditable=false ; applyToSelected=true ; group= ; tooltip= ; minWidth=90 ; 
["test1"]

!! 
apart from the dissapearing code, notice how the 'single quotes' suddenly are changed into "double quotes", I guess its a related issue.

edit: if you swap the two lines, then again only the first line is shown, the rest is lost.
also: if you put lines between these two lines, then still everything is lost after the first line. It appears that if this combination is the macro then after the first line everything is lost.

some more findings:

Code: Select all

["test2"]
<!-- IGNORE ME -->
[ignore me too]
['test1']
results in only first line

Code: Select all

<!-- IGNORE ME -->
["test2"]
<!-- IGNORE ME -->
[ignore me too]
['test1']
works! So apparently the first line must be a [''] or [""] combined with another line with quotes anywhere in the code.

final edit (im gonna stop after this one): it does also not matter WHERE the quotes are between the [] so where it basically boils down to is:
IF the first line in a macro starts with [" OR [' THEN the remainder of the macro is lost!! I ran some tests and this turns out to be true for most macros. the only second ingredient is another line in the macro where there are also quotes (can be the same as the first line, so the single/double is also not a requirement to break it.
Attachments
LibW42_Test.rptok
(79.49 KiB) Downloaded 102 times

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: RPedit - Macro Importer/Exporter and Editor [4/19/13]

Post by aliasmask »

Are you using the latest version. Because of the java 7 change, it broke something in how the old version was parsing the lines of code. It was mostly due to lazy programming because I would do a varsFromStrProp on whole macro structure where certain combinations in the command variable would blow up. So, I removed that from structure first and then applied it in the fix and changed the order of operation a little. (noted previously in this thread).

I'll test your file and see if it's related to that bug that was fixed in latest version.

edit: yes, I see the error. I'll see what is causing it. I think it may be related to a conversion from str prop to json and back. Somewhere it thinks the first line looks like a json, hence the quote conversion. If you put [r: 'test'] it no longer looks like a json and processes normally.

edit: Weird, my file doesn't have the changes I made to it. I think I may have posted the wrong file. Anyway, I'll post the fix soon. Wait did I post the code changes earlier?

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: RPedit - Macro Importer/Exporter and Editor [4/19/13]

Post by aliasmask »

Okay, I see. My "fix" is also reproducing the same error. If I do this:

Code: Select all

[H: command = replace(json.get(macro,"command"),"\\n{3,}",eol+eol)]
[H: macro = replace(json.remove(macro,"command"),";","&#"+59)]
[H: varsFromStrProp(json.toStrProp(macro))]
"command" is pulled from json and put in to a variable BUT if the string looks like this: [word ...] where ... can be the rest of the macro command (called greedy in regex) then it thinks it's a json and tries to "fix" it. So, the problem isn't my code, but MT json interpretation.

This definitely isn't good. I believe there was a patch for json.type that was going to better identify a json structure and this could be related.

edit: I posted some output and you'll see it's MT related. "macro" is defined like this:

Code: Select all

   [H: macro = getMacroProps(index,"json",id)]
So, for T2 you see it never reads the full text and T1 is converted when assigned to a variable because it looks similar to a json and is converted by MT.
Test Results
code test.jpg
code test.jpg (234.57 KiB) Viewed 5794 times
The semi good news is I can do a work around for T1 Example, but T2 is a big problem. Also, the fix for T1 would slow down the process and I think I can do a work around for T2 by not returning it as a json.

In the macro text of a macro button, if you have a space or anything before the [, then it won't look like a json and the problem is solved. If your first line doesn't look like a json [H: ..] then it works fine. If the code doesn't end in ] then you're fine. I never ran in to this because I usually put <-- comment --> at beginning and pretty much always use r: or h: in my statements.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: RPedit - Macro Importer/Exporter and Editor [4/19/13]

Post by wolph42 »

well I usually also not run into it cause all my macros start with
[h:<!-- macroname -->]
however in this case I forgot the 'h:'.

I would suggest that you report this bug. (I just reported another one).

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: RPedit - Macro Importer/Exporter and Editor [4/19/13]

Post by wolph42 »

new bug found.

Tested in b87 and b89, only appears in b89.

I don't know if this happens in general but:
- open the current bag of tricks in b87
- select your lib:test
- run 'edit token' from campaign panel
- select 'all macros'
works.

Do the same in b89 and I get a 'label' request. (pop-up).

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: RPedit - Macro Importer/Exporter and Editor [4/19/13]

Post by Full Bleed »

Not sure I fully understand the latest back-n-forth over some bugs from different versions (b87 vs b89 and java 6 vs java 7).

Are there any known issues using the latest version on b87 with java 6?
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."


User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: RPedit - Macro Importer/Exporter and Editor [4/19/13]

Post by aliasmask »

I'll see if I get an error, but is it the same error as above. If a macro starts with [ a-z ... and ends with ] without the : after the first set of characters, it tries to convert it to a json improperly. I believe Lee is working on a fix for this.

The solution is, for at least the very first line of a macro, to include the : or put a comment an html comment at top until that gets fixed in b90.

Wolph42, I'll take a look and see if this is something new. That bug is only in b89 and is related to the parser.

Lee
Dragon
Posts: 958
Joined: Wed Oct 19, 2011 2:07 am

Re: RPedit - Macro Importer/Exporter and Editor [4/19/13]

Post by Lee »

aliasmask wrote:...I believe Lee is working on a fix for this.
What I'm working on, I'm afraid, is completely incompatible with the current official source. Though I see a light at the end of the tunnel, I'm still in the throes of ironing out the upheaval I caused by touching the JSON implementation (there were a LOT :shock:). Right now, I'm so far off the beaten track that I'll probably make a call for campaigns with heavy JSON to do testing with, which means it'll be a while before I'm confident to release. What I can say is that I'm taking pains to make sure JSON is encoded and decoded correctly, while watching if the parser spits out a furball.

Anyway, coupled with my experiments with topology, this further delays my demo production again. Sigh. But, I digress. I failed to see the OP when it first came out, but A.M. pointed it out to me earlier this month. I'll try to look into it when I have the time, but, apart from the BoT, could I be provided with a smaller scale test to do debugging with?

Thanks.

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: RPedit - Macro Importer/Exporter and Editor [4/19/13]

Post by aliasmask »

If you look a couple of posts above, I posted some testing data (Test Results Spoiler). T1, T2, T3 are really small macros that I run the rpedit against. The right hand side is just debugging to show that the proper data is being passed to macro as demonstrated by the dialogue line in code below the images.

When command is defined it changes the value in the assignment because of the json-like format. The replace just replaces 3+ CRs to 2 getting rid of excessive blank lines.

Lee
Dragon
Posts: 958
Joined: Wed Oct 19, 2011 2:07 am

Re: RPedit - Macro Importer/Exporter and Editor [4/19/13]

Post by Lee »

aliasmask wrote:If you look a couple of posts above, I posted some testing data (Test Results Spoiler). T1, T2, T3 are really small macros that I run the rpedit against. The right hand side is just debugging to show that the proper data is being passed to macro as demonstrated by the dialogue line in code below the images.
Ah, I see. From what I can tell, passing ['[]'] through the parser works as expected (i.e. treated as a string), correct? I was a bit groggy a while ago and forgot to say that yes, the parser does look for jsons first before treating what's left as a string/number. It does a split between ':' to separate roll options from the roll itself; so if there's a '[something something]' or '{}' after the split, it will try to convert it to JSON. It seems sound when you stare at the code, but I suspect that in your macro code, there's an evalMacro or execMacro in there somewhere, and that something changed in how b89 interprets it. Either that, or there's something different about MT's variable resolver. With that being said, I'll try extracting your macro code for RPEdit and narrow it down from there, or you could pick out suspect snippets of code for me since you know this code best :)

Edit: Still groggy it seems. I see what you mean by the single quotes turning into doubles, and it happening to strings not necessarily having brackets enclosing them (e.g. '[string]' or '{string}'). Hmm, it could either be a JSON transformation or the use of toString() within the code, which wraps the passed object in double quotes.

Edit #2: fixed that broken chain of thought up there. oh the fatigue...
Last edited by Lee on Thu Aug 22, 2013 10:03 am, edited 1 time in total.

Post Reply

Return to “Drop-In Macro Resources”