Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

edited May 2016
Thanks to everyone here and a bit of hard work on my part my NPC generator is getting more complex and more useful with each version. I'd like to add damage counters to each generator. I have the maths to do it, but I'm unsure of how to start. So in GURPS your damage, as in most games, is based off of HP. However there are some differences as you can survive if you make rolls at certain HP levels

Less than 1/3 HP offers some penalties
0 HP or Less
-1xHP
-2xHP
-3xHP
-4xHP

So a character with 10 HP I'd like to be able to make something that might look like this

HP -1xHP -2xHP -3xHP -4xHP
OOOOO OOOOO OOOOO OOOOO OOOOO
OOOOO OOOOO OOOOO OOOOO OOOOO

I know IPP can do colours, green, black, and Red is enough for me. So how would I go about getting IPP to pick 10 "O's@ then properly colour them? Probably asking too much but I'm going to start to look into it.

• It's not clear to me from your post what the breakpoints are supposed to be, but here is an example which will give you your first 2/3rds in black and the last third in red. There may be a more elegant way to make the correct number of dots (maybe with recursion and When statements?), but this was the first solution I thought of.
```Table: hits
Set: hp={1d4+10}
Set: low_hp={round({hp}/3)}
{hp} hp, one third is {low_hp}\n&#91;#{{hp}-{low_hp}} dots&#93; &lt;font color="red"&gt;&#91;#{low_hp} dots&#93;&lt;/font&gt;

Table: dots
O
OO
OOO
OOOO
OOOOO
OOOOOO
OOOOOOO
OOOOOOOO
OOOOOOOOO
OOOOOOOOOO
OOOOOOOOOOO
OOOOOOOOOOOO
OOOOOOOOOOOOO
OOOOOOOOOOOOOO
OOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOO
```

That gives a result like this:

12 hp, one third is 4
OOOOOOOO OOOO

14 hp, one third is 5
OOOOOOOOO OOOOO
• I agree with jdale -- it makes a big difference whether the program is supposed to figure out the color scheme (and how it should do so) or if the color scheme will just be hard-coded.

Having said that, I've been having a bit of fun with it. First wrote this:
```table: showHits
&#91;@RepeatWithColor with 5, green, O&#93; &
&#91;@RepeatWithColor with 5, orange, O&#93; &
&#91;@RepeatWithColor with 5, orange, O&#93; &
&#91;@RepeatWithColor with 5, orange, O&#93; &
&#91;@RepeatWithColor with 5, red, O&#93;\n&
&#91;@RepeatWithColor with 2, green, O&#93;&
&#91;@RepeatWithColor with 3, red, O&#93; &
&#91;@RepeatWithColor with 5, orange, O&#93; &
&#91;@RepeatWithColor with 5, orange, O&#93; &
&#91;@RepeatWithColor with 5, orange, O&#93; &
&#91;@RepeatWithColor with 5, red, O&#93;\n&

table: RepeatWithColor
&#91;when not&#93;{RWCcnt}&#91;do&#93;{RWCcnt==0}&#91;end&#93;&
&#91;when&#93;{RWCcnt}=0&#91;do&#93;{RWCcnt=={\$1}}&lt;font color={\$2}&gt;&#91;else&#93;{RWCcnt=={{RWCcnt}-1}}&#91;end&#93;&
&#91;when&#93;{RWCcnt}&gt;0&#91;do&#93;{\$3}&#91;@RepeatWithColor with {\$1}, {\$2}, {\$3}&#93;&#91;else&#93;&lt;/font&gt;&#91;end&#93;
```
RepeatWithColor wants 3 parameters: quantity of repeats, color, and string to repeat.
Kind of interesting, but calling it is not much more attractive than just writing the HTML yourself.

So here's another (more complex, but a bit cooler) option:
```table: showHits2
&#91;@Colorize with 5-green-&nbsp;-5-orange-&nbsp;-5-orange-&nbsp;-5-orange-&nbsp;-5-red, O&#93;\n&
&#91;@Colorize with 2-green-3-red-&nbsp;-5-orange-&nbsp;-5-orange-&nbsp;-5-orange-&nbsp;-5-red, O&#93;

table: Colorize
set: colors={\$1}
set: stringToColorize={\$2}
{buildstring==''}&
&#91;{colors} &gt;&gt; eachchar subColorize1&#93;&#91;@subColorize2&;#93;

table: subColorize1
&#91;when&#93;{\$1}=-&#91;do&#93;&#91;@subColorize2&;#93;{buildstring==''}&#91;else&#93;{buildstring=='{buildstring}{\$1}'}&#91;end&#93;

table: subColorize2
&#91;when&#93;{lookingForAColor}&
&#91;do&#93;&#91;@RepeatWithColor with {repeatNum}, {buildString}, {stringToColorize}&#93;{lookingForAColor==''}&
&#91;else&#93;&
&#91;when&#93;&#91;@IsNumeric with {buildstring}&#93;&
&#91;do&#93;{repeatNum=='{buildString}'}{lookingForAColor=='yes'}&
&#91;else&#93;{buildString}{lookingForAColor==''}&
&#91;end&#93;&#91;end&#93;

table: RepeatWithColor
&#91;when not&#93;{RWCcnt}&#91;do&#93;{RWCcnt==0}&#91;end&#93;&
&#91;when&#93;{RWCcnt}=0&#91;do&#93;{RWCcnt=={\$1}}&lt;font color={\$2}&gt;&#91;else&#93;{RWCcnt=={{RWCcnt}-1}}&#91;end&#93;&
&#91;when&#93;{RWCcnt}&gt;0&#91;do&#93;{\$3}&#91;@RepeatWithColor with {\$1}, {\$2}, {\$3}&#93;&#91;else&#93;&lt;/font&gt;&#91;end&#93;

table: IsNumeric
{testString=='{\$1}'}&
&#91;when&#93;{{testString}*1}={testString}&#91;do&#93;yes&#91;else&#93;&#91;end&#93;
```
Colorize wants two parameters:
1) A string defining the colors. Each "chunk" is separated by dashes. A chunk can be:
a) a number, in which case the following chunk is expected to be a color
b) a color, or
c) a string to be printed in standard black. This string can not contain spaces (confuses "eachchar" -- use   instead) or commas (confuses "with") or of course dashes (confuses Colorize).
2) The string to be repeated

Maybe one of those will for for you.
• edited May 2016
I'm not sure how I would do that.

So within the table I want to create there would be 6 rows, the HP or FP would be taken from the results of a different table so {\$FP} or {\$HP} to get say 10 or 29

HP 0 HP -1xHP -2xHP -3xHP -4xHP

In each row there would be up to 5 'O' of various colors. The first row will always be Green except the last 1/3 which is Red. I'd like the Second row (0 HP) to be all yellow, the next three rows to be Orange, and the last row to be all Red. This is an example of 10 HP.

OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO
OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO

However if it was say 29 HP then in the first row would have 20 green and 9 red 'O' as 1/3 of 29 is 9 and the red starts to indicate penalties I need to apply. and the -4xHP Row is always red right through. The ... was just to line them up in the forums.

OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO
OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO
OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO
OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO
OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO
OOOO.. OOOO.. OOOO. OOOO.. OOOO... OOOO

One of the things I want to do is keep each row with 5 'O' as it makes for easier counting.

This is one way I thought of doing it but once you start getting to 15+ HP the coding gets damn long.
```Table: HPStatus
&#91;when&#93; {\$HP} &lt; 5 &#91;do&#93; &lt;table border="0"&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;HP&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;0 HP&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;-1xHP&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;-2xHP&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;-3xHP&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;-4xHP&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;font color=green&gt;OOOO&lt;/font&gt;&lt;font color=red&gt;O&lt;/font&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;OOOOO&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;OOOOO&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;OOOOO&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;font color=red&gt;OOOOO&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&#91;when&#93; {\$HP} &lt; 6 &#91;do&#93; &lt;table border="0"&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;HP&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;0 HP&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;-1xHP&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;-2xHP&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;-3xHP&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;-4xHP&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;font color=green&gt;OOOOO&lt;/font&gt;&lt;font color=red&gt;O&lt;/font&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;OOOOO&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;OOOOO&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;OOOOO&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;font color=red&gt;OOOOO&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

Table: FPStatus
&#91;when&#93; {\$FP} &lt; 5 &#91;do&#93; &lt;table border="0"&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;FP&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;0 FP&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;-1xHP&lt;/b&gt;&lt;/td&gt;&lt;tr&gt;&lt;td&gt;&lt;font color=green&gt;OOOO&lt;/font&gt;&lt;font color=red&gt;O&lt;/font&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;OOOOO&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
EndTable
```
• largando

I'm having a heck of a time understanding your solution.
• Wow, I totally forgot about this thread! It looks like my last post presented two different solutions. Which one are you focusing on?
• Either of them. They are both a bit over my level of understanding. It probably wouldn't be so bad if I didn't take such long breaks from the project but it does tend to give me headaches trying to figure this stuff out.

You would think I'd be able to find a way to just take the HP number from the character generator I made and plug it into 6 rows with 5 sub rows in each as shown above. Then it would only be a matter of the first row taking 2/3 green and the last 1/3 red. But I'll be damned if I can figure out how to do it in any way that makes sense and doesn't make my eyes go cross.
• Wow, this was surprisingly difficult without logical operators or nested conditionals. Anyway, I think this will do the trick for you:
```table: Start
{hp==1d30}&
{lastThird==floor(hp/3)}&
{firstTwoThirds==hp-lastThird}&
HP:{hp}  one-third:{lastThird}  two-thirds:{firstTwoThirds}\n&
{totRows==ceil(hp/5)}&
{mod==hp-(floor(hp/5)*5)}&
&#91;when&#93;{mod}=0&#91;do&#93;{mod==5}&#91;end&#93;&
{rowNum==0}&
&lt;table&gt;&lt;col width="75"&gt;&lt;col width="75"&gt;&lt;col width="75"&gt;&lt;col width="75"&gt;&lt;col width="75"&gt;&lt;col width="75"&gt;&
&#91;@{totRows} CalcRows&#93;&
&lt;/table&gt;

table: CalcRows
{rowNum==rowNum+1}&
{greenDots==firstTwoThirds-(rowNum-1)*5}&
&#91;when&#93;{greenDots}&gt;5&#91;do&#93;{greenDots==5}&#91;end&#93;&
&#91;when&#93;{greenDots}&lt;0&#91;do&#93;{greenDots==0}&#91;end&#93;&
{redDots=={5-greenDots}}&
&#91;when&#93;{rowNum}={totRows}&#91;do&#93;{redDots==mod-greenDots}&#91;end&#93;&
&#91;when&#93;{redDots+greenDots}=0&#91;do&#93;{redDots==5}&#91;end&#93;&
&lt;tr&gt;&
&lt;td&gt;&#91;@Colorize with {greenDots}-green-{redDots}-red, O&#93;&lt;/td&gt;&
&lt;td&gt;&#91;@Colorize with {greenDots+redDots}-yellow, O&#93; &lt;/td&gt;&
&lt;td&gt;&#91;@Colorize with {greenDots+redDots}-orange, O&#93; &lt;/td&gt;&
&lt;td&gt;&#91;@Colorize with {greenDots+redDots}-orange, O&#93; &lt;/td&gt;&
&lt;td&gt;&#91;@Colorize with {greenDots+redDots}-orange, O&#93; &lt;/td&gt;&
&lt;td&gt;&#91;@Colorize with {greenDots+redDots}-red, O&#93; &lt;/td&gt;&
&lt;/tr&gt;

table: Colorize
set: colors={\$1}
set: stringToColorize={\$2}
{buildstring==''}&
&#91;{colors} &gt;&gt; eachchar subColorize1&#93;&#91;@subColorize2&;#93;

table: subColorize1
&#91;when&#93;{\$1}=-&#91;do&#93;&#91;@subColorize2&;#93;{buildstring==''}&#91;else&#93;{buildstring=='{buildstring}{\$1}'}&#91;end&#93;

table: subColorize2
&#91;when&#93;{lookingForAColor}&
&#91;do&#93;&#91;@RepeatWithColor with {repeatNum}, {buildString}, {stringToColorize}&#93;{lookingForAColor==''}&
&#91;else&#93;&
&#91;when&#93;&#91;@IsNumeric with {buildstring}&#93;&
&#91;do&#93;{repeatNum=='{buildString}'}{lookingForAColor=='yes'}&
&#91;else&#93;{buildString}{lookingForAColor==''}&
&#91;end&#93;&#91;end&#93;
```
• That is so confusing! Wow!

So how do I add this to my table? Here is an example of my code for my Fallout Games. As you can see HP is based off of ST with the option of having bonuses or penalties being added by Class and Difficulty which I select from a dropdown list.
```Table: GiantAnt
Set: Skills =&#91;@{\$Class}Skills&;#93;
Set: ST ={! floor(({1d3+7} + &#91;#1 {\$Class}Bonus&#93;) * (&#91;#1 {\$DifficultyLevel}Bonus&#93;))}
set: DX ={! floor(({1d3+7} + &#91;#2 {\$Class}Bonus&#93;) * (&#91;#2 {\$DifficultyLevel}Bonus&#93;))}
set: IQ ={! floor(({2} + &#91;#3 {\$Class}Bonus&#93;) * (&#91;#3 {\$DifficultyLevel}Bonus&#93;))}
set: HT ={! floor(({1d3+7} + &#91;#4 {\$Class}Bonus&#93;) * (&#91;#4 {\$DifficultyLevel}Bonus&#93;))}
set: HP ={! ({\$ST} + &#91;#5 {\$Class}Bonus&#93;) + (&#91;#5 {\$DifficultyLevel}Bonus&#93;)}
set: Speed ={! ((({\$HT} + {\$DX}) /4) +0.5) + &#91;#6 {\$Class}Bonus&#93;) * (&#91;#6 {\$DifficultyLevel}Bonus&#93;}
set: Will ={! (({\$IQ} +7) + &#91;#7 {\$Class}Bonus&#93;) + (&#91;#7 {\$DifficultyLevel}Bonus&#93;)}
set: Move ={! floor(({\$HT} + {\$DX}) /4) + (&#91;#8 {\$Class}Bonus&#93;) * &#91;#8 {\$DifficultyLevel}Bonus&#93;}
set: Per ={! ({\$IQ} +9) + &#91;#9 {\$Class}Bonus&#93;) + (&#91;#9 {\$DifficultyLevel}Bonus&#93;}
set: FP ={! ({\$HT} +1) + &#91;#10 {\$Class}Bonus&#93;) + (&#91;#10 {\$DifficultyLevel}Bonus&#93;}
set: Dodge = {! floor({\$Speed})+3}
set: Parry = {! floor({\$DX} /2)+3}
set: SM = {({-3} + &#91;#11 {\$Class}Bonus&#93;) + (&#91;#11 {\$DifficultyLevel}Bonus&#93;)}
set: DR = {! floor (({3} + &#91;#12 {\$Class}Bonus&#93;) * (&#91;#12 {\$DifficultyLevel}Bonus&#93;))}

&lt;table border="0"&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;Giant Ant&lt;/b&gt; {\$Class} {\$DifficultyLevel}&lt;/small&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;ST: {\$ST}&lt;/td&gt;&lt;td&gt;HP: {\$HP}&lt;/td&gt;&lt;td&gt;Speed: {\$Speed}&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;DX: {\$DX} &lt;/td&gt;&lt;td&gt;Will: {\$Will}&lt;/td&gt;&lt;td&gt;Move: {\$Move}&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;IQ: {\$IQ}&lt;/td&gt;&lt;td&gt;Per:{\$Per}&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;HT: {\$HT}&lt;/td&gt;&lt;td&gt;FP: {\$FP}&lt;/td&gt;&lt;td&gt;SM:{\$SM}&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Dodge: {\$Dodge}&lt;/td&gt;&lt;td&gt;Parry: {\$Parry}&lt;/td&gt;&lt;td&gt;DR: {\$DR}&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br&gt;&lt;b&gt;Armor:&lt;/b&gt; Natural\n&lt;b&gt;Weapons:&lt;/b&gt; &lt;li&gt;&#91;#3 BrawlingWeapons&#93;&lt;/li&gt;&lt;li&gt;&#91;#8 BrawlingWeapons&#93;&lt;/li&gt;&lt;b&gt;Traits:&lt;/b&gt; Wild Animal; DR {\$DR}; 360º Vision (Vulnerable); Combat Reflexes;Extra Legs (Six Legs); High Pain Threshold; Horizontal; Lifting ST +2;Nictitating Membrane 1; No Fine Manipulators; Slave Mentality;Striking ST +4; Teeth (Sharp);Terrain Adaptation (Sand); Tunneling 1 (Only Through Earth);&#91;!5 {\$Class}Traits &gt;&gt; implode &gt;&gt; sort&#93;  \n&lt;b&gt;Skills:&lt;/b&gt; None
EndTable:
```

Do I just add {\$Start} to my table? Also, if I'm reading this right, you have HP being 1d30 {hp==1d30}& would I be able to substitute that with {hp=={\$HP}}&

I'm still trying to work out all your expressions as this is way above what I can do.
• Huhn, I get a zillion errors when I run that code. Maybe we're working in different versions? Anyway, your intuition is correct; you can just remove the HP roll from my code and call it. I've done that in the example below.
```Table: GiantAnt
Set: Skills =&#91;@{\$Class}Skills&;#93;
Set: ST ={! floor(({1d3+7} + &#91;#1 {\$Class}Bonus&#93;) * (&#91;#1 {\$DifficultyLevel}Bonus&#93;))}
set: DX ={! floor(({1d3+7} + &#91;#2 {\$Class}Bonus&#93;) * (&#91;#2 {\$DifficultyLevel}Bonus&#93;))}
set: IQ ={! floor(({2} + &#91;#3 {\$Class}Bonus&#93;) * (&#91;#3 {\$DifficultyLevel}Bonus&#93;))}
set: HT ={! floor(({1d3+7} + &#91;#4 {\$Class}Bonus&#93;) * (&#91;#4 {\$DifficultyLevel}Bonus&#93;))}
set: HP ={! ({\$ST} + &#91;#5 {\$Class}Bonus&#93;) + (&#91;#5 {\$DifficultyLevel}Bonus&#93;)}
set: Speed ={! ((({\$HT} + {\$DX}) /4) +0.5) + &#91;#6 {\$Class}Bonus&#93;) * (&#91;#6 {\$DifficultyLevel}Bonus&#93;}
set: Will ={! (({\$IQ} +7) + &#91;#7 {\$Class}Bonus&#93;) + (&#91;#7 {\$DifficultyLevel}Bonus&#93;)}
set: Move ={! floor(({\$HT} + {\$DX}) /4) + (&#91;#8 {\$Class}Bonus&#93;) * &#91;#8 {\$DifficultyLevel}Bonus&#93;}
set: Per ={! ({\$IQ} +9) + &#91;#9 {\$Class}Bonus&#93;) + (&#91;#9 {\$DifficultyLevel}Bonus&#93;}
set: FP ={! ({\$HT} +1) + &#91;#10 {\$Class}Bonus&#93;) + (&#91;#10 {\$DifficultyLevel}Bonus&#93;}
set: Dodge = {! floor({\$Speed})+3}
set: Parry = {! floor({\$DX} /2)+3}
set: SM = {({-3} + &#91;#11 {\$Class}Bonus&#93;) + (&#91;#11 {\$DifficultyLevel}Bonus&#93;)}
set: DR = {! floor (({3} + &#91;#12 {\$Class}Bonus&#93;) * (&#91;#12 {\$DifficultyLevel}Bonus&#93;))}

&lt;table border="0"&gt;&
&lt;tr&gt;&lt;td&gt;&lt;b&gt;Giant Ant&lt;/b&gt; {\$Class} {\$DifficultyLevel}&lt;/small&gt;&lt;/td&gt;&lt;/tr&gt;&
&lt;tr&gt;&lt;td&gt;ST: {\$ST}&lt;/td&gt;&lt;td&gt;HP: {\$HP}&lt;/td&gt;&lt;td&gt;Speed: {\$Speed}&lt;/td&gt;&lt;/tr&gt;&
&lt;tr&gt;&lt;td&gt;DX: {\$DX} &lt;/td&gt;&lt;td&gt;Will: {\$Will}&lt;/td&gt;&lt;td&gt;Move: {\$Move}&lt;/td&gt;&lt;/tr&gt;&
&lt;tr&gt;&lt;td&gt;IQ: {\$IQ}&lt;/td&gt;&lt;td&gt;Per:{\$Per}&lt;/td&gt;&lt;/tr&gt;&
&lt;tr&gt;&lt;td&gt;HT: {\$HT}&lt;/td&gt;&lt;td&gt;FP: {\$FP}&lt;/td&gt;&lt;td&gt;SM:{\$SM}&lt;/td&gt;&lt;/tr&gt;&
&lt;tr&gt;&lt;td&gt;Dodge: {\$Dodge}&lt;/td&gt;&lt;td&gt;Parry: {\$Parry}&lt;/td&gt;&lt;td&gt;DR: {\$DR}&lt;/td&gt;&lt;/tr&gt;&
&lt;/table&gt;&
&lt;br&gt;&lt;b&gt;Armor:&lt;/b&gt; Natural\n&
&lt;b&gt;Weapons:&lt;/b&gt; &lt;li&gt;&#91;#3 BrawlingWeapons&#93;&lt;/li&gt;&lt;li&gt;&#91;#8 BrawlingWeapons&#93;&lt;/li&gt;&
&lt;b&gt;Traits:&lt;/b&gt;Wild Animal; DR {\$DR}; 360º Vision (Vulnerable); Combat Reflexes;Extra Legs (Six Legs); High Pain Threshold; Horizontal; Lifting ST +2;Nictitating Membrane 1; No Fine Manipulators; Slave Mentality;Striking ST +4; Teeth (Sharp);Terrain Adaptation (Sand); Tunneling 1 (Only Through Earth);&#91;!5 {\$Class}Traits &gt;&gt; implode &gt;&gt; sort&#93;  \n&
&lt;b&gt;Skills:&lt;/b&gt; None\n\n&
&#91;@HpDots&;#93;
EndTable:

table: HpDots
{lastThird==floor(hp/3)}&
{firstTwoThirds==hp-lastThird}&
{totRows==ceil(hp/5)}&
{mod==hp-(floor(hp/5)*5)}&
&#91;when&#93;{mod}=0&#91;do&#93;{mod==5}&#91;end&#93;&
{rowNum==0}&
&lt;table&gt;&lt;col width="75"&gt;&lt;col width="75"&gt;&lt;col width="75"&gt;&lt;col width="75"&gt;&lt;col width="75"&gt;&lt;col width="75"&gt;&
&#91;@{totRows} CalcRows&#93;&
&lt;/table&gt;

table: CalcRows
{rowNum==rowNum+1}&
{greenDots==firstTwoThirds-(rowNum-1)*5}&
&#91;when&#93;{greenDots}&gt;5&#91;do&#93;{greenDots==5}&#91;end&#93;&
&#91;when&#93;{greenDots}&lt;0&#91;do&#93;{greenDots==0}&#91;end&#93;&
{redDots=={5-greenDots}}&
&#91;when&#93;{rowNum}={totRows}&#91;do&#93;{redDots==mod-greenDots}&#91;end&#93;&
&#91;when&#93;{redDots+greenDots}=0&#91;do&#93;{redDots==5}&#91;end&#93;&
&lt;tr&gt;&
&lt;td&gt;&#91;@Colorize with {greenDots}-green-{redDots}-red, O&#93;&lt;/td&gt;&
&lt;td&gt;&#91;@Colorize with {greenDots+redDots}-yellow, O&#93; &lt;/td&gt;&
&lt;td&gt;&#91;@Colorize with {greenDots+redDots}-orange, O&#93; &lt;/td&gt;&
&lt;td&gt;&#91;@Colorize with {greenDots+redDots}-orange, O&#93; &lt;/td&gt;&
&lt;td&gt;&#91;@Colorize with {greenDots+redDots}-orange, O&#93; &lt;/td&gt;&
&lt;td&gt;&#91;@Colorize with {greenDots+redDots}-red, O&#93; &lt;/td&gt;&
&lt;/tr&gt;

table: Colorize
set: colors={\$1}
set: stringToColorize={\$2}
{buildstring==''}&
&#91;{colors} &gt;&gt; eachchar subColorize1&#93;&#91;@subColorize2&;#93;

table: subColorize1
&#91;when&#93;{\$1}=-&#91;do&#93;&#91;@subColorize2&;#93;{buildstring==''}&#91;else&#93;{buildstring=='{buildstring}{\$1}'}&#91;end&#93;

table: subColorize2
&#91;when&#93;{lookingForAColor}&
&#91;do&#93;&#91;@RepeatWithColor with {repeatNum}, {buildString}, {stringToColorize}&#93;{lookingForAColor==''}&
&#91;else&#93;&
&#91;when&#93;&#91;@IsNumeric with {buildstring}&#93;&
&#91;do&#93;{repeatNum=='{buildString}'}{lookingForAColor=='yes'}&
&#91;else&#93;{buildString}{lookingForAColor==''}&
&#91;end&#93;&#91;end&#93;

table: RepeatWithColor
&#91;when not&#93;{RWCcnt}&#91;do&#93;{RWCcnt==0}&#91;end&#93;&
&#91;when&#93;{RWCcnt}=0&#91;do&#93;{RWCcnt=={\$1}}&lt;font color={\$2}&gt;&#91;else&#93;{RWCcnt=={{RWCcnt}-1}}&#91;end&#93;&
&#91;when&#93;{RWCcnt}&gt;0&#91;do&#93;{\$3}&#91;@RepeatWithColor with {\$1}, {\$2}, {\$3}&#93;&#91;else&#93;&lt;/font&gt;&#91;end&#93;
```
• It might not have been the entire code or the fact that only certain creatures have actually been finished. As I've said it is an on and off again project. I've attached the .ipt If I had added the Humanoid one there would be a huge string of errors/missing data as that one isn't even 1/16th finished!
• OMG! I've just added it in and it looks AMAZING! largando your a damn genius! Thank you so much!!

I'm going to print out your code and deconstruct it while I'm on my 12 hour overnight shift tonight. I need the same thing for the FP but with only two rows FP and 0 FP

This will save me much time in gaming sessions!
• Glad it works for you!

I'll see if I have time to write up a point-by-point deconstruction of the code.
• All right, finally got some time. Maybe you've figured out how everything works by now, but if not, this might help.

The table "HPDots" only has one entry, so it's really more of a function or procedure. It expects the variable {hp} to already be defined. The first thing it does is set up the variables that CalcRows (called later) is going to need:
```{lastThird==floor(hp/3)}&
{firstTwoThirds==hp-lastThird}&
{totRows==ceil(hp/5)}&
{mod==hp-(floor(hp/5)*5)}&
&#91;when&#93;{mod}=0&#91;do&#93;{mod==5}&#91;end&#93;&
```
In retrospect, I didn't really need the variable {lastThird}; it's only used in the following line which calculates the {firstTwoThirds}.

{firstTwoThirds} will tell CalcRows how many green dots to print.
{totRows} is just the total number of dot rows that will be created. It will define how many times CalcRows will be called.
{mod} is just the result of modulo arithmetic, that is, the remainder after doing division. This is intended to be the number of dots in the last row.

A bit of a cheat is required, though, because if I allow {mod} to be zero then a whole row of dots will be skipped. So in that case I set {mod} to the value of the divisor (5), normally an impossible outcome of a modulo expression.

CalcRows will be producing rows for an HTML-table, so this part:
```{rowNum==0}&
&lt;table&gt;&lt;col width="75"&gt;&lt;col width="75"&gt;&lt;col width="75"&gt;&lt;col width="75"&gt;&lt;col width="75"&gt;&lt;col width="75"&gt;&
&#91;@{totRows} CalcRows&#93;&
&lt;/table&gt;
```
a) sets {rowNumber} which CalcRows will increment, to zero.
b) defines the beginning and end of the HTML table
c) calls CalcRows {totRows} times.

Now, on to the CalcRows table. Its purpose is to determine how many green and read dots to produce, and then write them into a row of the HTML table.

First increment {rowNumber}. Then figure out how many {greenDots} we need for the row:
```table: CalcRows
{rowNum==rowNum+1}&
{greenDots==firstTwoThirds-(rowNum-1)*5}&
```
{greenDots} at this point is the total number of green dots we want to print -- {firstTwoThirds} -- minus the number of dots we've already printed.
It only makes sense for {greenDots} on a given row to be 0, 5, or somewhere in between, so:
```&#91;when&#93;{greenDots}&gt;5&#91;do&#93;{greenDots==5}&#91;end&#93;&
&#91;when&#93;{greenDots}&lt;0&#91;do&#93;{greenDots==0}&#91;end&#93;&
```
...and {redDots} for this row will be five minus {greenDots}:
```{redDots=={5-greenDots}}&
```
Of course, it's no guarantee that we'll want the red dots to continue to the end of the line. That can be controlled for with:
```&#91;when&#93;{rowNum}={totRows}&#91;do&#93;{redDots==mod-greenDots}&#91;end&#93;&
```
...which basically says, "when we're on the last row -- {rowNum}={totRows} -- set the number of red dots as needed, to: {mod} (the total number of dots on the last line) minus {greenDots} (which will typically be zero, but for small {hp} could be nonzero).

This line is pretty hacky and I don't like it, but it was required for a couple of circumstances that I don't remember:
```&#91;when&#93;{redDots+greenDots}=0&#91;do&#93;{redDots==5}&#91;end&#93;&
```

Finally, we write out the row of dots in a HTML table row:
```&lt;tr&gt;&
&lt;td&gt;&#91;@Colorize with {greenDots}-green-{redDots}-red, O&#93;&lt;/td&gt;&
&lt;td&gt;&#91;@Colorize with {greenDots+redDots}-yellow, O&#93; &lt;/td&gt;&
&lt;td&gt;&#91;@Colorize with {greenDots+redDots}-orange, O&#93; &lt;/td&gt;&
&lt;td&gt;&#91;@Colorize with {greenDots+redDots}-orange, O&#93; &lt;/td&gt;&
&lt;td&gt;&#91;@Colorize with {greenDots+redDots}-orange, O&#93; &lt;/td&gt;&
&lt;td&gt;&#91;@Colorize with {greenDots+redDots}-red, O&#93; &lt;/td&gt;&
&lt;/tr&gt;
```
Next up, how Colorize works.
• I'll be able to look through this starting on Monday. I've been working a ton of overtime this month and barley have time to think. Thanks for posting! I look forward to understanding it