If you want to do something similar to UNs...
From whatever other function.
PHP Code:
function onPickBox(temp.c){
if(temp.c > 0){
this.randombox = int(random(1,9));
this.chat = this.randombox;
scheduleevent(.5,"PickBox",temp.c - 1);
}
else{
this.chat = this.randombox SPC "selected!";
}
}
Note I changed your random script from int(random(1,8)) to int(random(1,9)), cause assuming you are making a standard 8 box Chance event box 8 would never be selected in your original script (never can be max number).