#### Howdy, Stranger!

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

# Variable - Inline Variable Assignment Help

Hi all, I'm trying to get back into IPP after about 7 years or so away from it (and gaming). I'm trying to assign a variable as part of a table.

I've built a simple test generator to see what my output is because I'm not a coder, struggled in Computer Science, and have very limited exposure to draw examples from.

The basic rule I'm trying to emulate is - if a character is untrained in hand to hand combat, they parry based off of their Dex attribute and some math. If they have training, their skill does some math and determines their Parry level.

The math is simple = divide the source by 2, round down fractions, add three to the result.

DX 10 = 10/2 = 5 + 3 = 8
Brawl 15 = 15/2 = 7.5 -> 7 + 3 = 10

There are six total skills that a character can be trained in (for trial table purposes, I just used one). At this point, I don't care if the generator picks multiple hand to hand skills, I'm okay with inelegant code as long as it works. I just want to understand what I'm doing wrong about passing the variable and then using it outside of the table. If I even can with IPP. Then when I have something that works, I'll try to improve the elegance of the code in later versions.

Here is my test code:

``````maxreps: 1
set: DX = {10 + {1d6}}
set: IQ = {10 + {1d6}}

set: brawlingskill = {{1d10} + {\$DX}}
set: boxingskill = {{1d12-2} + {\$DX}}
set: karateskill = {{1d13-3} + {\$DX}}
set: judoskill = {{1d13-3} + {\$DX}}
set: sumoskill = {{1d12-2} + {\$DX}}
set: wrestlingskill = {{1d12-2} + {\$DX}}
set: brawlingparry = {! floor( ({\$brawlingskill} / 2) + 3)}
set: boxingparry = {! floor( ({\$boxingskill} / 2) + 3)}
set: karateparry = {! floor( ({\$karateskill} / 2) + 3)}
set: judoparry = {! floor( ({\$judoskill} / 2) + 3)}
set: sumoparry = {! floor( ({\$sumoskill} / 2) + 3)}
set: wrestlingparry = {! floor( ({\$wrestlingskill} / 2) + 3)}

set: PAR1 = {!floor( ({DX} / 2) + 3)}
set: PAR2 = {!floor( ({DX} / 2) + 3)}
set: PARRY = [when]{PAR1}>{PAR2}[do]{PAR1}[else]{PAR2}[end]

set: HTH = {1d25}

table: NPCcreation
<HR>[@stats]<BR>

EndTable:

table: stats

<BR>DX: {DX}<BR>IQ: {\$IQ}<BR>Par1: {\$PAR1}<BR>Par2: {\$PAR2}<BR>Parry: {\$PARRY}[when]{\$DEF}<6[do],[else].[end]<BR>Test Roll:<BR></b> [!{!2d1} skills >> sort >> implode]<BR><BR>

EndTable:

Table: skills

Skill1-{!{1d10+0} + {\$IQ}}
Skill2-{!{1d10+0} + {\$IQ}}
100:Brawling-{brawlingskill}{{PAR2}=={!floor( ({brawlingskill} / 2) + 3)}}

EndTable:
``````
«1

`{{PAR2}=={!floor( ({brawlingskill} / 2) + 3)}}`

You shouldn't have curly brackets around PAR2 there. IPP thinks you are making a comparison, it's reading this as a question "is PAR2 equal to this value I'm calculating?" and returning true or false. For an assignment, it would be

``````{PAR2=={!floor( ({brawlingskill} / 2) + 3)}}
``````

Currently, that value won't show up for PAR2 because it's being assigned that new value after it has already been used, but if you check the value again after the assignment it will be there.

Other stuff... the "DX:" is not showing up at the beginning because IPP sees a short entry with a colon and thinks it is a key, not text to show. Easiest fix for that is to add 1: at the beginning of the line (in that case it will see the line as weighted x1 which is fine).

The When statement is not working because you are checking {\$DEF} but you never assigned a value to DEF.

Also, it doesn't seem to be causing any issues here, but avoid blank lines in your tables. IPP may look at that table and pick a blank line instead of a line with content. Using the "EndTable:" keyword may be making you think there is some formal structure here, but really it's just whatever comes after Table until the next table shows up. "EndTable:" is unnecessary and doesn't add anything if the next line after it will be another table. So just:

``````Table: NPCcreation
<HR>[@stats]<BR>

Table: stats
1:<BR>DX: {DX}<BR>IQ: {\$IQ}<BR>Par1: {\$PAR1}<BR>Par2: {\$PAR2}<BR>Parry: {\$PARRY}[when]{\$DEF}<6[do],[else].[end]<BR>Test Roll:<BR></b> [!{!2d1} skills >> sort >> implode]<BR><BR>   PAR2 afterwards = {PAR2}

Table: skills
Skill1-{!{1d10+0} + {\$IQ}}
Skill2-{!{1d10+0} + {\$IQ}}
100:Brawling-{brawlingskill}{PAR2=={!floor( ({brawlingskill} / 2) + 3)}}
``````
• Sorry for the delay, I didn't have notifications on and missed your reply. I see the PAR2 assignment working now, thank you so much. I was ready to throw my machine against a wall.

To begin with, yes. Buckle up, I have a lot of questions if you're willing to answer.

So what I want, is for the NPC's maximum Parry score to be reflected in the stats table as a quick reference and to follow the published format for NPCs. Nothing really matters other than my preference for the layout and my stubbornness to figure out how to make it work.

I had a convoluted mess of when/else statements that didn't work so I deleted. I tried a random roll lookup. I gave up and deleted. My problem comes from tying a Parry score to a skill if it isn't picked thus defaulting to the DX attribute. In the real generator, I have it picking a random 4d8 skills (currently using an inelegant workaround). So conceivably, all six combat skills could be picked. So in that case, it would go to the last Parry variable assignment regardless of value, right? And there is no way to do a text search in table roll results? I saw the string and substring searches but unless I'm misreading or just being overly obtuse, I don't see a way to manipulate them to return the information I want.

Currently, that value won't show up for PAR2 because it's being assigned that new value after it has already been used, but if you check the value again after the assignment it will be there.

So there is no way for me to pull it up earlier in the generator? Tables and variable assignments will only run sequentially - top to bottom, left to right?

If I'm correct in my previous assumptions, can't I just rearrange the layout of my tables and put the NPCCreation table first, skills table second, and the stats table last? Would the Parry variables make an assignment even if the skill wasn't selected out of the skill table? The line won't run if it isn't selected, correct? So if I had PAR2, PAR3, ... PAR7 for the six combat skills with a comparison of those inline variables with PAR1 before the stats table, it would compare no value assignment as a zero vs any skills that were picked, assign the max value to MAXPARRY or something, correct? In simpler terms, if I did the previous and used your PAR2 Afterwards code from your reply for each, I would have a collection of numbers for anything that ran and no assignment for things that didn't run - a blank that the program would evaluate as a zero? Then I could evaluate up to the maximum parry score? I hope all of that makes sense.

My coding housekeeping skills aren't very technically accurate or even good - even in classes where it was graded I was always lazy on that. It bites me every time I try to do something but I never change it. {DEF} was a deleted out method I was using in an earlier iteration. I'll learn one day. Maybe.

• I think you were on the right track having a Parry variable and then, each time you calculate the parry for a particular skill, replace that Parry with the new value if it's higher. Personally I would do that as {Parry==max({Par1},{Par2})} rather than doing a When statement. It's more compact. After generating all the skills, you would then have your maximum parry in the Parry variable.

More specifically:

`Brawling-{brawlingskill}{PAR2=={!floor( ({brawlingskill} / 2) + 3)}}{PARRY==max({PARRY},{PAR2})}`

You do need to calculate values before you display them. All the logic within a specific table entry is applied left to right, top to bottom, following references as they appear. Things in subtables will be evaluated when they are called. It doesn't matter order your put the tables in (except that execution starts with the first one), what matters is when you reference them.

If that means you need to calculate things in a different order than you ultimately want them displayed, put things in variables to display them when you get to that part.

• I haven't seen the max function in the help file at all. Is there another list of commands somewhere that I'm missing? Is it limited to two comparisons or can I use it like Excel and have many variables being evaluated simultaneously?

I'm still confused about how to get the new PARRY variable to display before the table, then. Just like your first example with the PAR2 Afterwards displaying but not before. My first iteration had all of the parries being calculated as a variable with the set: function. The issue is that they're all calculating but I don't know how to count them if the skills output contains them and exclude the ones that aren't picked by the subtable. If the NPC doesn't know karate, I don't want a parry considered for the max parry for the character. Or is that just a limitation I'll have to live with?

• In the help, look under Generator Files and then Expressions and then Built In Functions. Here's the list of math functions which answers your question about that:

max(n1, n2,...,nN) - the maximum value of any number of passed values.
min(n1, n2,...,nN) - the minimum value of any number of passed values.
sqrt(n) - the square root of n
abs(n) - absolute value of n
round(n) - n rounded to the nearest whole number
floor(n) - n rounded down to the nearest whole number
ceil(n) - n rounded up to the nearest whole number
sign(n) - the sign of n, returns -1 if negative, 1 if positive

With regard to knowing which skills to look at, one possible answer is if you compare them all, presumably the ones with zero skill will not be the max value....

But you said you are picking some number of skills that the character has. You could calculate the values at that time. E.g.

``````set: DX = {10 + {1d6}}
set: IQ = {10 + {1d6}}
set: Parry=0

Table: AllTheSkills
[!{4d8} Skills]Parry = {\$Parry}

Table: Skills
Brawling {brawlingskill={{1d10} + {\$DX}}} [Parry=={Max({\$Parry},{!floor(({\$brawlingskill}/2)+3)})}]   <br>
Karate {karateskill={{1d13-3} + {\$DX}}}   [Parry=={Max({\$Parry},{!floor(({\$karateskill}/2)+3)})}]     <br>
Cooking<br>
Running<br>
``````

I don't know what format you're going for, but this displays and generates skills with values, and also silently calculates parry only for the skills that are selected. (I tossed some non-combat skills in there just to make the point that different skills might calculate different things.)

If you need to display the parry first, you can save the skill list for later:

``````set: DX = {10 + {1d6}}
set: IQ = {10 + {1d6}}
set: Parry=0

Table: AllTheSkills
[!{1d4} Skills]Parry = {Parry}<br>{Skills}

Table: Skills
[Skills=={\$Skills}Brawling [brawlingskill=={{1d10} + {\$DX}}][Parry=={Max({\$Parry},{!floor(({\$brawlingskill}/2)+3)})}]<br>]
[Skills=={\$Skills}Karate [karateskill={{1d13-3} + {\$DX}}][Parry=={Max({\$Parry},{!floor(({\$karateskill}/2)+3)})}]<br>]
[Skills=={\$Skills}Test [testskill=2][Parry=={Max({\$Parry},2)}]<br>]
[Skills=={\$Skills}Cooking<br>]
[Skills=={\$Skills}Running<br>]
``````

I tested both of those to make sure I had all the parentheses and brackets correct....

• Just barely skimmed this thread, but had a though that might help. In english, not code syntax: why not set variable Parry = 'non-skilled Dex-based formula' at the start, and then in the table, overwrite that Parry value if a skill that improves Parry is picked.

From a quick skim, I think I'm saying the same thing that jdale has already suggested with their code directly above this comment, only adding the following: don't initialize Parry as = 0, instead initialize Parry as whatever it would be based on Dex.

• Yes, that's a good suggestion, I lost track of that part of the rules you are trying to implement.

• Thanks, jdale, I'm not sure how I missed those math formulas.

That said, I think the step I've been missing is the set: Parry=0 (or DX-formula) at the beginning that both of you guys are showing/talking about. That sets my variable before anything is run and just adjusts it after so that I don't have to worry about table arrangement, right? I told you, I'm not good at programming - I don't see the obvious a lot of times.

• Nope, I'm wrong. Or doing something wrong. It isn't incrementing until the table is run.

Here is my output ->

My goal is to get the "Parry before test roll" to show the incrementation after the test roll and be physically placed outside of the table results.

Here is what I want the final format to look like minus my underlined workaround ->

I'm not sure if what I'm wanting is outside the capabilities of Inspiration Pad.

• I think what I'm needing is to be able to pass the table roll results into a variable that doesn't display when first run so it increments the parry variable, then several lines/rows/minutes later I can call the table roll results stored in that variable. Is that possible with variables?

• Yes, that's possible. Please see my last example in the post above. I did exactly that, putting the list of skills into a variable called Skills.

Also, I'm not sure why I didn't notice earlier that this is GURPS.

The point of assigning an initial value to Parry is, like you said, to ensure it starts off with a valid numeric value so a comparison can happen. Otherwise IPP is trying to compare a number to a null value (not zero, but a thing that is neither a number nor a word), and it doesn't know what to do. You still need to actually do the comparisons etc but this makes it possible.

• Again, to you and Levendor, I truly appreciate all the time and help.

If you look at my first screenshot, it isn't pulling it out of the table call, though. I'm not sure what I'm doing wrong.

Here are my changes to your test code ->

``````maxreps: 1
set: DX = {10 + {1d6}}
set: IQ = {10 + {1d6}}
set: Parry={!floor( ({DX} / 2) + 3)}

set: PAR1 = {!floor( ({DX} / 2) + 3)}

table: NPCcreation
<HR>[@stats]<BR>

EndTable:

Table: NPCcreation
<HR>[@stats]<BR>

Table: stats
1:[Tableroll=={[@AllTheSkills]}]<BR>DX: {DX}<BR>IQ: {\$IQ}<BR>Par1 to show the DX-based math: {\$PAR1}<BR><BR>Parry before test roll: {\$PARRY}<BR>Test Roll:<BR></b> {Tableroll}<BR><BR><BR><BR>  Parry after test roll: {Parry}

Table: AllTheSkills
[!{1d4} Skills] Parry={Parry}<br>{Skills}

Table: Skills
[Skills=={\$Skills}Brawling [brawlingskill={{1d10} + {\$DX}}][Parry=={Max({\$Parry},{!floor(({\$brawlingskill}/2)+3)})}]<br>]
[Skills=={\$Skills}Karate [karateskill={{1d13-3} + {\$DX}}][Parry=={Max({\$Parry},{!floor(({\$karateskill}/2)+3)})}]<br>]
[Skills=={\$Skills}Test [testskill=2][Parry=={Max({\$Parry},2)}]<br>]
[Skills=={\$Skills}Cooking<br>]
[Skills=={\$Skills}Running<br>]
``````

And here is the output that I'm getting ->

I've tried several variations but I can't get the parry score to extract prior to the table roll or the table roll output to be stored as a variable.

• Clarification, table roll stored as a variable to where I can display it where I want it to be.

• edited September 2020

I caught one of my errors.

I was using `Test Roll:<BR></b> {Tableroll}` which needed to be `Test Roll:<BR></b> {Skills}`.

That fixes that part. Now I just need to make the first table run not display, I think.

• It's pretty much there, just a bit of gunk in the works. Here some good code:

``````; Test-Parry.ipt
; created 9/1/2020 1:53:17 PM
maxreps: 1
set: DX = {10 + {1d6}}
set: IQ = {10 + {1d6}}
set: Parry={!floor( ({DX} / 2) + 3)}
set: PAR1={!floor( ({DX} / 2) + 3)}

table: NPCcreation
<HR>[@stats]<BR>

EndTable:

Table: NPCcreation
<HR>[@stats]<BR>

Table: stats
1:<BR>DX: {DX}<BR>IQ: {\$IQ}<BR>Par1 to show the DX-based math: {\$PAR1}<BR><BR>Parry before test roll: {\$PARRY}<BR>Test Roll:<BR></b>[@AllTheSkills]<BR><BR><BR><BR>  Parry after test roll: {Parry}

Table: AllTheSkills
[!{1d4} Skills] Parry={Parry}<br>{Skills}

Table: Skills
[Skills=={\$Skills}Brawling [brawlingskill={{1d10} + {\$DX}}][Parry=={Max({\$Parry},{!floor(({\$brawlingskill}/2)+3)})}]<br>]
[Skills=={\$Skills}Karate [karateskill={{1d13-3} + {\$DX}}][Parry=={Max({\$Parry},{!floor(({\$karateskill}/2)+3)})}]<br>]
[Skills=={\$Skills}Test [testskill=2][Parry=={Max({\$Parry},{\$Testskill})}]<br>]
[Skills=={\$Skills}Cooking<br>]
[Skills=={\$Skills}Running<br>]
``````

Now then, what did I change. Well, I didn't track it too carefully. But a couple key ingredients...

1. Not sure why you even have the [Tableroll=={[@AllTheSkills]}] leading off the execution of Table: stats. Firstly - and causing most of the trouble - this actually rolls table AllTheSkills immediately, likely overwriting \$Parry before you have a chance to output the original value of \$Parry later in this code line (the 'Parry before test roll' bit.). And, I didn't see the purpose of making a variable called tableroll, then assigning it the value of [@AllTheSkills] table output. Just call [@AllTheSkills] when you want the table to run. It might have worked if \$Tableroll gets set to the string 'AllTheSkills' (no @ sign) then you call a table later the line using something like [@{\$TableRoll}]. So that's worth a try if there is a bigger picture reason for doing that [Tableroll=={[@AllTheSkills]}] bit.

Then everything seems to work. I think I remove a few spaces in the initial set statements and maybe a blank line or two. I'm just superstitious about spaces.

Overall, a nice efficient bit of code (thumbs up to jdale). Just a tweak to the output.

• Here's a good run of output to show the max statements working proper:

DX: 11
IQ: 11
Par1 to show the DX-based math: 8

Parry before test roll: 8
Test Roll:
Parry=12
Running
Brawling 18
Karate 14
Test 2

Parry after test roll: 12

So here, brawling seems to get picked 2nd and generates a proper Parry = 9 + 3 = 12.
Then, Karate gets picked 3rd, and does NOT change Parry to a 10, because 12 is greater than 10. So, looking good so far.

• That takes me back to where I was at, though, doesn't it?

How do I get the Parry before the Test Roll to show the same 11 after the test roll at the bottom of the screenshot?

The functionality of incrementing, I'm understanding. Getting it to where I can display the updated Parry variable anywhere in the generator is where I'm lost now.

• edited September 2020

Shouldn't Parry after test roll be 11? The test roll changed it to 11, and that's the new and current value. If you want to display Original Value of Parry at a point after the test roll is made, the just change the very end of Table:stats code line

from Parry after test roll: {Parry}

to Parry after test roll: {Par1}

That would return a 9 for the last line of your sample output instead of an 11 (still not certain why you would want to see that as an output). The variable Par1 holds the original set value based on Dex alone, and never updates.

Otherwise, I'm understanding the function of the generator.

• No, no. I think I'm getting you confused with my poor explanation. Maybe I can break it out better...

The snippet of code that I keep showing is just my test generator so I can see and hopefully understand what the changes I'm making are doing. The real NPC generator is much different. In it, I'm following the publisher's convention for writeup formatting shown in my 10:54 post forum.nbos.com/discussion/comment/4342/#Comment_4342. As such, Parry is a characteristic shown before Skills. There is nothing forcing me to do this other than I want to stick with an appearance style and if I/you/we can make it work, I want to learn how. So the test generator I'm trying to make it do similar but on a reduced scale.

To assist my understanding PAR1 shows me what the DX math is at a glance. Just so I don't have to do it in my head. As I stated in another post, I'm horrible at notation of code for other users (and myself when I walk away for a period).

Parry before test roll shows me if the PARRY variable is changing from PAR1. The only time I've been able to change it is when I put the table roll before the whole generator ran.

The test roll of the table runs and displays PARRY in jdale's and your code that you both gave me. I just haven't changed it from the code given because I don't want to mess with any more than I have to until I understand the gears that are turning. It is also confirmation that when skills are selected randomly, it is truly changing because I have PAR1 and Before test roll showing me their values.

Parry after test roll is just showing me confirmation that PARRY is changing from before the table runs to after and that I can use that variable outside of the table call anywhere else down the line I choose to. It should be exactly the same as the PARRY in jdale's table it's just coded outside of everything else.

Does that make it clearer? Or do I need to explain better? I'm just trying to break down every step so I can see what's going on. I would never use this in a real generator, I just want to see the levers move.

• I would never use this in a real generator, I just want to see the levers move.

The test generator, I mean.

• I think I have it doing what I wanted!

I took the [!{1d4} Skills] that you put in the AlltheSkills subtable, jdale, and moved it to the first run in the stats subtable.

This seems to be giving me correct results over a couple dozen iterations.

``````; Test-Parry.ipt
; created 9/1/2020 1:53:17 PM
maxreps: 1
set: DX = {10 + {1d6}}
set: IQ = {10 + {1d6}}
set: Parry={!floor( ({DX} / 2) + 3)}
set: PAR1={!floor( ({DX} / 2) + 3)}

table: NPCcreation
<HR>[@stats]<BR>

EndTable:

Table: NPCcreation
<HR>[@stats]<BR>

Table: stats
1:[!{1d4} Skills]<BR>DX: {DX}<BR>IQ: {\$IQ}<BR>Par1 to show the DX-based math: {\$PAR1}<BR><BR>Parry before test roll: {\$PARRY}<BR>Test Roll:<BR></b>[@AllTheSkills]<BR><BR><BR><BR>  Parry after test roll: {Parry}

Table: AllTheSkills
Parry={Parry}<br>{Skills}

Table: Skills
[Skills=={\$Skills}Brawling [brawlingskill={{1d10} + {\$DX}}][Parry=={Max({\$Parry},{!floor(({\$brawlingskill}/2)+3)})}]<br>]
[Skills=={\$Skills}Karate [karateskill={{1d13-3} + {\$DX}}][Parry=={Max({\$Parry},{!floor(({\$karateskill}/2)+3)})}]<br>]
[Skills=={\$Skills}Test [testskill=2][Parry=={Max({\$Parry},{\$Testskill})}]<br>]
[Skills=={\$Skills}Cooking<br>]
[Skills=={\$Skills}Running<br>]
``````
• Alright, I've ran several iterations now and I'm pretty confident that it is working the way I want it to.

My last ask -- now that I'm doing it jdale's way and passing the table calls to the {skills} variable, is there any way to alphabetize that? I've tried the sort filter and it doesn't seem to work either with the table call initially or any other step. It doesn't seem to work on a variable alone either.

• In the code as we have it, you can't use >> Sort because table Skills doesn't actually return anything to sort. It just silently puts some things in variables. To sort, it would need to return some actual text.

So, instead of adding the skills to the Skills variable one at a time, we need to sort it first, and then we can put that sorted list into the Skills variable.

Starting with the code as you have it, it looks like this:

``````; Test-Parry.ipt
; created 9/1/2020 1:53:17 PM
maxreps: 1
set: DX = {10 + {1d6}}
set: IQ = {10 + {1d6}}
set: Parry={!floor( ({DX} / 2) + 3)}
set: PAR1={!floor( ({DX} / 2) + 3)}

table: NPCcreation
<HR>[@stats]<BR>

EndTable:

Table: NPCcreation
<HR>[@stats]<BR>

Table: stats
1:[Skills==[!{1d4} Skills >> Sort]]<BR>DX: {DX}<BR>IQ: {\$IQ}<BR>Par1 to show the DX-based math: {\$PAR1}<BR><BR>Parry before test roll: {\$PARRY}<BR>Test Roll:<BR></b>[@AllTheSkills]<BR><BR><BR><BR>  Parry after test roll: {Parry}

Table: AllTheSkills
Parry={Parry}<br>{Skills}

Table: Skills
Brawling [brawlingskill={{1d10} + {\$DX}}][Parry=={Max({\$Parry},{!floor(({\$brawlingskill}/2)+3)})}]<br>
Karate [karateskill={{1d13-3} + {\$DX}}][Parry=={Max({\$Parry},{!floor(({\$karateskill}/2)+3)})}]<br>
Test [testskill=2][Parry=={Max({\$Parry},{\$Testskill})}]<br>
Cooking<br>
Running<br>
``````

Now that I did that, I think it's nicer looking code this way anyway. I should use Sort more often.

• That's beautiful! jdale and Levendor, thank you both sooooo much.

Here is my "complete" GURPS generic mundane NPC generator! It isn't complete in the sense that some of the subtables for skills Like Biology (speciesspecialize) have been filled in yet. I took the Modern Adult NPC on the website and used it as my base as I was learning how to use the program. I want to give my kudos to that contributor, Eric Slankard for creating a tool easy enough to learn off of but thanks to all the help you guys provided. Functionally, everything is complete now, I think. I think the next step is to start trying to do a magic user generator and/or a psychic character generator.

I have 9 external .ipt files being used that have been condensed into this through the export process. Be warned that there are a LOT of lines in this generator now. And as we've seen, I don't build things the cleanest way.

If you're inclined and have time, I'd love any feedback/advice on how to make it cleaner in the future.

• Thanks for sharing! I think that's 4th edition? Doesn't look bad on first glance to me.

It's pretty long but that's the nature of those lists. My NPC generator for the upcoming edition of Rolemaster is 75% as big but doesn't include names. ( http://www.ironcrown.com/ICEforums/index.php?topic=18789.0 if anyone is interested.)

The example generators are great to learn from, I would not have gotten anywhere without them either.

• edited September 2020

Glad this all worked out. I'm excited to see the GRUPS generator (haven't used the system, but have been interested). And very excited that jdale is doing Rolemaster - I have all the books and have been very much getting into that system lately.

Actually been trying to develop my own system as a combination of several, but heavily on an Primary Attribute Stats/Skill Ranks/and Health plus Fatigue/Stamina points system. Oh, and a total rework to arcane casting, top to bottom, with Mana and Fatigue cost for each casting instead of spell slots (oh how I hate spell slots).

And lastly, sure wish there was a Like button or such on here, so we could acknowledge a helpful or interesting post without hijacking the thread with an un-useful comment.

• edited December 2020

I'm resurrecting this thread because I'd like to know if it can be tied into the external table calls from this thread: https://forum.nbos.com/discussion/1953/conditionally-weighted-table-pick-possible#latest without having to combine all of the skills in one massive table (internal or external)?

I've been trying all weekend and I've got the various calls outside the NPC generator working, but when the skills with specializations get brought into the NPC generator, they lose the alphabetization sort filter. The individual calls remain alphabetized, but I may have choices of Animal Handling (some skill) being listed before something like Acrobatics in the output file.

Do you guys know if that can be fixed somehow? I'm having no luck.

• I guess I'd have to see what the code looks like.

• edited December 2020

Here is the parent generator. I started with the Modern NPC generator on the NBOS Exchange and adapted it to GURPS.

You and Levendor helped get the parry stat working above and got the skill call to sort and implode. I've truncated most of the skills just because there are sooooo many of them.

``````MaxReps: 1
Use: nbos\GURPS\AttributeMods.ipt
Use: nbos\GURPS\SecondaryMods.ipt
Use: nbos\GURPS\Ranged Weapons.ipt
Use: nbos\GURPS\Melee Weapons.ipt
Use: nbos\GURPS\Checkpoints.ipt
Use: nbos\GURPS\Nations.ipt
Use: nbos\GURPS\Perks-Quirks.ipt
Use: nbos\Modern Languages.ipt
Use: nbos\GURPS Master Skill List - Copy.ipt
Use: nbos\Animal Types.ipt

Prompt: Tech Level {0|1|2|3|4|5|6|7|8|9|10|11|12} 6
Prompt: Game {Fantasy|Morrow Project|Normal|Outlanders|Rifts|Star Trek|Star Wars|Stargate} Normal

Define: native = [when] {\$RACE} = American [do]English[else]\z[end][when] {\$RACE} = Japanese [do]Japanese[else]\z[end][when] {\$RACE} = Spanish [do]Spanish[else]\z[end][when] {\$RACE} = French [do]French[else]\z[end][when] {\$RACE} = Asian [do][|Japanese|Chinese|Korean][else]\z[end]

set: ST = {10 + [@attributemods]}
set: DX = {10 + [@attributemods]}
set: IQ = {10 + [@attributemods]}
set: HT = {10 + [@attributemods]}

set: HP = {[@secondarymods] + {\$ST}}
set: WILL = {[@secondarymods] + {\$IQ}}
set: PER = {[@secondarymods] + {\$IQ}}
set: FP = {[@secondarymods] + {\$HT}}

set: BS = {!(({\$HT} + {\$DX}) + {1d17-9}) / 4 }
set: BM = {! floor ({\$BS})}
set: BL = [#{!{\$ST} - 6} basiclift]
set: TL = {\$prompt2}
set: DOD = {!floor ({\$BS} + 3)}

set: SWING = [#{!{\$ST}} swing]
set: THRUST = [#{!{\$ST}} thrust]

set: brawlingskill = {{1d9-1} + {\$DX}}
set: boxingskill = {{1d9-1} + {\$DX-1}}
set: karateskill = {{1d9-1} + {\$DX-2}}
set: judoskill = {{1d9-1} + {\$DX-2}}
set: sumoskill = {{1d9-1} + {\$DX-1}}
set: wrestlingskill = {{1d9-1} + {\$DX-1}}
set: Parry = {!floor( ({\$DX} / 2) + 3)}
set: DEF = 0

set: cloak = {!{\$DX-1} + {!1d9-1}}
set: shield = {!{\$DX} + {1d9-1}}
set: buckler = {!{\$DX} + {1d9-1}}
set: fshield = {!{\$DX} + {1d9-1}}

set: WEALTH = [@{!{\$prompt2} + 1} tlwealth]
set: contacts = {1d4-1}

set: INIT = {!((({\$BS} * 4)-{\$DX})-{\$HT})+{3d6}}
set: MALEHEIGHT = [@manheight]

table: NPCcreation
<HR><font face = "Times New Roman" size = "3"><B>[@AllNames]</B>[@stats]<I><B>Skills:</B></I> [@alltheskills] <BR><BR><I><B>Weapon(s):</B></I><BR>[|[!{1d3-1} rangedweapons >> sort][!{1d3-1} meleeweapons >> sort]|[!{1d3-1} rangedweapons >> sort]|[!{1d3-1} meleeweapons >> sort]]<BR><I><B>NPC Items Carried:</B></I>[@items]<BR><I><B>NPC Notes:</B></I><BR>[@notes2]<BR></font>

EndTable:

table: stats
1:[TL=={\$prompt2}][Skills==[!{8d4} skills >> sort >> implode]]<BR><b>Nationality:</b> {\$RACE}<BR><b>Gender:</b> {\$GENDER}<BR><BR><b>ST:</b> {\$ST}, <b>DX:</b> {\$DX}, <b>IQ:</b> {\$IQ},<b>HT:</b> {\$HT}.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Will: {\$WILL}, Per: {\$PER}, Basic Speed: {\$BS}, Move: {\$BM}.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dodge: {\$DOD}, Parry: {\$PARRY}[when]{\$DEF}<>0[do],[else].[end] [when] {\$DEF}<>0[do]Block: {\$DEF}.[end]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TL: {\$prompt2}, SM: [when]{\$GENDER}=Male[do][#{MALEHEIGHT} malesizemod][else][#{FEMALEHEIGHT} femalesizemod][end].&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dmg: sw {!SWING}/thr {!THRUST}.<br><I><B>Initiative:</B></I> {\$INIT}.<BR><I><b>HP:</B></I> {\$HP} - <B>[#{\$HP} checkpoints]</B><BR><i><B>FP:</I></B> {\$FP} - <B>[#{\$FP} checkpoints]</B><BR><I><B>Advantages:</B></I> [@adstable]<BR><I><B>Disadvantages:</B></I> [@disadstable]<BR><I><B>Perks:</B></I> [@perkstable]<BR><I><B>Quirks:</B></I> [@quirkstable]<BR>

EndTable:

[when]{\$prompt1} = Mundane [do] [!{1d9-1} mundaneads >> sort >> implode][end] [when]{\$prompt1} = Exotic [do] [!{1d9-1} exoticads >> sort >> implode][end] [when]{\$prompt1} = Supernatural [do] [!{1d9-1} supernaturalads >> sort >> implode][end]

endtable:

[when]{\$prompt1} = Mundane [do] [!{1d9-1} mundanedisads >> sort >> implode][end] [when]{\$prompt1} = Exotic [do] [!{1d9-1} exoticdisads >> sort >> implode][end] [when]{\$prompt1} = Supernatural [do] [!{1d9-1} supernaturaldisads >> sort >> implode][end]

endtable:

table: perkstable
[when]{\$prompt1} = Mundane [do] [!{1d6-1} mundaneperks >> sort >> implode][end] [when]{\$prompt1} = Exotic [do] [!{1d6-1} exoticperks >> sort >> implode][end] [when]{\$prompt1} = Supernatural [do] [!{1d6-1} supernaturalperks >> sort >> implode][end]

endtable:

table: quirkstable
[when]{\$prompt1} = Mundane [do] [!{1d6-1} mundanequirks>> sort >> implode][end] [when]{\$prompt1} = Exotic [do] [!{1d6-1} exoticquirks >> sort >> implode][end] [when]{\$prompt1} = Supernatural [do] [!{1d6-1} supernaturalquirks >> sort >> implode][end]

endtable:

table: alltheskills
{skills}

Table: skills
Accounting-{!{1d9-1} + {\$IQ-2}}
Acrobatics-{!{1d9-1} + {\$DX-2}}
Acting (Impersonation)-{!{1d9-1} + {\$IQ-1}}
Acting-{!{1d9-1} + {\$IQ-1}}
Airshipman-{!{1d9-1} + {\$IQ}}
[@animalhandling]
Anthropology-{!{1d9-1} + {\$IQ-2}}
Aquabatics-{!{1d9-1} + {\$DX-2}}
Archaeology-{!{1d9-1} + {\$IQ-2}}
``````

This code works (except for the alphabetization - animal handling selections always go first). I don't want to have copy and rename the file and then make changes to every type of NPC I want to create, though. So the intent is to get some selectable prompts to direct some of that.

• edited December 2020

Here is the animal handling external table (minus some of the setting animals because I want to get it working before fleshing those tables out):

``````table: animalhandling
set: Game=[when] {\$Prompt3} = Outlanders [do]Outlanders[end][when] {\$Prompt3} = Star Wars [do]StarWars[end][when] {\$Prompt3} = Morrow Project [do]MP[end][when] {\$Prompt3} = Normal [do]Normal[end][when] {\$Prompt3} = Star Trek [do]StarTrek[end][when] {\$Prompt3} = Stargate [do]Stargate[end][when] {\$Prompt3} = Rifts [do]Rifts[end][when] {\$Prompt3} = Fantasy [do]Fantasy[end]
[#{\$Game} animalhandlingskill]

table: animalhandlingskill
type: Dictionary
Normal: [!{1d3} normalanimaltypes]
MP: [!{1d2} morrowanimaltypes]
Outlanders: [!{1d2} outlandersanimaltypes]
Stargate: [!{1d2} stargateanimaltypes]
StarWars: [!{1d2} starwarsanimaltypes]
StarTrek: [!{1d2} startrekanimaltypes]
Rifts: [!{1d2} riftsanimaltypes]
Fantasy: [!{1d2} fantasyanimaltypes]

table: normalanimaltypes
Animal Handling (Bears)-{!{1d9-1} + {\$IQ}}
Animal Handling (Big Cats)-{!{1d9-1} + {\$IQ}}
50:Animal Handling (Camels)-{!{1d9-1} + {\$IQ}}
100:Animal Handling (Dogs)-{!{1d9-1} + {\$IQ}}
Animal Handling (Dolphins)-{!{1d9-1} + {\$IQ}}
50:Animal Handling (Elephants)-{!{1d9-1} + {\$IQ}}
100:Animal Handling (Equines)-{!{1d9-1} + {\$IQ}}
Animal Handling (Raptors)-{!{1d9-1} + {\$IQ}}
Animal Handling (Reptiles)-{!{1d9-1} + {\$IQ}}
Animal Handling (Small Cats)-{!{1d9-1} + {\$IQ}}
Animal Handling (Whales)-{!{1d9-1} + {\$IQ}}

Table: morrowanimaltypes
100:[!{1d2} normalanimaltypes]
Animal Handling (Dire Wolf)-{!{1d9-1} + {\$IQ}}

table: outlandersanimaltypes
[!normalanimaltypes]
Animal Handling (Setting Specific Animal)-{!{1d9-1} + {\$IQ}}

table: starwarsanimaltypes
Animal Handling (Taun Taun)-{!{1d9-1} + {\$IQ}}
Animal Handling (Blurrg)-{!{1d9-1} + {\$IQ}}
Animal Handling (Bantha)-{!{1d9-1} + {\$IQ}}

table: stargateanimaltypes
[!normalanimaltypes]
Animal Handling (Setting Specific Animal)-{!{1d9-1} + {\$IQ}}

table: riftsanimaltypes
[!normalanimaltypes]
Animal Handling (Setting Specific Animal)-{!{1d9-1} + {\$IQ}}

table: startrekanimaltypes
[!normalanimaltypes]
Animal Handling (Setting Specific Animal)-{!{1d9-1} + {\$IQ}}

table: fantasyanimaltypes
[!normalanimaltypes]
Animal Handling (Setting Specific Animal)-{!{1d9-1} + {\$IQ}}
``````