mIRC Homepage
So I need some help with some codes. I'm alright at coding.. but not great. I can modify existing codes, but that's about it aside from simple things.

So what I need..

Dice script:
A single d10 is rolled, and if that roll is above a six, it rolls another d10 and that die is listed as damage.
If the roll is below a six, it says "and misses" instead of "and deals # damage"

So..
!Rollit
<Bot> CharacterName rolls a # and deals # damage!

I'd like the option too for adding or subtracting numbers. 1-3

So..
!Rollit +2
<Bot> CharacterName rolls a #+2 and deals # damage!
So the d10 that is rolled has +2 added to it, not the damage. This should work for -2 as well.. but cap at 3. So no -4 or +4.


Any help is greatly appreciated. Thank you!


on *:TEXT:!roll *:#:{
if (($$2 !isnum 1-100) || ($$3 !isnum 1-100)) {
msg $chan 14,1 Roll with numbers, not letters. ( !roll X Y )
halt
}

set %NumberOfDice $$2
set %NumberOfSides $$3
set %temp 0
set %DiceRolled 0
set %rand 0
set %results 0
set %results2 0
while ( %DiceRolled < %NumberOfDice ) {
set %rand $rand(1,%NumberOfSides)
set %temp %results2
set %results2 $calc(%temp + %rand)
if (%results == 0) { set %results %rand }
else {
set %temp %results
set %results %temp %rand
}
inc %DiceRolled
}
msg $chan  Results for $nick $+ : %results == Total %results2 $+ .
unset %NumberOfDice %NumberOfSides %temp %DiceRolled %rand %results %results2

}


if you happen to know how to make an animal hunting script that's what i'm out looking for
Thanks.. but that's a basic rolling script and not at all what I'm looking for. It's not simplistic enough and has too many parameters and variables, and no tacked on secondary roll.

As for your animal hunting script, I would suggest making a thread for it and maybe linking me in PM. I might be able to help modify that. I have a similar "game-style" script myself.

Good luck!
I have no idea why this isn't working... Any help would be appreciated. Thank you!

Code:
 on *:TEXT:!rollit*:#LATOOC:{ 
  msg #LATOOC $nick rolled, 1d10: $rand(1,10)
}


Also, can anyone help me get it to where if it rolls above a 6, it rolls again for "damage"?

I'd like it in the format as my original post here.. but it's slow going. I've gotten this far at least.
Try use this code (NOT TESTED):

Code:
on *:TEXT:!rollit:#LATOOC:{ 
  var %r = $rand(1,10)
  msg $chan $nick rolled, 1d10: %r
  if (%r <= 6) { roll_again $chan $nick }
}
alias roll_again {
if ($me !ison $1) { return }
if ($2 !ison $1) { return }
var %r = $rand(1,10)
msg $1 $2 rolled again, 1d10: %r
}


THANK YOU!! That was what I needed to get it all in order. Thanks a ton!!!


Now here's a biggy... can you help me to be able to potentially modify the initial roll?

Such as
!rollit +2

Or
!rollit -2

So that it modifies the first %r?
You said to roll again if you wanna roll again you must include the alias.

you can do this with this code:

Code:
on *:TEXT:!rollit:#LATOOC:{ 
  var %r = $rand(1,10)
  var %r2 = $rand(1,10)
  var %m = rolled a %r
  if (%r <= 6) { msg $chan %m and misses! }
  if (%r >= 6) { msg $chan %m and does %r2 damage! }
}
I was able to get it without needing to do a reroll, I just modified a few more variables for it. Thanks because you inspired it, and taught me the key variable I was missing, as well as the order.
© mIRC Discussion Forums