mIRC Home    About    Download    Register    News    Help

Print Thread
Need some help with codes.. mIRC script, dicing #248658 15/10/14 01:29 AM
Joined: Oct 2014
Posts: 42
K
Kooky Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Oct 2014
Posts: 42
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!



Re: Need some help with codes.. mIRC script, dicing [Re: Kooky] #248660 15/10/14 03:09 AM
Joined: Sep 2014
Posts: 24
S
SophisDecay Offline
Ameglian cow
Offline
Ameglian cow
S
Joined: Sep 2014
Posts: 24
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


-Chan: #WolvenSpirit -Server: Irc.Sorcery.Net
Re: Need some help with codes.. mIRC script, dicing [Re: SophisDecay] #248661 15/10/14 05:54 AM
Joined: Oct 2014
Posts: 42
K
Kooky Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Oct 2014
Posts: 42
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!

Re: Need some help with codes.. mIRC script, dicing [Re: Kooky] #248788 24/10/14 10:19 AM
Joined: Oct 2014
Posts: 42
K
Kooky Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Oct 2014
Posts: 42
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.

Re: Need some help with codes.. mIRC script, dicing [Re: Kooky] #248789 24/10/14 10:27 AM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
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
}



Re: Need some help with codes.. mIRC script, dicing [Re: westor] #248790 24/10/14 11:24 AM
Joined: Oct 2014
Posts: 42
K
Kooky Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Oct 2014
Posts: 42
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?

Re: Need some help with codes.. mIRC script, dicing [Re: Kooky] #248791 24/10/14 11:50 AM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
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! }
}

Re: Need some help with codes.. mIRC script, dicing [Re: westor] #248792 24/10/14 11:56 AM
Joined: Oct 2014
Posts: 42
K
Kooky Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Oct 2014
Posts: 42
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.