Author Topic: RPG Bot  (Read 10780 times)

0 Members and 3 Guests are viewing this topic.

Offline Newby

  • Moderator
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
RPG Bot
« on: November 20, 2005, 05:50:27 pm »
If we code an RPG bot, I just thought a neat structure.

bot/
|-- core (IRC connection crap)
`-- classes
    |-- D&D
    |-- Shadowrun
    `-- T&T

Something like that. Each type of RPG can be a class we add into it. :)
- Newby
http://www.x86labs.org

Quote
[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: RPG Bot
« Reply #1 on: November 20, 2005, 06:07:55 pm »
That would be neat.  Then we could have one for dice and things like that.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: RPG Bot
« Reply #2 on: November 20, 2005, 06:45:15 pm »
I don't know how useful that would be. 

Just having a bot that can do everything withoua  need for those subclasses would be just as useful.  Just the ability to roll dice, what more do you want?

I really don't see a point to having a bot/plugin for it. 

Offline Hitmen

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 1913
    • View Profile
Re: RPG Bot
« Reply #3 on: November 20, 2005, 09:42:56 pm »
I really don't see a point to having a bot/plugin for it. 
If someone takes the time to do it without it delaying anything than I don't really see the problem either. It would be nice to, if we're doing it in irc be able to just type a command and have the bot announce the roll of the channel. some of us don't have crazy dice!
Quote
(22:15:39) Newby: it hurts to swallow

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: RPG Bot
« Reply #4 on: November 20, 2005, 10:01:35 pm »
I really don't see a point to having a bot/plugin for it. 
If someone takes the time to do it without it delaying anything than I don't really see the problem either. It would be nice to, if we're doing it in irc be able to just type a command and have the bot announce the roll of the channel. some of us don't have crazy dice!
I'd slap together a program that can roll 6-sided dice locally, then everybody who needs to can run it.  I've said that several times already :-P

If somebody really wants to do a bot/plugin, then just make one that can roll dice.  Anything else is completely pointless, T&T for example has EXTREMELY simple rules..

Offline Towelie

  • pwnstar
  • x86
  • Hero Member
  • *****
  • Posts: 4873
    • View Profile
Re: RPG Bot
« Reply #5 on: November 21, 2005, 06:49:44 pm »
lol, well I cant program so you can count me out :-), but yeah just a dice rolling device is good enough for me :-P

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: RPG Bot
« Reply #6 on: November 21, 2005, 07:33:28 pm »
I'm pretty inexperienced with C (especially in making network programs).  However, if someone wants to team up for a project, I'd be more than willing to help out as much as I can.

I can slap together a PHP web-based version too.  I almost think that would work better.  Let me know what you guys think.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: RPG Bot
« Reply #7 on: November 21, 2005, 07:53:30 pm »
I'm thinking a Perl-based plugin for xchat.  How hard can it be?

Offline Newby

  • Moderator
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: RPG Bot
« Reply #8 on: November 21, 2005, 07:55:12 pm »
Not very hard. =P
- Newby
http://www.x86labs.org

Quote
[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: RPG Bot
« Reply #9 on: November 21, 2005, 08:13:18 pm »
I'm thinking a Perl-based plugin for xchat.  How hard can it be?

That would also work really well.

The reason I was thinking of a web-based one is because it's more accessable.  If someone wanted to make a move (or check up on someone's rolls) assuming we ever do a forum based RPG, it would be nice to be able to get to the rolling interface anywhere you can access the web.

I was thinking we could do something like this:


  -- Game
      `-- Rolling Session
           `-- Players
                 `-- Rolls


That's just me though.  I'm really game for anything that works well! :)

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: RPG Bot
« Reply #10 on: November 21, 2005, 08:15:30 pm »
Having a plugin running on the GM's system would be idea.  Since I intend to use xchat, that's not a problem. 

Just a ".roll 3d6" command would be handy. 

Newby -- could you implement some plugin in Perl or C that lets you do ".roll 3d6" and it will respond with the dice roll?  Once that's done, I can look after getting it to work for T&T stuff :)

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: RPG Bot
« Reply #11 on: November 21, 2005, 09:09:24 pm »
Having a plugin running on the GM's system would be idea.  Since I intend to use xchat, that's not a problem. 

Just a ".roll 3d6" command would be handy. 

Newby -- could you implement some plugin in Perl or C that lets you do ".roll 3d6" and it will respond with the dice roll?  Once that's done, I can look after getting it to work for T&T stuff :)

Alright, I was thinking maybe we were going to do something with the forums, but I'd definitely agree that a xchat plugin would be ideal if we're going to be using it for our game! :)

Offline Newby

  • Moderator
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: RPG Bot
« Reply #12 on: November 21, 2005, 09:10:01 pm »
Having a plugin running on the GM's system would be idea.  Since I intend to use xchat, that's not a problem. 

Just a ".roll 3d6" command would be handy. 

Newby -- could you implement some plugin in Perl or C that lets you do ".roll 3d6" and it will respond with the dice roll?  Once that's done, I can look after getting it to work for T&T stuff :)

For X-Chat? On it! :)

Uh, 3d6? Or do you want xd6?

If so, I can do .roll xd6, or .roll d6 x...

Otherwise, just 3d6. :)
« Last Edit: November 21, 2005, 09:12:51 pm by Newby »
- Newby
http://www.x86labs.org

Quote
[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: RPG Bot
« Reply #13 on: November 21, 2005, 09:15:03 pm »
Having a plugin running on the GM's system would be idea.  Since I intend to use xchat, that's not a problem. 

Just a ".roll 3d6" command would be handy. 

Newby -- could you implement some plugin in Perl or C that lets you do ".roll 3d6" and it will respond with the dice roll?  Once that's done, I can look after getting it to work for T&T stuff :)

For X-Chat? On it! :)

Uh, 3d6? Or do you want xd6?

If so, I can do .roll xd6, or .roll d6 x...

Otherwise, just 3d6. :)

If you do one that can roll 3, I can look after everything else. 

But if you're feeling ambition, then do:
- x d y (x y-sided dice)
- 2d6 doubles-add-roll-over (I mentioned that somewhere else)
- xd6, doubles-add-roll-over (Required if we have a berserker)

Also, I'd like to be able to do a table look up.  Like, for example, I want a table of, say, 100 languages.  Then they could do:
.choose language
And it would return a random one.  But for other things besides languages, like, make sure I can easily expand it. 

Of course, I can do all that, as long as you get it rolling 3d6 :P

Offline Newby

  • Moderator
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: RPG Bot
« Reply #14 on: November 21, 2005, 09:19:07 pm »
But if you're feeling ambition, then do:
- x d y (x y-sided dice)
- 2d6 doubles-add-roll-over (I mentioned that somewhere else)
- xd6, doubles-add-roll-over (Required if we have a berserker)

Also, I'd like to be able to do a table look up.  Like, for example, I want a table of, say, 100 languages.  Then they could do:
.choose language
And it would return a random one.  But for other things besides languages, like, make sure I can easily expand it. 

Well, I can get most of that, but if you wanna do some of the work...

What do you want me to do with the result of the 3d6?
- Newby
http://www.x86labs.org

Quote
[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: RPG Bot
« Reply #15 on: November 21, 2005, 09:20:04 pm »
But if you're feeling ambition, then do:
- x d y (x y-sided dice)
- 2d6 doubles-add-roll-over (I mentioned that somewhere else)
- xd6, doubles-add-roll-over (Required if we have a berserker)

Also, I'd like to be able to do a table look up.  Like, for example, I want a table of, say, 100 languages.  Then they could do:
.choose language
And it would return a random one.  But for other things besides languages, like, make sure I can easily expand it. 

Well, I can get most of that, but if you wanna do some of the work...

What do you want me to do with the result of the 3d6?

Display it out loud. 

And I don't WANT to do any work, but I WILL do it if I have to :P

Offline Newby

  • Moderator
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: RPG Bot
« Reply #16 on: November 21, 2005, 09:22:51 pm »
I mean, do you want me to sum them up or just list the individual results (it seems like this one)?
- Newby
http://www.x86labs.org

Quote
[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: RPG Bot
« Reply #17 on: November 21, 2005, 09:27:04 pm »
Well, I can get most of that, but if you wanna do some of the work...

What do you want me to do with the result of the 3d6?

Something like this:

Quote
.roll 3d6
You rolled 3 6-sided die: 3, 6, 1

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: RPG Bot
« Reply #18 on: November 21, 2005, 09:31:31 pm »
Why not both?

Sum is the most important part, though. 

<me> .roll 3d6
<bot> 3 + 6 + 1 = 10

I'll also need you to allow adds and display the level of the 2d6DARO rolls (level 1 is 20, level 2 is 25, level 3 is 30, level 4 is 35, etc:

Let's see if this table looks ok:

   Lvl   Target   Lvl   Target   Lvl   Target   Lvl   Target
   1st   20   2nd   25   3rd   30   4th   35
   5th   40   6th   45   7th   50   8th   55
   9th   60   10th   65   11th   70   12th   75
   13th   80   14th   85   15th   90   16th   95
   17th   100   18th   105   19th   110   20th   115


The forumula for level is simple, though: floor((roll - 15) / 5)

The command should look like this:
.daro 12

It will roll 2 dice in the standard way, add 12 to it, and display the level achieved:

<me> .daro 12
<bot> rolled 2 2 + 3 4 + 12 = 23 = level 1
<me> .daro 23
<bot> rolled 1 5 + 23 = 29 = level 2
<me> .daro 17
<bot> rolled 2 2 + 4 4 + 3 3 + 12 = 30 = level 3


Finally, if 1 2 or 2 1 or 3 1 or 1 3 is rolled, it's an auto-fail:
<me> .daro 100
<bot> rolled 2 1 = autofail
<me> .daro 12
<bot> rolled 3 1 = autofail

auto-fail = botch

Offline Newby

  • Moderator
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: RPG Bot
« Reply #19 on: November 22, 2005, 12:03:44 am »
I hate you. I just worked for a good 2-3 hours working on this fucking script, and you ask for something different?!?!?! >:(

Quote
[21:02:51] <@newby_> Result of 4d6 roll: 5 5 5 3
[21:02:58] <+newby__> !roll 3d6
[21:02:58] <@newby_> Result of 3d6 roll: 1 1 3
[21:03:01] <+newby__> !roll 3d6
[21:03:01] <@newby_> Result of 3d6 roll: 1 4 4
[21:03:03] <+newby__> !roll 3d6
[21:03:03] <@newby_> Result of 3d6 roll: 5 6 1
[21:03:06] <+newby__> !roll 4d4
[21:03:06] <@newby_> Result of 4d4 roll: 3 3 2 2
[21:03:10] <+newby__> !roll 100d6
[21:03:10] <@newby_> Result of 100d6 roll: 6 4 1 3 4 5 5 3 5 1 2 4 6 6 1 5 1 4
                     1 3 3 1 6 3 4 1 2 6 2 1 5 2 6 1 1 5 1 4 5 4 6 3 4 3 2 6 3
                     2 5 6 3 6 3 1 6 2 1 4 3 4 3 3 1 6 5 2 5 4 5 3 1 6 6 1 3 5
                     4 6 4 1 3 6 3 6 3 5 2 4 4 1 5 2 5 2 6 2 6 5 4 1
[21:03:13] <+newby__> !roll 69d69
[21:03:14] <@newby_> Result of 69d69 roll: 66 11 52 57 61 50 47 4 27 7 67 57 12
                     6 34 29 69 52 32 58 39 16 37 40 12 21 13 12 59 34 17 63 69
                     50 18 28 17 31 8 45 34 4 52 18 58 40 66 69 39 14 6 61 4 67
                     28 57 26 54 59 13 1 57 52 63 26 13 52 11 51

I refuse to sum them up or do any further work. Blow me. :-*

x86-rpg-script.pl

Code: [Select]
#!/usr/bin/perl
# Perl script for tunnels and trolls online.
# Contains various script things.
# Written by newby (newbypwns@gmail.com) for iago (iago@valhallalegends.com)
# http://wwww.x86labs.org
# :)

# Register the plugin with X-Chat.

Xchat::register("x86-rpg-script", "0.1a", "RPG script for X-Chat", \&unload);
Xchat::print("3Loading x86-rpg-script... please wait.");

# Register the roll command to a variable.

my $rpghook = Xchat::hook_server("PRIVMSG", "parsetalking");

# Randomize the seed!

srand();

# This sub is called whenever the plugin is unloaded.

sub unload()
{
    Xchat::unhook($rpghook);
    Xchat::print("3Unloading x86-rpg-script... please wait.");
}

# sub rolldice(int times, int sides)
# Sides: number of sides on the dice
# Times: number of times to roll the dice.
sub rolldice()
{
($times,$sides) = @_;
undef @arrayofnumbers;
for (my $i = 0; $i < ($times); $i++)
{
@arrayofnumbers = (@arrayofnumbers,(int(rand($sides)+1)));;
}
return \@arrayofnumbers;
}

sub parsetalking()
{
my $data = shift(@_);
my $username = substr(shift(@$data), 1);
# Xchat::print("Username: $username");
shift(@$data); # Don't know better.
shift(@$data); # :(!
my $message = substr(join(" ", @$data), 1);
# Xchat::print("Message: $message");
# Xchat::command("say <$username> $message");

# Enter the command sub:
if (substr($message, 0, 1) eq "!")
{
if (lc(shift(@$data)) eq ":!roll") # If not, we lost it. I'll have to assign to a variable later!
{
my $diceroll = lc(shift(@$data));
if (index($diceroll, "d") == -1)
{
Xchat::command("say You didn't enter a real dice value!\n");
return 0;
}
my $times = substr($diceroll, 0, index($diceroll, "d"));
my $sides = substr($diceroll, index($diceroll, "d")+1);
my $resultofdiceroll = &rolldice($times, $sides);
Xchat::command("say Result of $times"."d"."$sides roll: @$resultofdiceroll\n");
}
}
return 0;
}
« Last Edit: November 22, 2005, 12:48:37 am by Newby »
- Newby
http://www.x86labs.org

Quote
[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Offline Hitmen

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 1913
    • View Profile
Re: RPG Bot
« Reply #20 on: November 22, 2005, 12:37:18 am »
Newby is just mad because he sucks at life and I kept making fun of him the whole time while he was screwing up.
Quote
(22:15:39) Newby: it hurts to swallow

Offline Newby

  • Moderator
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: RPG Bot
« Reply #21 on: November 22, 2005, 12:47:02 am »
Actually, most of my anger (my harsh comments in the above post are sarcasm) came out of Perl not having a switch statement?

(I couldn't get mine to work for love 'nor money.)
- Newby
http://www.x86labs.org

Quote
[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Offline Towelie

  • pwnstar
  • x86
  • Hero Member
  • *****
  • Posts: 4873
    • View Profile
Re: RPG Bot
« Reply #22 on: November 22, 2005, 01:19:22 am »
programing sounds like it could be a hassle and frustrating at times!

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: RPG Bot
« Reply #23 on: November 22, 2005, 01:28:59 am »
programing sounds like it could be a hassle and frustrating at times!

I think the entirety of programming is frustrating. -_-

Haha, just kidding.  Programming is great, it's an awesome way to learn how to approach/solve problems. :)

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: RPG Bot
« Reply #24 on: November 22, 2005, 11:19:43 am »
Yeah, Newby just has an angry personality :-)

Thanks for writing that, I can look after anything else. 

Incidentally, how do I use that?

Offline Newby

  • Moderator
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: RPG Bot
« Reply #25 on: November 22, 2005, 05:15:25 pm »
Put it in ~/.xchat2 and it'll auto load on start!
- Newby
http://www.x86labs.org

Quote
[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT.