mIRC Home    About    Download    Register    News    Help

Print Thread
#165569 28/11/06 01:38 AM
Joined: Nov 2006
Posts: 2
S
Bowl of petunias
OP Offline
Bowl of petunias
S
Joined: Nov 2006
Posts: 2
what im looking for is 2 things really...

1st a bot that will great users with a message (the message should be changeable via a op/channel admin by typeing something like "!welcomemsg blah blah blah"

2nd i need a DICE bot (for all those that don't know about dnd dice bots, what it has to do is when you type something like "!roll QdW[+/-]" it will roll a dice (now i will explain it a bit more, the !roll bit is easy)
Q = a number in between 1 and 999
d = dice, dont worry about this!
W = either a 4 sided, 6 sided, 8 sided, 10 sided, 12 sided, 20 sided, 100 sided (100 sided = the % dice)

so a user could type this "!roll 1d4+4" and the bot will say "USERNAME has rolled ?+4 to total ?"


if anyone knows were i can get such a thing PLEASE let me know, i looked on google for a few hours, i was able to find some scripts there good and all, but there not what im looking for....

if you need more explaining let me know please

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Welcome Message:
Code:
 on *:join:#:{
 .msg $chan %welcome.msg
}
on *:text:!welcome*:#:{
if !$nick($chan,$nick,hvr) {
set %welcome.msg $2-
}
else {
.notice $nick Ops or above only
}
}
 


Dice Bot: Clarification requested before I code this

Command: !roll 1d4
returns a number from a single 4 sided die

Command: !roll 5d100
returns a sequence of 5 numbers, one number for each of the 5 dice, with each die having 100 sides

Is this correct? If not, please do your best to clarify. (It's been too many years since I played Dungeons & Dragons)

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
I played Dungeons & Dragons


Mahahahah you geek!

/me runs down stairs and burns my battle board and hero helmet before anyone finds out.
(actually i have no idea what you need to play d&d they wouldnt let me in the club, said i was to nerdy)

Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
How about something like:
Code:
on *:TEXT:!roll *:#dice:{
  if ($regex(dice,$2,/(\d+)d(\d+)(?:\+(\d+))?/)) {
    echo -a $regml(dice,1) dice of $regml(dice,2) sides $iif($regml(dice,3), plus $v1)
    var %list, %tot = 0, %numd = $regml(dice,1), %sides = $regml(dice,2), %extra = $iif($regml(dice,3),$v1,0), %i = 1
    while (%i <= %numd) {
      var %roll = $r(1,%sides)
      %list = %list %roll
      inc %tot %roll
      inc %i
    }
    echo -a %list => %tot $iif(%extra,+ %extra = $calc(%tot + %extra))
  }
}


That will do things like 1d6, 10d5 and (as a bonus) 6d100+10

Will have a bit of difficulty with very large numbers of dice - probably should put a limit on %numd...


Sais
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Here's one I wrote a long time ago. Probably does the same basic thing that Sais's script does, but without the regex.

Code:
on *:text:!roll &:#: {
  if (d !isin $2 || $gettok($2,1,100) > 10 || $left($2,1) !isnum || $right($2,1) !isnum) { .notice $nick Please use the D&D format.  Example:  !roll 2d4 | return }
  var %roll = 0, %dice, %rand
  var %cnt = 1
  while (%cnt <= $gettok($2,1,100)) {
    %rand = $rand(1,$gettok($gettok($gettok($2,2,100),1,43),1,45))
    %roll = %roll + %rand
    %dice = %dice $chr(91) $+ %rand $+ $chr(93)
    inc %cnt
  }
  if (- isin $2) { %roll = %roll - $gettok($2,2,45) | %dice = %dice - $gettok($2,2,45) }
  elseif (+ isin $2) { %roll = %roll + $gettok($2,2,43) | %dice = %dice + $gettok($2,2,43) }
  msg $chan 10 $+ $nick 03rolled10 $2 03and got10 %roll 03--10 %dice
}


This nice thing with this is it will show you the dice that were rolled.

Example:
<user> !roll 2d20+2
<bot> user rolled 2d20+2 and got 25 -- [13] [10] + 2


Invision Support
#Invision on irc.irchighway.net
Joined: Nov 2006
Posts: 2
S
Bowl of petunias
OP Offline
Bowl of petunias
S
Joined: Nov 2006
Posts: 2
got it working ^^

Last edited by seanchiarot; 29/11/06 07:56 PM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Answered in IRC... Remotes, not Variables.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard