Nested tables
Moderators: dorpond, trevor, Azhrei
Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior.
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior.
Nested tables
Something strange has happened to my nested tables.
They have stopped working
The macro looks up the table alright but if it is then instructed to go on to a further table it will not.
For example the table entry /tbl DWARVES just returns /tbl DWARVES and doesn't look it up on the DWARVES table.
I was wondering if there is some preference I have inadvertantly changed.
Any suggestions?
They have stopped working
The macro looks up the table alright but if it is then instructed to go on to a further table it will not.
For example the table entry /tbl DWARVES just returns /tbl DWARVES and doesn't look it up on the DWARVES table.
I was wondering if there is some preference I have inadvertantly changed.
Any suggestions?
Re: Nested tables
I just tested it out and it seems to work. Are the table names spelled correctly and with the right case (case sensitive). Also, does the roll field in both tables have values and is the range of values correct (6 items labelled 1-6 where Roll is 1d6).
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: Nested tables
Absolutely. All case correct, all values accounted for. As i said, they have been working and I haven't changed them.In addition I have tried with a test table and the result is the same. It just prints out /tbl DWARVES without going there.
The macro is
[r:tbl("RACE")]
The macro is
[r:tbl("RACE")]
Re: Nested tables
I would say load up the campaign file and we'll have a look.
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: Nested tables
Oh, you're using a slash command in a macro. That works in chat, but not with macros. You can do it this way.
where the Dwarves entry is
or you can put tbl("DWARVES") and use eval instead of evalMacro. Typing /tbl RACE works only as a chat command.
Code: Select all
[r: evalMacro(tbl("RACE"))]
Code: Select all
[r: tbl("DWARVES")]
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: Nested tables
You have totally and utterly solved it for me.
Ta
Ta
-
- Kobold
- Posts: 6
- Joined: Thu Aug 03, 2017 12:21 pm
Re: Nested tables
This problem is very similar to my own so I'm hoping to restart this thread. If that can't be done... well, I'll post elsewhere.
Here's the problem. What if the nested tables are multiple and variable levels deep?
So, I have a macro that "gets treasure". Gets Treasure is a table of tables that, you guessed it, calls a table of tables, which in turn is likely to call a table of tables...
GetsTreasure-->SomePotions-->AttackPotionsTables-->SpecificAttackPotion
of course, it could call....
GetsTreasure-->AmmountOfGold-->SpecificAmmountOfGold
Let's say that you have a Macro that rolls on the table "GetsTreasure". How would I write the macroeval macro so as to continue to pull up the table call commands through the nesting? Or does Macroeval do that automatically. In the previous example, if "dwarves" was a table, would the Macroeval go into that table as well?
Here's the problem. What if the nested tables are multiple and variable levels deep?
So, I have a macro that "gets treasure". Gets Treasure is a table of tables that, you guessed it, calls a table of tables, which in turn is likely to call a table of tables...
GetsTreasure-->SomePotions-->AttackPotionsTables-->SpecificAttackPotion
of course, it could call....
GetsTreasure-->AmmountOfGold-->SpecificAmmountOfGold
Let's say that you have a Macro that rolls on the table "GetsTreasure". How would I write the macroeval macro so as to continue to pull up the table call commands through the nesting? Or does Macroeval do that automatically. In the previous example, if "dwarves" was a table, would the Macroeval go into that table as well?
Re: Nested tables
you do that by cramming this:
[r: evalMacro(tbl("RACE"))]
inside the table so in your example (a bit shorter)
GetsTreasure (this is the macro) -->SomePotions (this is a table)-->AttackPotionsTables (this is the final table)
then:
GetsTreasure contains:
[r: evalMacro(tbl("SomePotions "))]
in SomePotions
you have the entry
[r: evalMacro(tbl("AttackPotionsTables "))]
and in
AttackPotionsTables
you have:
"Strength + 1" (or in case of you full example: [r: evalMacro(tbl("SpecificAttackPotion"))] )
[r: evalMacro(tbl("RACE"))]
inside the table so in your example (a bit shorter)
GetsTreasure (this is the macro) -->SomePotions (this is a table)-->AttackPotionsTables (this is the final table)
then:
GetsTreasure contains:
[r: evalMacro(tbl("SomePotions "))]
in SomePotions
you have the entry
[r: evalMacro(tbl("AttackPotionsTables "))]
and in
AttackPotionsTables
you have:
"Strength + 1" (or in case of you full example: [r: evalMacro(tbl("SpecificAttackPotion"))] )
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: Nested tables
There are several ways to do this.
One way only using MT table is to do an evalMacro at the first level
Then for your table entries you can put in the final value or another evalMacro call. For example,
One way only using MT table is to do an evalMacro at the first level
Code: Select all
[r: evalMacro(tbl("Treasure"))]
Code: Select all
"Treasure" Table
1 - [r: evalMacro(tbl("Potion"))]
2 - [r: evalMacro(tbl("Gold"))]
"Potion" Table
1 - [r: evalMacro(tbl("AttackPotions"))]
2 - [r: evalMacro(tbl("HealingPotions"))]
"AttackPotions" Table
1 - [r: 1d8 + " holy water damage"]
2 - [r: 1d6 + " fire damage"]
"HealingPotions" Table
1 - [r: 1d8+1 " healing"]
2 - [r: 2d8+3 " healing"]
3 - "No Healing"
"Gold" Table
1 - [r: 2d10 + " gold"]
2 - [r: 4d20 + " gold"]
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
-
- Kobold
- Posts: 6
- Joined: Thu Aug 03, 2017 12:21 pm
Re: Nested tables
Hmmm...
I think there's a legacy wiki out there. I swear that I read I couldn't put roll options or macro calls inside of tables. That would certainly make a lot of this easier.
I'm going to give your suggestions a shot and see how they work. Thanks for all the help.
***Okay, I entered the macro call in the table as:
[r: evalMacro(tbl("AttackPotion1"))] where AttackPotion1 is NOT a table of tables.
and it kicked that exact phrase out to the chat window. In other words, it didn't roll on AttackPotion1. It just wrote [r: evalMacro(tbl("AttackPotion1"))] in the chat window. It wrote it in red, if that makes sense.
Is there some option I should turn on or off?
I think there's a legacy wiki out there. I swear that I read I couldn't put roll options or macro calls inside of tables. That would certainly make a lot of this easier.
I'm going to give your suggestions a shot and see how they work. Thanks for all the help.
***Okay, I entered the macro call in the table as:
[r: evalMacro(tbl("AttackPotion1"))] where AttackPotion1 is NOT a table of tables.
and it kicked that exact phrase out to the chat window. In other words, it didn't roll on AttackPotion1. It just wrote [r: evalMacro(tbl("AttackPotion1"))] in the chat window. It wrote it in red, if that makes sense.
Is there some option I should turn on or off?
Re: Nested tables
If you're not going to specify the field or random number make sure your table has the correct roll in it for your fields. Also, you're evaluating the values in your potion table as a macro, so make sure it's formatted correctly. Also, table names are case sensitive, so make sure that's correct.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
-
- Kobold
- Posts: 6
- Joined: Thu Aug 03, 2017 12:21 pm
Re: Nested tables
I'm pretty sure all of that's right...
Re: Nested tables
I've tested this on my machine so I know it works, so it's probably your data or calling macro. I too at first was doing the calls incorrectly and it would just give me the text of the macro code. This would probably go faster if I were to just log on to your server and take a look. If you want to arrange a time for this we can try and meet up. PM me with any details.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
-
- Kobold
- Posts: 6
- Joined: Thu Aug 03, 2017 12:21 pm
Re: Nested tables
I've.... no idea how to do that. Sorry, I have an advanced degree in English. Computers do...well what they're doing with me right now. I could attach the campaign file. It basically has one token, 3 tables, and two macros on it. Would that work?
Mostly though, I don't want someone to "fix" my code. I have hundreds of these tables to enter, and I don't want to be on here for every one of them, so I'd really just like to know how it works. So, if you see what I'm doing wrong or where I'm going zig when I should be zagging, I'd appreciate the head's up.
In any case, I've attached the campaign file.
Mostly though, I don't want someone to "fix" my code. I have hundreds of these tables to enter, and I don't want to be on here for every one of them, so I'd really just like to know how it works. So, if you see what I'm doing wrong or where I'm going zig when I should be zagging, I'd appreciate the head's up.
In any case, I've attached the campaign file.
- Attachments
-
- Encounter Design.cmpgn
- (25.53 KiB) Downloaded 31 times
Re: Nested tables
I'll take a look at your campaign, but if you haven't already entered all your tables I may have a better solution for you. One that makes dealing with your data easier. Personally, I don't use the MT tables and just create data structures with all my data.
*edit* after a quick look all you need to do to call the table is what I posted above.
Your potiontype table will need to be of a similar format as the others and use a call similar to the one above.
*edit* after a quick look all you need to do to call the table is what I posted above.
Code: Select all
[r: evalMacro(tbl("AttackPotionsFork"))]
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools