Sounds interesting, maybe the random seed could be tied to the post number so edits and updates don’t mess with the results.
One caveat, it’s better to use the post’s Date (minutes and seconds included), if it were the post’s number, the first player would always get the same roll and so on
I was thinking more like the ID number in the database, I don’t know what this looks like under the hood but each post and thread probably have a unique ID and they could be good static seeds. Time is good too though and more traditional.
To avoid fussing with posts, just make a rule. Any post with a random number in it which is subsequently edited causes that roll to critically fail. Or something like that.
I don’t understand how this isn’t equally-likely to be gamed.
Say we’re playing a BBS game. @patrace asks everyone to make a damage roll. I roll mine, and see that I would lose it. Now I delete my post, and wait for some other sucker to roll. Either they get my poor roll (if the engine doesn’t maintain state and just uses the number of rolls in the thread), or they get a random roll. In either case, I now post after that guy, and now I have a brand-new roll.
It’s even worse if the seed is transparent: I simply download your library, work out ahead of time what the results will be, and delay my post accordingly.
It still seems like you would need extra modifications in Discourse to prevent cheating (prevent deletion of posts, etc.).
Thinking on it, perhaps the very simplest way to implement this while eliminating cheating would be instead to simply code it as a bot.
I post:
Damage: {roll:3d6}
(or whatever)
The bot replies with the result:
SamSam damage roll result: 11.
Now it’s worthless deleting or editing my post because I can’t delete the bot’s posts. Everyone will see that I made a damage roll and got an 11.
The nicest thing about this is that it doesn’t depend on changing Discourse at all. It’s just a reply bot.
That’s interesting. I was thinking it might be used by a GM to prove the rolls are legit. The bot idea is good too.
Brilliant. Why didn’t I think of that?
Discourse shows deleted posts, it would be a tad suspicious if a user had a bunch of deleted posts, wouldn’t it?
About “timing” your roll down to the millisencond, all I can say is “good luck” Date.now() method returns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC
I do dig the reply bot idea tho
From what I had understood of your proposal, each thread would have one seed, and then each “roll” below it was an individual get(). I guess then that each post has its own independent seed instead? That would solve the foresight problem, yes.
Quoting self
I still think that the “Roll Bot” you proposed is the superior concept, and it could use any kind of RNG, even javascript’s Math.random(). It should be solved that way
@codinghorror how could we help to get that implemented?
@patrace, I’m replying to your PM here, because there are probably many smarter folks than me, and it would be easier for @codinghorror to be involved:
I’m not sure what you’re referring to with the reply-to link, so I’ll leave that alone for now.
The probably-inefficient way to scrape the thread would be to have a program (a “bot”) that pings the thread every x-minutes, preferably pulling down the raw JSON data. Searching around, I randomly discovered Discourse supports this simply by appending .json to the end of every thread url. So
Can we have a random number generator?
is the json for this thread. That makes parsing much easier.
You then have a simple JavaScript program to go through all the replies with a regex and find anything that was directed at the bot, using some known syntax. Your script can then update your internal database and anything else it needs to do.
At this point, if you want the bot to auto-respond, I think we’ll need CodingHorror’s help. As far as I can tell, there isn’s a trivial REST API that would allow you to post messages with a given user, but I’m sure Jeff could tell us how to do that.
There is an API, but I think you would need to know BoingBoing’s private API key in order to post to it, so that won’t work.
An alternative is if Jeff and co. were to build in some bot system right into Discourse, which would be useful for all sorts of sites I’m sure, but I won’t hold my breath for that.
I’m sorry, I’ve asked @codinghorror about this already and I think I’m just not communicating it very well.
I’ve already programmed a bot that can ping the thread and eat up the .json data. I’m now interested in feeding back into the system. The only access point I know of is through reply-to emails but I’d like to avoid having to write an email catcher.
Ah, got it. I was confused because I had no idea you could interact with Discourse via email. I see now that there are settings in my Preferences for email, and I send everything to a junk address so never noticed…
This really does seem to be a question only @codinghorror or @sam could answer:
- Given the json of a thread, and the ids of the messages, can you work out what the email address should be in order to post a reply to a specific message via email? …or…
- Can you post a message in a thread via REST API?
Ahhh!!! You are TWO Sams! I sent my message to the wrong person. Like I said, having trouble communicating
PM me if you still need help with this. This should be straight forward to script. Especially if you @mention the bot.
Set up a github repo!
I’ll have some time this weekend to get started. @patrace did we get permission to set this up, or should we whitelist the bot to only respond to folks in BSD 2.0?
This sounds awesome. I would love to have a little bot that manages inventory and enables players to trade items and starBits without my assistance. I’m thinking it would mimic some of the bitcoin tipping bots.
Give @gwwar b10.5
I’d want to first make sure we’re not violating some forum policy or doing hacking the forum in a way they don’t like so let’s loop in @jlw and make sure we have official BB approval before making a forum bot. It sounds like this would be a single user account set to do the following:
- Receive and parse email notifications.
- Update database of items/currency
- Reply via e-mail with results (Transfer Verified, User Not Found, Inadequate Balance, Humon!, etc)
Just replying to BASD players makes sense.