"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.
A couple of things.
1) I haven't used primedice in years. It's possible that the API has changed and that the scripts in the OP no longer work.
2) As far as I know, if you've actually made a "profitable" dicing script, then what's happened is that you've been lucky. Assuming you're playing against a fair house with a house edge, it should be mathematically impossible to guarantee a profit. If you've got one, then you're just in a situation where you haven't yet converged to your estimated long-run return.