Unfortunately you lost me. Or else I would be able to make the world's only profitable dicing script. It's fairly obvious what has to be done.
Basically, you bet 0 and record the results until you get the results you want. Then you bet what you want. When you are done betting rest the variables and bet 0 again.
The example was to help you with assigning variables, loops, and if/then statements.
"Or else I would be able to make the world's only profitable dicing script."
LOL, it is fairly elusive. I think I've actually made a profitable dicing script, but the return is abysmal. I'm better off throwing my money in the betting pool and taking other people's money.