putting a formula inside a table
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.
putting a formula inside a table
Is it possible to put code/formula inside the value section of a table? I've looked everywhere on the forums with no luck. (maybe I was asking the wrong thing in the search bar)
I realize the above doesn't work but is there a way to put something like "You take (1d4) dexterity damage!" but have the 1d4 calculated?
OOOHH RegEx....YOU BITTER-SWEET BEAST!!!
- Full Bleed
- Demigod
- Posts: 4736
- Joined: Sun Feb 25, 2007 11:53 am
- Location: FL
Re: putting a formula inside a table
Why don't you just eval the table value in the macro?Sereptus wrote:Is it possible to put code/formula inside the value section of a table? I've looked everywhere on the forums with no luck. (maybe I was asking the wrong thing in the search bar)
I realize the above doesn't work but is there a way to put something like "You take (1d4) dexterity damage!" but have the 1d4 calculated?Spoiler
Range would be 1-52. Value would be 1d4.
Code: Select all
[eval(table("table name", 1))]
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."
- JamzTheMan
- Great Wyrm
- Posts: 1872
- Joined: Mon May 10, 2010 12:59 pm
- Location: Chicagoland
- Contact:
Re: putting a formula inside a table
I suppose he may have just wanted to double click the table for a random table result with random effect for each table entry.
But I don't believe that's possible and you will have to create a macro to do it as Full Bleed suggests.
But I don't believe that's possible and you will have to create a macro to do it as Full Bleed suggests.
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork
Re: putting a formula inside a table
Yes Jamz, that's what I was looking for. I suppose I'll just have to use the switch() CASE: for all the outputs if I want things calculated inside of text. Ugh! Thats a lot of writing for fumble and crit charts! LOL!! I'll post the macro when I find the time but for now this campaign is keeping me too busy. Thanks for the input guys! I also wanted the output of the charts in <font color=red size=+2> to make sure I wouldn't miss a fumble but haven't figured out how to do that either! Anyway! Back to the Orcs!
P.S. Jamz, I switched over to your awesome NERPS version and am pretty impressed by certain functionality, although I have Herolab and Syrinscape I've been unable to get Herolab working at all, although I suspect it's because I'm using 5E. message me if you have any tips.
P.S. Jamz, I switched over to your awesome NERPS version and am pretty impressed by certain functionality, although I have Herolab and Syrinscape I've been unable to get Herolab working at all, although I suspect it's because I'm using 5E. message me if you have any tips.
OOOHH RegEx....YOU BITTER-SWEET BEAST!!!
- Full Bleed
- Demigod
- Posts: 4736
- Joined: Sun Feb 25, 2007 11:53 am
- Location: FL
Re: putting a formula inside a table
You wanted to just click on the table from the table window and not use a macro for output?Sereptus wrote:Yes Jamz, that's what I was looking for.
Your example did not show a table that would display the output in the text you illustrated...
And why would just clicking on the table be easier/better than having a table macro? Guess I'm not seeing the problem here.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."
Re: putting a formula inside a table
Sorry Full Bleed, I wasn't being very specific or clear. I do use a macro to call crit and fumble charts that I got from a Pathfinder campaign file, I don't know who did all the work for the original charts.
My output to chat currently looks like this
I just was wondering if there was any way to have the expression evaluated when sending to chat,( GUT SLASH: Double damage and 3 bleed. Target cannot swallow whole.) also I wanted to make the text in BOLD RED for the fumble chart just to make sure I didn't miss that if I was busy looking something else up up when the player rolled. It seems this kind of functionality is not supported or maybe it is with the right coding when I call the macro?
Thanks again
Spoiler
Spoiler
Thanks again
OOOHH RegEx....YOU BITTER-SWEET BEAST!!!
- JamzTheMan
- Great Wyrm
- Posts: 1872
- Joined: Mon May 10, 2010 12:59 pm
- Location: Chicagoland
- Contact:
Re: putting a formula inside a table
I believe you will have to grab the table value and then parse it and format it. The easiest way may be to use regular expression to find "[0-9]+d[0-9]+" to find dice expressions and eval those and then put it together and format the string. Otherwise eval will try and evaluate the whole string in the table...
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork
Re: putting a formula inside a table
For the tables, if you surround the random values with [r: XX ] then when you get the string you can use evalMacro. I like that better than eval because if there is no code, it just returns it as a string. Basically, it looks for any [] and runs it with in the string. Also, there is no confusion as to what is code and what is not unlike with the eval function.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
- JamzTheMan
- Great Wyrm
- Posts: 1872
- Joined: Mon May 10, 2010 12:59 pm
- Location: Chicagoland
- Contact:
Re: putting a formula inside a table
Ah, forgot about evalMacro. Man, it seemed like there would have been an easy way but it wasn't coming to me either.
Alias, can you also use {1d4} instead of [r: 1d4] ? Just curious.
Edit: Tested and yea, that works perfectly!
Table Test Entry 1: Double damage and {1d4} bleed!
[r: evalMacro(table("Test", 1))]
Alias, can you also use {1d4} instead of [r: 1d4] ? Just curious.
Edit: Tested and yea, that works perfectly!
Table Test Entry 1: Double damage and {1d4} bleed!
[r: evalMacro(table("Test", 1))]
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork
Re: putting a formula inside a table
Awesome! Thanks guys! Now to edit all the tables to reflect this! BTW, who wrote all those fumble/crit tables for the Pathfinder framework?
Thanks again guys!
Thanks again guys!
OOOHH RegEx....YOU BITTER-SWEET BEAST!!!
- JamzTheMan
- Great Wyrm
- Posts: 1872
- Joined: Mon May 10, 2010 12:59 pm
- Location: Chicagoland
- Contact:
Re: putting a formula inside a table
If they are the ones I'm thinking of, they were taking from the Critial Hit/Fumble decks from paizo. They are pretty fun, we use them at our table (physical cards).Sereptus wrote:Awesome! Thanks guys! Now to edit all the tables to reflect this! BTW, who wrote all those fumble/crit tables for the Pathfinder framework?
Thanks again guys!
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork