#### Howdy, Stranger!

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

# Trying to learn variables, Can someone check this code

edited May 2020

Hi there new here but been doing simple tables for a while. I cant even troubleshoot this code as it crashes IPP instantly.
It canyone can help I would be most greatful.

Table: Weight
Build [@Build] Wtmod (Wtmod) Weight [[@Weight1]+{LBmod}]

Table: Build
Set: Wtmod=0
Set: LBmod=0
Roll: 1d6
1:Puny{Wtmod==Wtmod-20}{LBmod==LBmod-{2d10}}
2:Light{Wtmod==Wtmod-10}
3:Average
4:Average
5:Heavy{Wtmod==Wtmod+10}
6:Massive{Wtmod==Wtmod+20}{LBmod==LBmod+{2d10}}

Table: Weight1
Roll: 1d100+{Wtmod}
1:105
2-3:110
4-5:115
6-8:120
9-12:125
13-17:130
18-22:135
23-29:140
30-37:145
38-49:150
50-64:155
65-71:160
72-78:165
79-83:170
84-88:175
89-92:180
93-95:190
96-97:200
98-99:210
100-120:220

also is -20-1: An acceptible integer value for the first roll?

• The part it doesn't like is:
Roll: 1d100+{Wtmod}

I'm not sure why, since Wtmod appears to have a numerical value. However, you can shift that calculation into the other table. See below. Also, [[@Weight1]+{LBmod}] should be in curly braces since you want math done, and you might need to specify that Table Weight1 is a lookup table (I'm not seeing a difference though).

Table: Weight
Build [@Build] Wtmod (Wtmod) {Wtmod} Weight {[@Weight1 with {1d100+{Wtmod}]+{LBmod}}

Table: Build
Set: Wtmod=0
Set: LBmod=0
Roll: 1d6
1:Puny{Wtmod==Wtmod-20}{LBmod==LBmod-{2d10}}
2:Light{Wtmod==Wtmod-10}
3:Average
4:Average
5:Heavy{Wtmod==Wtmod+10}
6:Massive{Wtmod==Wtmod+20}{LBmod==LBmod+{2d10}}

Table: Weight1
Type: Lookup
Roll: {\$1}
1:105
2-3:110
4-5:115
6-8:120
9-12:125
13-17:130
18-22:135
23-29:140
30-37:145
38-49:150
50-64:155
65-71:160
72-78:165
79-83:170
84-88:175
89-92:180
93-95:190
96-97:200
98-99:210
100-120:220

And, no, I don't think you can have negative indexes on a lookup table.

• Thank you Jdale - I realised that id made some syntax errors as I was using a mac bluetooth keyboard and I have to do some of the symbols from muscle memory

• also Roll: {\$1} doesnt seem to be a pre defined variable , can i ask what it is?

• edited May 2020

You can use {\$1} in conjunction with the "with" keyword. I called your "Weight1" table like this:

[@Weight1 with {1d100+{Wtmod}}]

Then in the table, I want to refer to that {1d100}+{Wtmod}} value. I use {\$1} to do that, it has the value sent to that table. Here I used it in a Roll statement but you could also use it within the table as a variable.