From: DARWINC514 <brd...@ro...> - 2007-09-07 01:53:17
|
I'm working on a DB to handle role-playing characters (RuneQuest III = especially). Here's the problem: in RQ beings get a bonus (occasionally = a penalty) to damage in melee for great strength (obviously) and size = (long bones give leverage) according to this table STR+SIZ Result Code but base zero =3D>much easier math=20 01-12 -1D4 ~ 0 -11 groups of 12 13-24 none * 12-23 25-32 +1D4 + 24-31 overlap 33-40 +1D6 A 32-39 region 41-56 +2D6 B 40-55 57-72 +3D6 C 56-71 groups of 16 etc I hit on the idea of using fields as temp variables.=20 Field28 script # STR + SIZ - 1, to get zero-based (- (+ %21 %23) 1)=20 Field36 script # calculate the groups-of-12 code=20 (br (ml flr (/ %28 12.0)) (all ~) (all *)(all +)) Field37 script # calculate the groups-of-12 code=20 (br (ml flr (/ (- %28 8.0) 16.0)) (all 0)(all A)(all B)(all C)(all = 0)(all E)) Field39 script # decide which to use based on the size of the sum in = Field28 (? (lt %28 32) %36 %37) Unfortunately Field36 always gets ~ and Field37 always gets 0. So let's = add a test field: Field40 script # show <index37>.00<index36> (+ (ml flr (/ %28 12.0)) (/ (ml flr (/ (- %28 8.0) 16.0)) 1000)) ml flr returns the right values: STR SIZ Field28 Field40 8 13 20 0.001 4 3 6 -1.000 14 17 30 1.002 20 20 39 1.003 35 23 57 3.004=20 I conclude that the br command is broken as it always returns the zeroth = element in its list.=20 Changing the Options -> Global Preferences -> Display to 'zero digits = after decimal point' had no effect of course... Any suggestions?=20 Rick Darwin -------------------------------------------------------------------------= ----- "Charles? We share a common ancestor."=20 |