Keyboard Shortcuts
Likes
Search
Rolling until total reached
I'm trying to create a table that keeps a running total of points to spend. Once it reaches the max, it stops producing results.
Here is the structure I attempted with dummy text. When I run, the program exits (crashes). Any ideas? #
# _Test Table
#
?
%Total%,0
?
:Start
1,[Roll]
?
:Roll
1,Rolled 1 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br>
2,Rolled 2 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br>
3,Rolled 3 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br>
4,Rolled 4 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br>
5,Rolled 5 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br>
6,Rolled 6 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br>
7,Rolled 7 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br>
8,Rolled 8 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br>
9,Rolled 9 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br>
10,Rolled 10 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br> Some of the text in the table appears merely for testing purposes. The rolls will actually all lead to separate groups/tables so that ultimately I end up with 10 blocks of text from various other tables. Any help is appreciated. Thanks in advance. |
First thing, you do not need? "?/ End" in every If statement. That might be blowing it up.
You also don't need???|Total=%Total%+1| in every line, |Total+1| is all you need there. However, a simpler solution would be to look at a While loop.... %count%,0 :Start
1,Test Loop<br>
_{While~%count%<=10,
_%count%<br>
_|count+1|
_} In this loop, you call it and it prints out the following: Test Loop 0 1 2 3 4 5 6 7 8 9 10 |
¿ªÔÆÌåÓýThe problem is with your |Total=%Total%+1| When you use = it is a Literal value and puts ¡°0+1¡± as the value. What you want is |Total+1| or |Total={Calc~%Total%+1}| ? Vance ? Sent from for Windows 10 ? From: jimmyflowers1 via groups.io
Sent: Friday, February 19, 2021 3:59 AM To: [email protected] Subject: [TableSmith] Rolling until total reached ? I'm trying to create a table that keeps a running total of points to spend. Once it reaches the max, it stops producing results. # # _Test Table # ? %Total%,0 ? :Start 1,[Roll] ? :Roll 1,Rolled 1 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br> 2,Rolled 2 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br> 3,Rolled 3 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br> 4,Rolled 4 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br> 5,Rolled 5 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br> 6,Rolled 6 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br> 7,Rolled 7 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br> 8,Rolled 8 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br> 9,Rolled 9 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br> 10,Rolled 10 |Total=%Total%+1|{If~%Total% != 10 ? [Roll] / End}<br> ? |
¿ªÔÆÌåÓýOr you could simply use {Loop~10, [roll]<br>} ? Sent from for Windows 10 ? From: tim@...
Sent: Friday, February 19, 2021 6:51 AM To: [email protected] Subject: Re: [TableSmith] Rolling until total reached ? First thing, you do not need? "?/ End" in every If statement. That might be blowing it up. :Start 1,Test Loop<br> _{While~%count%<=10, _%count%<br> _|count+1| _} ? |