#### Howdy, Stranger!

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

# Can anyone help me troubleshoot this expression please?

Table:104c
Set: sibs ={1d6-1}
Set: bo ={1d6}
{ if({sibs}==0, 'Only Child', (Siblings {sibs} Birth order {if({bo} > {sibs}, '[|Firstborn|Lastborn]', '{bo}')}))}

I can get
Set: sibs ={1d6-1}
Set: bo ={1d6}
Siblings {sibs} Birth order {if({bo} > {sibs}, '[|Firstborn|Lastborn]', '{bo}')}

and

Table:104c
Set: sibs ={1d6-1}
Set: bo ={1d6}
{ if({sibs}==0, 'Only Child', 'other')}

To work but i cant get the combined table to run , Ive spend 4 days coding the entire central casting heroes now to a set of tables and its the last problem Ive ran in to

• edited May 2020

I think "if" is intended for arithmetic functions. You're trying to use it to contain other kinds of content and I think that's where things go awry. Try using "when" instead:

Table:104c
Set: sibs ={1d6-1}
Set: bo ={1d6}
[when]{sibs}=0[do]Only Child[else]Siblings {sibs} Birth order {if({bo} > {sibs}, '[|Firstborn|Lastborn]', '{bo}')}[end]

Results:

Siblings 5 Birth order 5

Siblings 2 Birth order Firstborn

Only Child

Siblings 4 Birth order Lastborn

• Thank you so much jdale I really appreciate it

• Have you posted your generator anywhere? I was thinking of trying to do a central casting generator, but if you have already done it, mine would be like reinventing the wheel.

• Chuga I hadnt , I wasnt sure of the copyright on the books. I own the original three from back in the day and I have Heroes of Legend complete and Heroes Now and im 1/3 throughHeroes of tomorrow , although I bet my code is aweful