RPTools.net

Discussion and Support

Skip to content

It is currently Tue Nov 21, 2017 3:22 am 




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. :)



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

Previous topic | Next topic 

  Print view

Author Message
 Offline
Kobold
 
Joined: Sun Oct 21, 2012 4:30 am
Posts: 20
 Post subject: Nested tables
PostPosted: Wed Jan 23, 2013 8:20 am 
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?


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7948
Location: Bay Area
 Post subject: Re: Nested tables
PostPosted: Wed Jan 23, 2013 8:30 am 
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:


Top
 Profile  
 
 Offline
Kobold
 
Joined: Sun Oct 21, 2012 4:30 am
Posts: 20
 Post subject: Re: Nested tables
PostPosted: Wed Jan 23, 2013 9:50 am 
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")]


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9419
Location: Netherlands
 Post subject: Re: Nested tables
PostPosted: Wed Jan 23, 2013 11:17 am 
I would say load up the campaign file and we'll have a look.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
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


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7948
Location: Bay Area
 Post subject: Re: Nested tables
PostPosted: Wed Jan 23, 2013 11:20 am 
Oh, you're using a slash command in a macro. That works in chat, but not with macros. You can do it this way.

Code:
[r: evalMacro(tbl("RACE"))]

where the Dwarves entry is
Code:
[r: tbl("DWARVES")]

or you can put tbl("DWARVES") and use eval instead of evalMacro. Typing /tbl RACE works only as a chat command.

_________________
Downloads:


Top
 Profile  
 
 Offline
Kobold
 
Joined: Sun Oct 21, 2012 4:30 am
Posts: 20
 Post subject: Re: Nested tables
PostPosted: Wed Jan 23, 2013 4:45 pm 
You have totally and utterly solved it for me.
Ta


Top
 Profile  
 
 Offline
Kobold
 
Joined: Thu Aug 03, 2017 11:21 am
Posts: 6
 Post subject: Re: Nested tables
PostPosted: Fri Aug 04, 2017 12:31 pm 
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?


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9419
Location: Netherlands
 Post subject: Re: Nested tables
PostPosted: Fri Aug 04, 2017 1:15 pm 
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"))] )

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
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


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7948
Location: Bay Area
 Post subject: Re: Nested tables
PostPosted: Fri Aug 04, 2017 1:19 pm 
There are several ways to do this.

One way only using MT table is to do an evalMacro at the first level
Code:
[r: evalMacro(tbl("Treasure"))]


Then for your table entries you can put in the final value or another evalMacro call. For example,

Code:
"Treasure" Table
- [r: evalMacro(tbl("Potion"))]
- [r: evalMacro(tbl("Gold"))]

"Potion" Table
- [r: evalMacro(tbl("AttackPotions"))]
- [r: evalMacro(tbl("HealingPotions"))]

"AttackPotions" Table
- [r: 1d8 + " holy water damage"]
- [r: 1d6 + " fire damage"]

"HealingPotions" Table
- [r: 1d8+" healing"]
- [r: 2d8+" healing"]
- "No Healing"

"Gold"
 Table
- [r: 2d10 + " gold"]
- [r: 4d20 + " gold"] 

_________________
Downloads:


Top
 Profile  
 
 Offline
Kobold
 
Joined: Thu Aug 03, 2017 11:21 am
Posts: 6
 Post subject: Re: Nested tables
PostPosted: Fri Aug 04, 2017 3:34 pm 
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?


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7948
Location: Bay Area
 Post subject: Re: Nested tables
PostPosted: Fri Aug 04, 2017 3:59 pm 
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:


Top
 Profile  
 
 Offline
Kobold
 
Joined: Thu Aug 03, 2017 11:21 am
Posts: 6
 Post subject: Re: Nested tables
PostPosted: Fri Aug 04, 2017 4:22 pm 
I'm pretty sure all of that's right...

Attachment:
chat.jpg
chat.jpg [ 60.24 KiB | Viewed 361 times ]


Attachment:
Table1.jpg
Table1.jpg [ 53.03 KiB | Viewed 361 times ]


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7948
Location: Bay Area
 Post subject: Re: Nested tables
PostPosted: Fri Aug 04, 2017 5:21 pm 
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:


Top
 Profile  
 
 Offline
Kobold
 
Joined: Thu Aug 03, 2017 11:21 am
Posts: 6
 Post subject: Re: Nested tables
PostPosted: Fri Aug 04, 2017 5:49 pm 
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.


Encounter Design.cmpgn [25.53 KiB]
Downloaded 10 times
Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7948
Location: Bay Area
 Post subject: Re: Nested tables
PostPosted: Sat Aug 05, 2017 3:03 am 
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.

Code:
[r: evalMacro(tbl("AttackPotionsFork"))]


Your potiontype table will need to be of a similar format as the others and use a call similar to the one above.

_________________
Downloads:


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 17 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 is 1 user online :: 0 registered, 0 hidden and 1 guest (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 1 guest





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

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman