mIRC Home    About    Download    Register    News    Help

Print Thread
d10 dice bot remote script #17880 03/04/03 12:23 AM
Joined: Apr 2003
Posts: 2
S
ScarletRage Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
S
Joined: Apr 2003
Posts: 2
Well, I need to find a very simple d10 dice bot system that'll roll out a specified number of dice with the ability to change the difficulty level. The current system I have has a hard time with botches and failures. It can calculate the successes correctly and it has no difficulty telling what constitutes a success, failure, and botch. The problem is that it does the "math" for the roller and is supposed to state "Successes #", Failure, or Botch. But it only says "Botch" when it should be "Failure". The problem is that failure's never come up and that's aggrivating because I use the bot as a tuorial for teaching people how to use the dice system. Any one willing to direct me to a script that I could use instead of what I have or would like to take a stab at the problem, I'd be happy to know. I don't know how to program remote scripts like this at all. All I know is that I'm smart enough to figure out some parts of it and that's not good enough for the little tiny problem I have that causes big confusion. Thanks.

PS- If nothing else I'll take a very simple script that'll just roll d10 dice to the specified number. (Like if I tell it to roll 5 dice it pops up with 5 numbers that can be anywhere from 1-10)


"Not all that glitters is gold."
Re: d10 dice bot remote script #17881 03/04/03 01:52 AM
Joined: Mar 2003
Posts: 272
C
c0ldfusi0n Offline
Fjord artisan
Offline
Fjord artisan
C
Joined: Mar 2003
Posts: 272
Put the following in your ALIASES section (ALT+A)
Code:
roll {
  if ($1) && (d isin $1) {
    var %xd = $gettok($1,1,100), %dx = $gettok($1,2,100)
    echo -a * Rolling %xd $+ d $+ %dx
    while (%xd != 0) {
      %result = %result $rand(1, %dx)
      dec %xd
    }
    echo -a * Dice results: %result (A total of $calc($replace(%result,$chr(32),+)) $+ )
  }
}


Syntax: /roll 5d20


- cF
Dedicated helper for rent.
Re: d10 dice bot remote script #17882 03/04/03 12:18 PM
Joined: Dec 2002
Posts: 143
A
Aubs Offline
Vogon poet
Offline
Vogon poet
A
Joined: Dec 2002
Posts: 143
I don't understand where/how the bot is supposed to use the success/botches/failures. If you explain a bit more, we may be able to help you...Also, explain how you would want the default difficulty level to change.

In reply to c0ldfusi0n, you would need to use ether unset %result at the end or use var %result = %result $rand(1, %dx) in the code, otherwise it would keep adding up the scores!!!
Also, ther'es no chekcing to ensure $1 is in the format <num>d<num> (e.g. 5d20)

The following scripts go in the remotes section...

You could always use /roll 5 d20 (based on c0ldfusi0n's script):

Code:
alias roll {
  [color:green];Line below checks to see if two items have been entered (e.g. /roll 5 d10). If not, stops.[/color]
  if (($1 !isnum) || (d* !iswm $2)) { echo -s * Incorrect syntax /roll. (/roll &lt;num&gt; d&lt;num&gt;) e.g. /roll 5 d10 | halt }
  [color:green];Sets %Roll.NumberOfDice to the number of dice to roll[/color]
  var %Roll.NumberOfDice = $1
  [color:green];Sets %Roll.DiceNumbers to the number in d&lt;num&gt;[/color]
  var %Roll.DiceNumbers = $right($2,-1)
  [color:green];echos to the screen what is being rolled.[/color]
  echo -a * Rolling $+(%Roll.NumberOfDice,d,%Roll.DiceNumbers)
  var %i = 1
  [color:green];Selects the random numbers[/color]
  while (%i &lt;= %Roll.NumberOfDice) {
    var %Roll.Result = %Roll.Result $rand(1,%Roll.DiceNumbers)
    inc %i
  }
  [color:green];Echos to the screen all the roll results and gives a total[/color]
  echo -a * Dice results: %Roll.Result (Total of $calc($replace(%Roll.Result,$chr(32),+)) $+ )
}


I think you may be wanting someone in a channel to type the prompt and the bot will reply in the channel.
If this is the case, then you will need to have the above in an on TEXT event:

Code:
on *:TEXT:*:[color:red]#YourChannel[/color]:{
  if (($1 == $+(!,$me)) &amp;&amp; ($2 == roll)) {
    if ($3 == help) {
      msg $chan 13* DiceRoller : Syntax - $+(!,$me) roll &lt;number_of_dice_to_roll&gt; d&lt;number_of_spots_on_dice&gt;
      msg $chan 13* DiceRoller : e.g. $+(!,$me) roll 5 d10
      msg $chan 13* DiceRoller : for help, type: $+(!,$me) roll help
      halt
    }
    if (($3 !isnum) || (d* !iswm $4)) { msg $chan 13* DiceRoller : Incorrect syntax !roll. (!roll &lt;num&gt; d&lt;num&gt;) | halt }
    var %Roll.NumberOfDice = $3
    var %Roll.DiceNumbers = $right($4,-1)
    msg $chan * Rolling $+(%Roll.NumberOfDice,d,%Roll.DiceNumbers)
    var %i = 1
    while (%i &lt;= %Roll.NumberOfDice) {
      var %Roll.Result = %Roll.Result $rand(1,%Roll.DiceNumbers)
      inc %i
    }
    msg $chan 13* DiceRoller : Results: %Roll.Result (Total of $calc($replace(%Roll.Result,$chr(32),+)) $+ )
  }
}


Hope they help ( I haven't tested them) smile

Last edited by Aubs; 03/04/03 12:21 PM.

Aubs.
cool

Re: d10 dice bot remote script #17883 03/04/03 10:10 PM
Joined: Apr 2003
Posts: 2
S
ScarletRage Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
S
Joined: Apr 2003
Posts: 2
I'll get right on it to see what they're like. Thanks!


"Not all that glitters is gold."