Is there an external table editor? [update: there is now!]

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

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

Is there an external table editor? [update: there is now!]

Post by wolph42 »

[Update: file and link to online doc can be found in and attached to this post below]

I guess the subject sais it all: is there an external (so outside maptool) where the xml tables can be created, edited and when done imported into maptool?

I just discovered the table option in maptool and frankly I was slightly blown away by the endless possibilities that doomed before me, for one I already have an enormous amount of tables in Excel with the necessary script to run through them (check out the download section of strike-to-stun.net to get an idea of what I do with tables :D). Embedding them into maptool seems a natural thing to do.

However! I have 0 skills in xml, I can go as far as export a table in maptool, notice that its a zip, unpack it, load it into excel (which works) edit it, zip it again, import it back into maptool -->error. From which I guess that the xml format excel uses does not comply with maptool.

sooo.... hence my question above. I like to copy paste my excel tables into this 'editor' and import them into maptool (preferably I would like to copy paste a list straight into the maptool table editor but I guess for that I need to be in the features section....)
Last edited by wolph42 on Thu Oct 08, 2009 6:18 am, edited 5 times in total.

User avatar
Hawke
Great Wyrm
Posts: 2261
Joined: Sat Apr 21, 2007 12:12 am
Location: Albuquerque, NM

Re: Is there a external table editor?

Post by Hawke »

What does the content of an exported table file look like? I'm sure there's more elegant ways to do this, but if it's easy enough you could always make some good use of the excel contactenate function to alter your existing tables. I haven't looked at the files though and am at work so I can't look at them here.

User avatar
wyrmwood
Dragon
Posts: 458
Joined: Thu May 22, 2008 12:15 am

Re: Is there a external table editor?

Post by wyrmwood »

another post mentions this html preview editor. This seems handy

http://www.w3schools.com/html/tryit.asp ... html_basic

http://forums.rptools.net/viewtopic.php?f=20&t=11282

The issue I find with using Excel (or Word) to generate HTML is that they typically generate a host of linked files, and the amount of actual html markup required to present a page is tremendous. (I was just looking at the last html file I made with Word and it's only about 2 pages of display, just text and a few pictures, and the file has 1688 lines of markup.)

An html editor I've used on and off since college is Chami's HTML kit.

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

Re: Is there a external table editor?

Post by wolph42 »

Hawke wrote:What does the content of an exported table file look like? I'm sure there's more elegant ways to do this, but if it's easy enough you could always make some good use of the excel contactenate function to alter your existing tables. I haven't looked at the files though and am at work so I can't look at them here.
do you mean exported form Maptool or exported from Excel? The export from MT into Excel works perfectly (you get a nice table in excel) the other way round though... is likely what Wyrmwood suggests: an xml table with a HUGE amount of junk attached.
As for the concatenate function... are you suggesting that I generate xml code from within Excel?? I can boogie quite well in Excel and VBA, but as I said I know jack-poo about xml so I wouldn't know where to start.

@Wyrmwood: I don't quite see how the basic HTML editor will help me create an xml table out of a say basic xls, csv or tsv file?

Maybe I should rephrase my question:
What I'm looking for is an elegant way to 'copy paste' a basic table (columns seperated either by commas, tabs or anything else), straight into the table section of Maptool, either by directly copy-pasting it into Maptool (which doesn't work) or by copy-pasting it first in another editor which is able to translate it into an xml file that Maptool can import.

User avatar
Hawke
Great Wyrm
Posts: 2261
Joined: Sat Apr 21, 2007 12:12 am
Location: Albuquerque, NM

Re: Is there a external table editor?

Post by Hawke »

The table file (I forget the extension) should be plaintext - try opening it in notepad to test, but better off with something like textpad or one of the other notepad clones. You can see the format of the table - XML isn't a language per se but a way to mark up the data. Depending on how it's setup, it might be really clear on how to handle table entries and maniplate them with your concat... if you paste a few lines of actual table values, we might be able to figure it out.

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

Re: Is there a external table editor?

Post by wolph42 »

Good point!
Here is an example table which I would like to paste into MT (tab seperated):

