Thats just how I'd do the RollerTarget function.As for your inputting, it may want it like /$target=>50 Just an Idea, not sure how the system works itself, but perl can be interesting to say the least. <hugs his tkx perl area editor>

The original does indeed set $target to the first argument; the modification defaults it to zero if nothing was provided. The example you gave still doesn't actually set $target, though. It just returns the function argument.

What's the point of a subroutine that only returns its argument? Eh, anyhow, problem solved…

That's an API to allow you to pass code refs around, so the caller doesn't have to know what it's calling. From whatever is calling target()'s point of view, it could just as easily be popping up a window to ask the user for a number, or using TCP::CarrierPigeon to get a number from some other site.. slowly.

FWIW, the code above appears to set triggers for all values between 30 and what you pass in. Is that intended? If you pass it a number less than 30, it will do nothing at all, and passing it a big number like 999999 will run far more triggers than you probably want?

I also know nothing about the client app, but it seems like you'd want a trigger to loop, executing your roll command until the output matches a pattern where the result is larger than what you asked for. This seems to be setting up multiple triggers to do the reroll once each?

I assumed there was some reason why target would be a subroutine, since if it only interacts with a local variable, it is rather pointless. The problem here, is we don't have the caller's API for writing plugins for this thing. :blues: