It looks like you're new here. If you want to get involved, click one of these buttons!
Hi,
after unsuccessful ties to do some maths I fear either to do something wrong or to find a bug. It seems variables loose their value after display.
AT: {$val_kw=if($val_at_mod > 0, $val_at+6+floor($val_at_mod), $val_at+6)}, PA: {$val_kw} - {$val_kw_half={val_kw / 2}} {$val_pa={ceil($val_kw_half)}}
This is a quite complex calculation (for my NPC-Generator ) for the attack- and parade-value (for the roleplaying game "the dark eye"). "$val_kw" is correctly calculated and displayed, but if I try to use it for another calculation its value is "0". I only display the " {$val_kw} - " because I feared that the value changed, what wouldn't be correct.
Someone with a hint?
Thx WarFred
PS: the calculation at itself isn't the problem and there is no need to understand (but I could they explain, if desired )!
Comments
A screenshot for better understanding.
It seems I could solve the Problem by myself:
I simply stored the calculations in extra tables and now it works.
But I still don't know, if Variables loose their value after display or not.
I used the syntax {@var} in the PA calculation to retrieve the stored values of val_kw and it worked. Here's the test code:
Here's the output:
Thx for your help, but I decided to change from IPP3 to a "real" programming language, since I tried this night for about 4 hours (I went to bed at 5.15 am!) some complex calculations and failed.
IPP3 is very mighty, but lack of a lot of comfort functions (e.g. conditions like "and", "or", "xor" and nested "when"-conditions).
No problem. My main issue is always that I really don't have a decent grasp on the difference between {var} & {@var} and [@var] and [var], etc. I generally have to try all versions of syntax (and more) before I get the expected output. It's all probably there in the help file, but I just don't get it.
But, I do love the integrated html output window. No difficult programming to define the graphic output, etc. Now, there may well be "modern" programming languages that do the same (or better), but I haven't used a "real" programming language since Cobal, Pascal, and VB about 25 years ago (I can hack my through a bit of SQL and Crystal, but not enough to be proficient). Agree IPP is not the most powerful with built-in functions, but its mostly intuitive and sure beats creating volumes of d100 tables to manually roll on for results. Plus, its FREE!
Good luck!