524 Programming
INPUT(SIDES,"Die Sides","N=","ENTER
num sides",2);
FLOOR(SIDES)
SIDES;
IF SIDES<2 THEN
MSGBOX("Must be >= 2");
END;
UNTIL SIDES >=2;
END;
VIEWS "Set Rolls",SETROLLS()
BEGIN
REPEAT
INPUT(ROLLS,"Num of rolls","N=","Enter
numrolls",25);
FLOOR(ROLLS)
ROLLS;
IF ROLLS<1 THEN
MSGBOX(" u must enter a num >=1");
END;
UNTIL ROLLS>=1;
END;
PLOT()
BEGIN
-1
Xmin;
MAX(D1)+1Xmax;
0
Ymin;
MAX(D2)+1
Ymax;
STARTVIEW(1,1);
END;
The ROLLMANY() routine is an adaptation of the program
presented earlier in this chapter. Since you cannot pass
parameters to a program called through a selection from
a custom Views menu, the exported variables SIDES and
ROLLS are used in place of the parameters that were used
in the previous versions.
The program above calls two other user programs:
ROLLDIE() and DICESIMVARS(). ROLLDIE()
appears earlier in this chapter. Here is DICESIMVARS.
Create a program with that name and enter the following
code.