I figure he'll be DecBot2, though if other people think that it should stay DecBot, I'm OK with changing it.
Also, the site is now using the DB.

Can I make this into one query:

SELECT COUNT(*) as LinkCount FROM links;
SELECT COUNT(*) as NameCount FROM scores;
SELECT SUM(Score) as Total FROM scores;

So that I can have, like:

| LinkCount | NameCount | Total |
|       147 |       376 |  7247 |

As a single result like that?

EDIT: Got it:

mysql> select * from (select count(*) as NameCount, sum(Score) as Total from scores) as t1, (select count(*) as LinkCount from links) as t2;
| NameCount | Total | LinkCount |
|       376 |  7247 |       145 |
1 row in set (0.00 sec)

And with that there's a new command, !total:
<Merth_> !total
<DecBot2> The total score is 7247 points between 376 names, with 145 links.
You've been making great progress! Are there going to be any added functions to DecBot*? Or will it keep all the same commands?
I think today I'll be adding a functions database, so if there's a function we want to persist across failures, we'll add it to that, and it'll reload it when it runs.
!calc is broken and always returns "Cannot evaluate expression".
_player1537 wrote:
!calc is broken and always returns "Cannot evaluate expression".
Bug report seconded. Shaun, I am very impressed with this, keep up the good work. Plus, a good way for you to learn a few new skills!
I fixed !calc. Sorry about that!

I've also added saving variables to the database:

!addVar <var> <value>
!addVar CtoF function(c) { return c * (9.0/5.0) + 32; }

Note that it's not <var> = <value>.
It will attempt to evaluate, and if it succeeds, it adds it to the DB. When the bot resets, it loads in the full variable DB. Only people with voice or op can do this.

You can also check a var:

!checkVar <var>
<Merth> !checkVar CtoF
<DecBot2> Merth: CtoF = function(c) { return c * (9.0/5.0) + 32 }
This can be done by anyone.
It works! Very nicely done, this is great. I'm glad that it's restricted to people with voice and op, although I don't see a ton of things that can be abused here.
Can the names on the increment table (Cemetech++) become variables, such that Cemetech+Kerm is a valid equation or will we need to define those separately? Not that it matters, but the random easter eggs are fun to find Very Happy
I could add something that lets you see the sum of names and stuff.
What about being able to just use them as normal values? So we could do: "!clac Kerm*100+merth*200"?
That really isn't trivial. The calc thread and the names are two separate things.
That's pretty much what I had just suggested, unless you're suggesting you predefine Kerm and Merth rather than relying on their point values.

Edit: Oh, it isn't? Hm, I - someone with no expertise in this area - thought it would be easy.
I was saying I could add something like !sum <name1> <name2> ... <nameN> and it would give you the sums of those names or something. But I couldn't make it so that you can use their names as variables in the scripting.
Decbot's back up. Sorry for the down time.
DecBot3 is now up. DecBot3 is completely rewritten in C# (thanks for the link to the IRC lib, qazz!), and uses IronPython for !calc. It's currently missing !unlink, but all other features are there.

Oh, and addvar and checkvar aren't in there yet, either. There's no persistence of the scripting scope between crashes. This wasn't really ever used, so I probably won't add it back in.
thanks for the link to the IRC lib, qazz!

Any time, Merth Smile

I was rather surprised that Decbot was not already programmed with that library, I assumed you had seen it before me. Laughing
It keeps pinging out, so while me and the lib developer figure out why, DecBot2 is back up.
Pinging out likely had to do with my bad router/modem. Now that I have new stuff, it's been up since last night working just fine. If it's still up when I get home tonight, I'll be throwing it into the channel proper. Now would be a good time to request any features Smile
I think as long as karma and !calc/!clac are intact, I'm happy. Oh, any chance you could make it do the ~intro thing? That is, when sax says "blah blah has registered / please welcome them" followed by "blah blah has entered the room", ask them to introduce themselves on that first room-entering?
I could add that, but I think it might be better if DoorsCS does it? We should see what Joni has to say about it.
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
» Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
» View previous topic :: View next topic  
Page 5 of 9
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum