Potential bug - reading value of 1 from Library token prop's
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
Potential bug - reading value of 1 from Library token prop's
I've noticed my macros can't pick up a value of 1 off a library token's properties. Other values, so far at least, don't have this issue. Anyone else noticed this?
Re: Potential bug - reading value of 1 from Library token pr
Can you give an example of how you came to this conclusion?
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: Potential bug - reading value of 1 from Library token pr
I can upload my cmpgn file if that'd help. I've got a token named 'Lib:Utility' with a property called 'BaseDiff'. Here's some test code I used:
And, these are the results I get from , first setting BaseDiff = 2, then setting BaseDiff = 1:
Code: Select all
[h: val = 0]
[h: val = getLibProperty("BaseDiff", "Lib:Utility")]
Val = {val}
Jeff:
Val = 2
Jeff:
Val =
Re: Potential bug - reading value of 1 from Library token pr
I guaranty you there is more going on than this code.
I created a lib token and set Strength to 2 and then 1 and it gave the correct values in output.
I created a lib token and set Strength to 2 and then 1 and it gave the correct values in output.
Code: Select all
[r: val = getLibProperty("Strength","lib:util")]
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
- Full Bleed
- Demigod
- Posts: 4736
- Joined: Sun Feb 25, 2007 11:53 am
- Location: FL
Re: Potential bug - reading value of 1 from Library token pr
Going to guess that BaseDiff property is evaluated in some way as to invalidate the intended 1 value.aliasmask wrote:I guaranty you there is more going on than this code.
OP, you might want to share the campaign.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."
Re: Potential bug - reading value of 1 from Library token pr
Did you perhaps predefine the property on the lib with a default value of 1?
Cause in that case this can happen.
Cause in that case this can happen.
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Potential bug - reading value of 1 from Library token pr
Yes, I gave the property in question a default value of 1. What should I do?
Re: Potential bug - reading value of 1 from Library token pr
Remove it. Just leave it empty. Just to be clear: I'm talking about the value you set in the campaign properties.
You can then manually set the value to 1 on the lib, that's no problem
You can then manually set the value to 1 on the lib, that's no problem
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Potential bug - reading value of 1 from Library token pr
Aha, so I'm NOT going crazy! Well, at least not on this point maybe. The problem in my case is not critical and I have devised a workaround similar to what you discuss above.
Please watch this video. The Global Toggles macro I talk about here uses Lib properties to store the values of the checkboxes. My macros then reference those properties with "[IF(getLibProperty("Strength")) ...". This works fine ... until I cut the Lib token, reload my campaign, delete the Lib token that is there and paste the one that is on the clipboard (i.e. replacing it with the newer version). Now when I run the exact same referencing macro, MT 91 fails with the generic "Error in roll ...".
Why? I haven't changed the property at all! If I run Global Toggles again to change it (or run the Reset MPB Props also discussed in the video), the macro starts working fine again. My theory up to this point is the act of pasting the Lib in somehow "destabilizes" Strength (and other props) causing it to change from a numeric value to an alphanumeric one. Regardless of when you go to the Properties tab of the token, it displays visually as "0" or "1". There are no quotes, whitespace or anything else to suggest the data type has been changed to a string. It LOOKS like a number.
No, I have not set a default for Strength (or the other checkbox props) in Edit->Campaign Properties. Again, this isn't critical as there is the Reset MPB Props workaround which runs [Strength=1]. I will try the [Strength=2] workaround but I am still curious ...
Please watch this video. The Global Toggles macro I talk about here uses Lib properties to store the values of the checkboxes. My macros then reference those properties with "[IF(getLibProperty("Strength")) ...". This works fine ... until I cut the Lib token, reload my campaign, delete the Lib token that is there and paste the one that is on the clipboard (i.e. replacing it with the newer version). Now when I run the exact same referencing macro, MT 91 fails with the generic "Error in roll ...".
Why? I haven't changed the property at all! If I run Global Toggles again to change it (or run the Reset MPB Props also discussed in the video), the macro starts working fine again. My theory up to this point is the act of pasting the Lib in somehow "destabilizes" Strength (and other props) causing it to change from a numeric value to an alphanumeric one. Regardless of when you go to the Properties tab of the token, it displays visually as "0" or "1". There are no quotes, whitespace or anything else to suggest the data type has been changed to a string. It LOOKS like a number.
No, I have not set a default for Strength (or the other checkbox props) in Edit->Campaign Properties. Again, this isn't critical as there is the Reset MPB Props workaround which runs [Strength=1]. I will try the [Strength=2] workaround but I am still curious ...
StarMan - The MacroPolicebox D&D 4E Framework: Import ANYTHING!
Re: Potential bug - reading value of 1 from Library token pr
I never quite understood this behavior. Is there a REASON it would want to do this? I can't think of a valid reason it would make sense.wolph42 wrote:Did you perhaps predefine the property on the lib with a default value of 1?
Cause in that case this can happen.
Re: Potential bug - reading value of 1 from Library token pr
I think this is only an issue for predefined token properties on lib tokens. I would say, just don't do it. If you have variables to set on a lib token, then do it with setLibProperty. I usually have databases and other settings I set with a macro.celestian wrote:I never quite understood this behavior. Is there a REASON it would want to do this? I can't think of a valid reason it would make sense.wolph42 wrote:Did you perhaps predefine the property on the lib with a default value of 1?
Cause in that case this can happen.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools