{ if( 1d20 >= 15, 'hit', 'miss')} help, where am i messing this up?

Hello Ed,

Sorry to pester you here.
I went through help files and forums but could not find an answer here.
I am making AD&D treasure tables and when I get to the magic-item chance i use this code but I keep getting an error of

(Invalid expression: if( 1d100 <= 30, '** it pulls the results no matter what the d100 roll is **', '0'))

THE CODE:

TABLE: TTA10MAGIC
{if( 1d100 <= 30, '\n [@{1d3} MagicTRMAIN]', '0')}
; { if( 1d20 >= 15, 'hit', 'miss')}
#
TABLE: MagicTRMAIN
ROLL: 1d100
01-20: \n [@PotionsMST] onset time is {1d4+1} segments, duration is {1d4+4} turns
21-35: \n [@ScrollsMST]
36-40: \n [@RingsMST]
41-45: \n [@RSWMST]
46-48: \n [@MME1MST]
49-51: \n [@MME2MST]
52-54: \n [@MME3MST]
55-57: \n [@MME4MST]
58-60: \n [@MME5MST]
61-75: \n [@ASMST]
76-86: \n [@SwordSizeRoll]sword [@SwordsMST][@ASMSTUnusualSwords]
87-100: \n [@MWMST]
;this goes to the subtables for magic items that all work as a stand alone magic item table.

For the life of me I've been beating my head on this for days now and I can't see how i'm off from the help file code for the function

{if( 1d100 <= 30, +results, -results)}

thank you for your help

Comments

  • This seems to work

    table: test
    {if( 1d100 <= 30, '\n [@{1d3} MagicTRMAIN]', '0')}
    
    
    table: MagicTRMAIN
    hello
    

    It generates a bunch of 0's and an occasional 'hello'

  • edited August 2016

    I installed this code and ran. On run #3 i got this error.

    Magic Items (Invalid expression: if( 1d100 <= 30, 'hello', '0'))

    It seems to work ok to give me a "0" when the d100 is above 30 but errors when it is below 31.

Leave a Comment