hi,
so i’m trying to get a little gui window that will allow me to select what kind of dice, how many of them and to roll those dice and report the results to a TEXT area in the gui.
currently, i have “999” showing up in the text area but i want the result of the roll to go in there. but don’t know how to do that. halp?
i also don’t understand how to query the state of the radio buttons so that i can use that in a function.
in terms of figuring out the functions for the number and kind of dice, pretty sure i can figure that out. but i just can’t figure out what i’m doing wrong with updating the text field and get the state of the radio buttons.
thanks!
====================
global int $textResults = 999;
global proc RollDice() {
$textResults = rand (1,7);
print $textResults;
}
global proc JIN_DiceRoller(){
$Results = 999;
if(`window -q -ex "window1_ui"`)deleteUI("window1_ui");
window -t "JIN_DiceRoller" -s false -wh 400 250 "window1_ui";
columnLayout -w 150 -adj true;
rowColumnLayout -p "window1_ui" -w 150 -nc 4;
radioCollection;
radioButton -l "D2";
radioButton -l "D6";
radioButton -l "D10";
radioButton -l "D20";
radioButton -l "D3";
radioButton -l "D8";
radioButton -l "D12";
radioButton -l "D100";
intSliderGrp -p "window1_ui" -w 50 -f true -l "# of dice to roll" -min 1 -s 1 -v 1;
columnLayout -p "window1_ui" -adj true;
button -bgc 1.0 0.616583287716 0.0 -ebg true -l "ROLL DICE" -c ("RollDice; print $Results; $myTextField = $Results;") -aop true;
$textResults = $Results;
string $myTextField = `text -h 30 -l $textResults -fn "fixedWidthFont" -rs true`;
showWindow "window1_ui";
}
JIN_DiceRoller();