Hello Folks;
Running into a rather frustrating issue that I have not run into previously. Part of the difficulty will be attempting to explain...
Here goes:
I have created a weapons "database" that is a series of jsons. Example:
[H: noneData = json.set("{}",
"Weapon", "None",
"Damage Dice", 0,
"Damage Modifier", 0,
"Strength", 1,
"Type","Melee",
"HTH", "Y",
"Throw", "N",
"Hands", 0,
"DR", 0,
"DXMod", 0
)]
This is repeated for each weapon type (using fantasy trip melee rules)
At the end of the list of jsons, I finish with:
[H: weaponData=json.set("{}",
"None", noneData,
"Dagger", daggerData,
"Main-Gauche", maingaucheData,
"Rapier", rapierData,
"Club", clubData,
"Hammer", hammerData,
<etc>
)]
[H: return(0, weaponData)]
In various other macros, I call the macro thusly: [h: weaponData=tftWeaponsDB()]. Note it is a UDF.
This all works fine and I am able to use my homebrewed "database" except that each time I call the weaponsDB, it dumps the contents of the macro into the chat. This is annoying as heck. Everything is predicated with an "H" in the various roll options and the forms that are submitted work great. What am I doing wrong?
json dump when calling macro
Moderators: dorpond, trevor, Azhrei
- Full Bleed
- Demigod
- Posts: 4736
- Joined: Sun Feb 25, 2007 11:53 am
- Location: FL
Re: json dump when calling macro
Have you tried setting the ignoreOutput parameter when you defined the function?
https://wiki.rptools.info/index.php/defineFunction
That won't explain why it's happening (I'd have to see all of the code), but it might be a quick fix...
https://wiki.rptools.info/index.php/defineFunction
That won't explain why it's happening (I'd have to see all of the code), but it might be a quick fix...
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."
Re: json dump when calling macro
I would need to see full code but you probably have something that breaks the code like ' in the wrong spot... perhaps a comment.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
-
- Kobold
- Posts: 22
- Joined: Tue Feb 14, 2017 5:33 pm
Re: json dump when calling macro
Thank-you, both, for the response. I actually got away from the issue by moving the logic that needs the json macro out of the presentation. That seemed to eliminate the problem for now.
However, I will triple-check my comments (I have a rather large amount of them to explain how the macro is used and a description of the various fields at the beginning of it). AND I will try the ignoreOutput parameter if I run into it again.
Appreciate the response and the options.
However, I will triple-check my comments (I have a rather large amount of them to explain how the macro is used and a description of the various fields at the beginning of it). AND I will try the ignoreOutput parameter if I run into it again.
Appreciate the response and the options.
- Full Bleed
- Demigod
- Posts: 4736
- Joined: Sun Feb 25, 2007 11:53 am
- Location: FL
Re: json dump when calling macro
MT doesn't have a proper comment method.Elyre_Elan wrote: ↑Mon Jun 07, 2021 6:28 pmHowever, I will triple-check my comments (I have a rather large amount of them to explain how the macro is used and a description of the various fields at the beginning of it).
Are you commenting with:
[h: " <!-- Comments here. -->"]
I think that's the safest.
And I suggest that you don't use any single or double quotes in them. So no contractions.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."