I know that a new expression events mod is being made. (Variables)
It lets you evaluate, add onto strings, etc. It should be broad enough (once it's done) for this to be possible with enough mathematical thinking. There was some AddToDatabase event, but i think that was brick specific and my server encountered frequent crashes with it enabled.