Code: Select all

1-30	You find a variety of coins but none of value.	
31-35	You find 1 copper piece.	
36-40	[1d10/5] pieces of copper.	
(.....)
96-100	[1d10] gold pieces.
If I export this table from MT and have a look at it, it looks like this:

Code: Select all

<net.rptools.maptool.model.LookupTable>
  <entryList>
    <net.rptools.maptool.model.LookupTable_-LookupEntry>
      <min>1</min>
      <max>30</max>
      <value>You find a variety of coins but none of value.</value>
    </net.rptools.maptool.model.LookupTable_-LookupEntry>
    <net.rptools.maptool.model.LookupTable_-LookupEntry>
      <min>31</min>
      <max>35</max>
      <value>You find 1 copper piece.</value>
    </net.rptools.maptool.model.LookupTable_-LookupEntry>
    <net.rptools.maptool.model.LookupTable_-LookupEntry>
      <min>36</min>
      <max>40</max>
      <value>[1d10/5] pieces of copper.</value>
    </net.rptools.maptool.model.LookupTable_-LookupEntry>
(....)
    <net.rptools.maptool.model.LookupTable_-LookupEntry>
      <min>96</min>
      <max>100</max>
      <value>[1d10] gold pieces.</value>
    </net.rptools.maptool.model.LookupTable_-LookupEntry>
  </entryList>
  <name>veCoin</name>
  <defaultRoll>1d100</defaultRoll>
  <visible>true</visible>
  <allowLookup>true</allowLookup>
</net.rptools.maptool.model.LookupTable> 
from this I can already see that no xml editor will 'automatically' convert a random list into the MT-xml 'standard'.

So the answer to my question is : 'No'

I am however very curious to any suggestions how to tackle this puppy...?

User avatar
Hawke
Great Wyrm
Posts: 2261
Joined: Sat Apr 21, 2007 12:12 am
Location: Albuquerque, NM

Re: Is there a external table editor?

Post by Hawke »

So what you're looking for is generating a list of these to copy&paste into the tables file. Ignore the stuff before & after but just generate:

Code: Select all

    <net.rptools.maptool.model.LookupTable_-LookupEntry>
      <min>1</min>
      <max>30</max>
      <value>You find a variety of coins but none of value.</value>
    </net.rptools.maptool.model.LookupTable_-LookupEntry>
I don't think spaces matter in the XML (someone please correct me if this is wrong!) So you're looking for something like this

Code: Select all

=CONCATENATE("<net.rptools.maptool.model.LookupTable_-LookupEntry>      <min>",B1,"</min><max>",C1,"</max><value>",D1,"</value></net.rptools.maptool.model.LookupTable_-LookupEntry>")
The trick is then splitting out into A1 value into two formats "1-20"... something like this might work for B1

Code: Select all

=LEFT(A1,FIND("-",A1)-1)
In B1 should make it show the first part of the number. Whereas C1 would look like

Code: Select all

=RIGHT(A1,FIND("-",A1))
and should display after the -.

Am I making sense? I don't know how excelly you are... and I am not 100% sure that MapTool isn't super picky about formatting the XML, but my guess is this will work.

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

Re: Is there a external table editor?

Post by wolph42 »

you're fast! :D

I'm quite heavy on the excel side, so yes this makes sense, I'll give it a try. Need to adjust my campaign files first with the other code I posted in the other thread first, if I've still got time im gonna test it tonight.

thnxs!

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

Re: Is there a external table editor?

Post by wolph42 »

well here the 'correct' excel method (my version wants ; in stead of , and I prefer the & over the concatenate function)

Code: Select all

A1: 1-30
B1: "You find a ..."
C1: =LEFT(A1;FIND("-";A1)-1)
D1: =IF(A1="";"";RIGHT(A1;LEN(A1)-FIND("-";A1)))
E1: 
="<net.rptools.maptool.model.LookupTable_-LookupEntry>"&CHAR(10)&"      <min>"&C1&"</min>"&CHAR(10)&"      <max>"&D1&"</max>"&CHAR(10)&"      <value>"&B1&"</value>"&CHAR(10)&"</net.rptools.maptool.model.LookupTable_-LookupEntry>"
I've added spaces and and linebreaks and your RIGHT function was wrong

This results into:

Code: Select all

"<net.rptools.maptool.model.LookupTable_-LookupEntry>
      <min>1</min>
      <max>30</max>
      <value>You find a variety of coins but none of value. </value>
</net.rptools.maptool.model.LookupTable_-LookupEntry>"
Which resembles the code, I've tested it in Excel, not yes in MT, I'll do this later and if it works I'll create a generic excel sheet which I'll post here for others to use.
Last edited by wolph42 on Thu Oct 08, 2009 4:55 am, edited 1 time in total.

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

Re: Is there a external table editor?

Post by wolph42 »

it took some finetuning but attached is an excel file that creates an translation. I can make it a bit more userfriendly but for now it works.

Thanks for the input!

edit: attachement is removed new version below
Last edited by wolph42 on Thu Oct 08, 2009 4:51 am, edited 1 time in total.

User avatar
Hawke
Great Wyrm
Posts: 2261
Joined: Sat Apr 21, 2007 12:12 am
Location: Albuquerque, NM

Re: Is there a external table editor?

Post by Hawke »

Cool, hope it works out well for you. I figured some of those functions wouldn't be exactly there - doing it from memory is always tricky =)

pelwer
Cave Troll
Posts: 36
Joined: Sat Jan 24, 2009 2:31 pm
Location: Portland, OR
Contact:

Re: Is there a external table editor?

Post by pelwer »

Folks,

Very, very cool!

Found 1 problem. If my range entry is a single number, the function stops working.

If you enter this:

Code: Select all

41-45   [2d10] pieces of copper.
46        You find 1 silver piece.      <<< This line will generate an error in the formula.
47-55    [1d10/5] silver pieces. 
Any chance of getting a patch for this? A lot of my encounter tables have single numbers in the entries.

Great Work!
Pat.
A little nonsense, now and then, is relished by the wisest men. - Willy Wonka

Currently playing Savage Worlds in the home-brew world of Shadora.
We are looking for players! PM me if interested.

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

Re: Is there a external table editor?

Post by wolph42 »

Thanks Pat!

I've updated the excel sheet, tested it more thoroughly, it still works :D and added a short manual. Also added the possibility to set the parameters for the table.

Attached is the new version, which I boldly named version 1.0 8)
Edit: if you don't have Excel, it also works in Google docs, just upload the file, it wil act a bit strange as it will show the full content of the blue box (turning off wrap text will help but not much), but it does work. Alternatively you can use this link (but I'm a bit unsure what happens if two people are using that online doc at the same time...)

The cells C1 and D1 should have been:

Code: Select all

C1: =IF(ISERROR(FIND("-";A1));A1;LEFT(A1;FIND("-";A1)-1))
D1: =IF(ISERROR(FIND("-";A1));A1;RIGHT(A1;LEN(A1)-FIND("-";A1)))
This takes care of the bug.
Attachments
table2MTxml v1.0.xls.zip
(38.56 KiB) Downloaded 242 times

User avatar
CyrusStonecypher
Giant
Posts: 158
Joined: Thu Nov 26, 2009 1:22 am
Location: Columbus, IN, U.S.A.

Re: Is there an external table editor? [update: there is now!]

Post by CyrusStonecypher »

Awesome! Thank you!

ziltmilt
Dragon
Posts: 331
Joined: Sun Apr 29, 2007 9:28 pm
Contact:

Re: Is there an external table editor? [update: there is now!]

Post by ziltmilt »

I think I'm running into a maximum character limit with Excel. It's only generating about 2/3 of my table.

Can the output in column H be split, so that there's 2 or 3 Middle sections? This would also require an additional blue cell block. I tried changing H3 to do an OFFSET on the first 100 rows and then adding a 2nd middle to do an OFFSET on the next 50, but in my 2nd blue box, it's just repeating the table text from the beginning.

Post Reply

Return to “Macros”