TABLES, everything you always wanted to do with them

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:

TABLES, everything you always wanted to do with them

Post by wolph42 »

This topic is derived from the accumulation from this topic

The last couple of days a discussion has started about some way to easily get lists into Maptool and to acces them in a friendly way. This has boosted the discussion about 'Tables' in general in MT and before you knew it the basis was created for dynamic transferable tabels with more then one column.

What I created with help of biodude is VERY rudimentary, but at least it works AND is now available in the bottom left corner.

If you view my work as a Beetle (the car) then in analogue you could say that biodude has the plans laid out to create a Hummer en aliasmask has already constructed a Ferrari, but he still needs to check the engine.

The main purpose of this function is to
1. easily store lists/tables onto a token (so you can transfer them)
2. easily access these tables to retrieve info
3. being able to create tables with more then two columns

The retrieval is no longer limited to 'list' functionality (e.g. store 100 names, click on a button and 1 name randomly pops up).
- It has now rudimentary tools for a name generator (have a look inside)
- the ability to retrieve data from a 'normal' table, that is without an index
And I've added raodan's properties editorto the campaign file so you can actually edit tables.
How to operate
1. run attached campaign (in MT70) or drop the token in you existing campaign (don't forget to run oncampaignload when you do this)
2. select the Lists:Lib token (wolf)
3. run ListBuilderFrame (red button)
4. open excel file
5. copy your data from excel
6. paste them into the textbox
7. enter title of the table
8. press save
8. depending on the size it can take a while to process...
9. a frame will pop up with a json object, which confirms that the operation was succesfull
10 click the blue button, a lists of lists is given (there are a few, very bad, examples in there) select one and clik ok will produce a random outcome.
other ways to use
I've added more functionality. Beside an index number you can now also give a string and column number as input for the tables function. The usage is [r:Tables("nameOfTable",numberOfColumn,"nameOfRow")]. The 2nd and 3rd argument are optional. Booga's weapons tables is an example of this, I've added this table to the excelsheet and the campaign.
Note
- if you run [Tables("weapons")], that is a table without an indexnumber and without arguments, you'll get an error
- that weapons will also appear in the 'lists' macro (blue button) and selecting it will also not work.
Here's a linkto a thread where you can 'dump' your lists.

Stuff to do...: loads especially what biodude has in mind is beyond my capabilities and intention. But for now I'll work on this in collaboration with whomever wishes to join in.

I guess this is actually a 'drop in resource' but I have no clue how to start this topic over there...

Download v0.9
TablesPlus.cmpgn
TablesPlus.rptok
TablesPlus ExampleTable.zip
Last edited by wolph42 on Fri Jun 10, 2011 4:36 pm, edited 5 times in total.

User avatar
booga
Dragon
Posts: 365
Joined: Fri Dec 14, 2007 9:00 am

Re: TABLES, everything you always wanted to do with them

Post by booga »

Very interesting !

I'm dong a bit of testing, using 1.3 b70. Following your instructions, I took the following data from excel and tried to use it with your campaign (red button, paste the data straight from Excel, selected a name and hit save).

Code: Select all

Name	Class	Damage	Type	Range	Reload	Pen	Special	tHander	Enc
Buckler	Melee, Parrying	SB-4	I				Balanced,  Defensive,		10
Dagger	Melee, Ordinary	SB-3	R				None		10
Demilance (Cavalry Spear)	Melee, Cavalry	SB	I				Fast, Impact, Tiring		75
Flail	Melee, Flail	SB+1	I				Impact, Tiring	1	95
Foil	Melee, Fencing	SB-2	R				Fast, Precise		40
Gauntlet/Knuckle-duster	Melee, Ordinary	SB-3	I				Pummelling		1
Great Sword	Melee, Two-handed	SB	I				Impact, Slow	1	200
Great Hammer	Melee, Two-handed	SB	I				Impact, Slow	1	200
Great Axe	Melee, Two-handed	SB	I				Impact, Slow	1	200
Great Mace	Melee, Two-handed	SB	I				Impact, Slow	1	200
Great Pick	Melee, Two-handed	SB	I				Impact, Slow	1	200
Great Club	Melee, Two-handed	SB	I				Impact, Slow	1	200
Halberd	Melee, Two-handed	SB	R				Special	1	175
Sword	Melee, Ordinary	SB	R				None		50
Hammer	Melee, Ordinary	SB	R				None		50
Axe	Melee, Ordinary	SB	R				None		50
Mace	Melee, Ordinary	SB	R				None		50
Pick	Melee, Ordinary	SB	R				None		50
Club	Melee, Ordinary	SB	R				None		50
Improvised	Melee, Ordinary	SB-4	I				None		35
Lance	Melee, Cavalry	SB+1	I				Fast, Impact,  Tiring		100
Main Gauche	Melee, Parrying	SB-3	I				Balanced,  Defensive		15
Morning Star	Melee, Flail	SB	I				Impact, Tiring		60
Quarter Staff	Melee, Ordinary	SB-2	I				Defensive, Pummelling	1	50
Rapier	Melee, Fencing	SB-1	R				Fast		40
Shield	Melee, Ordinary	SB-2	I				Defensive, Special		50
Spear	Melee, Ordinary	SB	I				Fast		50

I name it WFRP, it gives me this fine looking json:

Code: Select all

{"Buckler":{"Class":"Melee, Parrying","Damage":"SB-4","Type":"I","Range":"","Reload":"","Pen":"","Special":"Balanced, Defensive,","tHander":"","Enc":10},"Dagger":{"Class":"Melee, Ordinary","Damage":"SB-3","Type":"R","Range":"","Reload":"","Pen":"","Special":"None","tHander":"","Enc":10},"Demilance (Cavalry Spear)":{"Class":"Melee, Cavalry","Damage":"SB","Type":"I","Range":"","Reload":"","Pen":"","Special":"Fast, Impact, Tiring","tHander":"","Enc":75},"Flail":{"Class":"Melee, Flail","Damage":"SB+1","Type":"I","Range":"","Reload":"","Pen":"","Special":"Impact, Tiring","tHander":1,"Enc":95},"Foil":{"Class":"Melee, Fencing","Damage":"SB-2","Type":"R","Range":"","Reload":"","Pen":"","Special":"Fast, Precise","tHander":"","Enc":40},"Gauntlet/Knuckle-duster":{"Class":"Melee, Ordinary","Damage":"SB-3","Type":"I","Range":"","Reload":"","Pen":"","Special":"Pummelling","tHander":"","Enc":1},"Great Sword":{"Class":"Melee, Two-handed","Damage":"SB","Type":"I","Range":"","Reload":"","Pen":"","Special":"Impact, Slow","tHander":1,"Enc":200},"Great Hammer":{"Class":"Melee, Two-handed","Damage":"SB","Type":"I","Range":"","Reload":"","Pen":"","Special":"Impact, Slow","tHander":1,"Enc":200},"Great Axe":{"Class":"Melee, Two-handed","Damage":"SB","Type":"I","Range":"","Reload":"","Pen":"","Special":"Impact, Slow","tHander":1,"Enc":200},"Great Mace":{"Class":"Melee, Two-handed","Damage":"SB","Type":"I","Range":"","Reload":"","Pen":"","Special":"Impact, Slow","tHander":1,"Enc":200},"Great Pick":{"Class":"Melee, Two-handed","Damage":"SB","Type":"I","Range":"","Reload":"","Pen":"","Special":"Impact, Slow","tHander":1,"Enc":200},"Great Club":{"Class":"Melee, Two-handed","Damage":"SB","Type":"I","Range":"","Reload":"","Pen":"","Special":"Impact, Slow","tHander":1,"Enc":200},"Halberd":{"Class":"Melee, Two-handed","Damage":"SB","Type":"R","Range":"","Reload":"","Pen":"","Special":"Special","tHander":1,"Enc":175},"Sword":{"Class":"Melee, Ordinary","Damage":"SB","Type":"R","Range":"","Reload":"","Pen":"","Special":"None","tHander":"","Enc":50},"Hammer":{"Class":"Melee, Ordinary","Damage":"SB","Type":"R","Range":"","Reload":"","Pen":"","Special":"None","tHander":"","Enc":50},"Axe":{"Class":"Melee, Ordinary","Damage":"SB","Type":"R","Range":"","Reload":"","Pen":"","Special":"None","tHander":"","Enc":50},"Mace":{"Class":"Melee, Ordinary","Damage":"SB","Type":"R","Range":"","Reload":"","Pen":"","Special":"None","tHander":"","Enc":50},"Pick":{"Class":"Melee, Ordinary","Damage":"SB","Type":"R","Range":"","Reload":"","Pen":"","Special":"None","tHander":"","Enc":50},"Club":{"Class":"Melee, Ordinary","Damage":"SB","Type":"R","Range":"","Reload":"","Pen":"","Special":"None","tHander":"","Enc":50},"Improvised":{"Class":"Melee, Ordinary","Damage":"SB-4","Type":"I","Range":"","Reload":"","Pen":"","Special":"None","tHander":"","Enc":35},"Lance":{"Class":"Melee, Cavalry","Damage":"SB+1","Type":"I","Range":"","Reload":"","Pen":"","Special":"Fast, Impact, Tiring","tHander":"","Enc":100},"Main Gauche":{"Class":"Melee, Parrying","Damage":"SB-3","Type":"I","Range":"","Reload":"","Pen":"","Special":"Balanced, Defensive","tHander":"","Enc":15},"Morning Star":{"Class":"Melee, Flail","Damage":"SB","Type":"I","Range":"","Reload":"","Pen":"","Special":"Impact, Tiring","tHander":"","Enc":60},"Quarter Staff":{"Class":"Melee, Ordinary","Damage":"SB-2","Type":"I","Range":"","Reload":"","Pen":"","Special":"Defensive, Pummelling","tHander":1,"Enc":50},"Rapier":{"Class":"Melee, Fencing","Damage":"SB-1","Type":"R","Range":"","Reload":"","Pen":"","Special":"Fast","tHander":"","Enc":40},"Shield":{"Class":"Melee, Ordinary","Damage":"SB-2","Type":"I","Range":"","Reload":"","Pen":"","Special":"Defensive, Special","tHander":"","Enc":50},"Spear":{"Class":"Melee, Ordinary","Damage":"SB","Type":"I","Range":"","Reload":"","Pen":"","Special":"Fast","tHander":"","Enc":50}}
when I try to use the blue button and bit fro the newly built json I get:

macro.function.general.macro.function.number.invalid

What could I be doing wrong ? I'm attaching the excel data I used.

Also when I try to find the json created with your macro in the Lib token, I am unable to see its properties (I assue that's where the json is created right ?).

Thanks !
Attachments
test.7z
Excel file I used for the test
(3.79 KiB) Downloaded 177 times


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

Re: TABLES, everything you always wanted to do with them

Post by wolph42 »

booga wrote:Very interesting !

I'm dong a bit of testing, using 1.3 b70. Following your instructions, I took the following data from excel and tried to use it with your campaign (red button, paste the data straight from Excel, selected a name and hit save).
(...)
when I try to use the blue button and bit fro the newly built json I get:

macro.function.general.macro.function.number.invalid

What could I be doing wrong ? I'm attaching the excel data I used.

Also when I try to find the json created with your macro in the Lib token, I am unable to see its properties (I assue that's where the json is created right ?).

Thanks !
Allright, I've finally have found some time to look at this and had I looked a bit better at your question I could have answered it immediately. Anyway:
1. the error: currently what this function (blue button) does is give you a random entry of a list. For this to work the list MUST start with an numeric index e.g.
1 Axe
2 Sword
3 Pike
etc.
the blue button just rolls a d[highest number in the index] and returns the entry of the second column. You can also create your own function but it will still (currently) require an index number and optionally a column number: e.g. [Tables("myTestTable",3,5)]
will look up the entry that starts with '5' in the first column and returns the value found in the 3rd column.
Basically it works exactly the same as the standard 'table' function of MT only there are more columns available. (and its easier to put stuff in). I think however that I can rewrite the function to check whether the second argument (row index number) is a string (e.g. 'Axe') and lookup that value in the table.

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

Re: TABLES, everything you always wanted to do with them

Post by wolph42 »

ok I've updated the function to handle none-numeric-index as well. I've added the macro 'testWeapons' based on Booga's weapons table to show how it works.

and i've added raodan's token properties editorso you can have a look how that works.

Talmon
Cave Troll
Posts: 52
Joined: Mon May 23, 2011 10:35 pm
Location: Baltimore, MD

Re: TABLES, everything you always wanted to do with them

Post by Talmon »

Is this tool still in use?

I tried to make a list with it and get the following error:

Code: Select all

java.lang.IndexOutOfBoundsException: Index: 5, Size: 5 error executing expression item = json.get( row , i ).

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

Re: TABLES, everything you always wanted to do with them

Post by wolph42 »

man this thing is ancient.... but yes if you use it then it must still be alive. This version should work however I've found that hardly anyone uses it (among which myself) so I stopped with it. Still Im willing to take a look, but need a bit more info than what you gave me. Can you describe what you tried to do?

Talmon
Cave Troll
Posts: 52
Joined: Mon May 23, 2011 10:35 pm
Location: Baltimore, MD

Re: TABLES, everything you always wanted to do with them

Post by Talmon »

Basically I received that error when trying to create a table. I added my table information from an Excel spreadsheet, gave it a name, and hit the button. then I received that error.

I am attaching the table in excel format (change it from .zip to .xlsx) that I was trying to convert in case there is an error in the table or something.


also another question for you. i know you use Json a lot and there is one thing that is irritating me with them.

Where are json arrays and objects stored?

on a token ? in a macro?

are they dynamic meaning that i have to have a macro to build them every time they are called? I know you can store some in a porperty, but I don't know how to initialize a property to accept a json array or object.
Attachments
weaponList.zip
(14.76 KiB) Downloaded 191 times

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

Re: TABLES, everything you always wanted to do with them

Post by wolph42 »

you're right, there is a bug. It seems that it has been always there as I don't receive an error report (no clue why) however wading through the log I noticed it. Ill have a look later and upload a fix.

The json objects are stored on the lib:token (the wolf), using the Wiki: setLibProperty() and the Wiki: getLibProperty() function. You can also initialize properties by defining them in the campaign properties. Then you can access them by just selecting the token and using e.g.
[h:Strength = 5]
[r:Strength]
(Strength is defined by default on the token properties set)

Since I don't know which names you are going to use up front I can't define them up front.
For normal tokens you use Wiki: setProperty() and Wiki: getProperty()

Talmon
Cave Troll
Posts: 52
Joined: Mon May 23, 2011 10:35 pm
Location: Baltimore, MD

Re: TABLES, everything you always wanted to do with them

Post by Talmon »

Thank you, I look forward to seeing the new fix.

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

Re: TABLES, everything you always wanted to do with them

Post by wolph42 »

ok fixed the bug. It seems that if you end a row with empty columns they aren't changed into cells, which I expected it would. Fixed this.

Talmon
Cave Troll
Posts: 52
Joined: Mon May 23, 2011 10:35 pm
Location: Baltimore, MD

Re: TABLES, everything you always wanted to do with them

Post by Talmon »

Excellent, so do I just redownload the files at the top again?


Talmon
Cave Troll
Posts: 52
Joined: Mon May 23, 2011 10:35 pm
Location: Baltimore, MD

Re: TABLES, everything you always wanted to do with them

Post by Talmon »

Just got home and wanted to give this a try, now I am getting the error:

Code: Select all

java.lang.IndexOutOfBoundsException: Index: 6, Size: 6 error executing expression item = json.get( row , i ).
Disregard this,

I got it to work.

Thanks a bunch.

khorne
Cave Troll
Posts: 37
Joined: Thu Dec 25, 2008 8:47 am

Re: TABLES, everything you always wanted to do with them

Post by khorne »

A very basic question about tables I have edited with the maptool basic Table Editor... how do you hide the result from the players?

Thnx
Byez

Post Reply

Return to “Drop-In Macro Resources”