the dbot is mine

dude. regexps are at once the coolest and hardest thing I’ve learned in all my programming experience.

I mean, being able to do: /(^-?d+)/

to search a variable for any string that: “Starts with 1 or 0 “-“s, followed immediately by 1 or more “0-9″s” and then storing that result in another variable without changing the first variable all in one bloody line of code is freakin cool.

oh yeah. for those not in the know, I’m in the process of rewriting dicebot, our irc program that comes in and rolls all of our dice for us while we’re playing dnd online.

Two reasons I’m doing this:

1) currently, you have to run it through mIRC. Which means you have to be running windows to run it. Screw that shit. For the longest time I just had someone else fire up dicebot, but thats lame.

2) it can only do the simplest of math. Yeah, thats not its main function (rolling dice, which it does pretty well.) but dammit, it should be able to add a string of numbers together, not just two. And it should be able to at least multiply.

And as of right now I have all of the logic part of the dicerolling part of the program done. Meaning it rolls its dice properly, adds the dice up properly (handling negatives), and displays the results properly and identically to the way dicebot does it.

With one exception… which leads me to reason the third

3) I can add extra bits to this bot very easily, like when you roll a d20+2, and get a 22, it will put underscores around the number, showing that it was a natural 20. Can be useful.

But I can add other cool features. Like say you did just roll that natural 20. I can get it to watch your next input and if you typed say “crit” it will reroll and see if you got a crit. Or other things. Anyway, back to coding.

Leave a Reply