Table position +/-

Hei there i have a question

i know that i can request a position in a table with [#<item> <table>] but now i have a table like this

Table: 100Dice
1-2: 1-2
3-8: 3-8
9-20: 9-20

I search for a way/function that i can jump to rows in this talbe i.E. if the item is 5 the it would jump in the table to 3-8 and it should be possible to manipulate the item i.E. if the item is 5 again and i would write item==item+5 then would be the item 10 and jump to 9-20 in the table

thanks for your helps


  • Hi Necroion, welcome to the forums!

    It seems that, like many specific-purpose languages, IPP is very good at doing what it was designed to do, but if you want to accomplish something unexpected things get ugly quickly.

    After a bit of experimentation, here's what I came up with:
    MaxReps: 1
    table: start
    &#91;@90 doLotsOfRolls &gt;&gt; implode &lt;br&gt;&#93;
    table: doLotsOfRolls
    table: rollCheck
    &#91;do&#93;Too many tries.  Rerolling.\n{rollTries==0}{thisRoll=={1d100}}&#91;@rollCheck&;#93;&
    \_&#91;do&#93;Roll {thisroll} has already happened.  {thisroll=={thisroll}+5}Trying {thisroll}.\n{rollTries=={rollTries}+1}&#91;@rollCheck&;#93;&
    \_\_&#91;do&#93;Roll {thisroll} too high.  {thisroll=={thisroll}-100}Trying {thisroll}.\n{rollTries=={rollTries}+1}&#91;@rollCheck&;#93;&
    \_\_&#91;else&#93;{rollTries==0}{did{thisroll}==1}&#91;#{thisroll} destinationTable&#93;...&
    table: destinationTable
    1-5:{thisroll} got me to 1-5
    6-10:{thisroll} got me to 6-10
    11-15:{thisroll} got me to 11-15
    16-20:{thisroll} got me to 16-20
    21-25:{thisroll} got me to 21-25
    26-30:{thisroll} got me to 26-30
    31-35:{thisroll} got me to 31-35
    36-40:{thisroll} got me to 36-40
    41-45:{thisroll} got me to 41-45
    46-50:{thisroll} got me to 46-50
    51-55:{thisroll} got me to 51-55
    56-60:{thisroll} got me to 56-60
    61-65:{thisroll} got me to 61-65
    66-70:{thisroll} got me to 66-70
    71-75:{thisroll} got me to 71-75
    76-80:{thisroll} got me to 76-80
    81-85:{thisroll} got me to 81-85
    86-90:{thisroll} got me to 86-90
    91-95:{thisroll} got me to 91-95
    96-100:{thisroll} got me to 96-100
    Some notes:
    • "did" is sort of a pseudo-hash. Each time a roll succeeds, a new variable is created. If 72 was rolled, the code above sets a new variable called did72 equal to 1.
    • Contrary to the documentation, you in fact can do nested conditionals. But (so far as I've been able to discover} only in [when]-style conditionals, and only in the [else] portion.
    • "\_" is IPP-speak for "nothing". It's the best I could come up with for indentation that doesn't appear in the results. And this code really demanded indentation.
    • Since this code uses a very primitive "try, try again" algorithm, and it's rolling 90 times out of a possible 100 values, I've set MaxReps to 1. Changing that (without changing anything else about the code) could really stress out your GUI.

    Hope it works for you!

Leave a Comment