mIRC Home    About    Download    Register    News    Help

Print Thread
#171394 23/02/07 08:55 PM
Joined: Feb 2005
Posts: 344
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
hi

I got this:
Code:
alias dice {
  var %print, %roll
  var %counter = 1
  var %howmany, %type, %rollcounter = 0
  while (%counter <= $0) {
    if ($pos($gettok($1-,%counter,32),d,1) != $null) {
      if ($left($gettok($1-,%counter,32),1) == $chr(100)) set %howmany 1
      else set %howmany $remove($left($gettok($1-,%counter,32),2),d)
      set %type $mid($gettok($1-,%counter,32),$calc($pos($gettok($1-,%counter,32),d,1)+1),3)
      while ($calc(%rollcounter + 1) <= %howmany) {
        if (%type == 100) set %roll %roll $calc(10 * $rand(1,10))
        else set %roll %roll $rand(1,%type)
        set %rollcounter $calc(%rollcounter + 1)
      }
      say $gettok($1-,%counter,32) $+ : %roll
      unset %roll
      unset %howmany
      unset %type
      unset %rollcounter
    }
    else if ($gettok($1-,%counter,32) == 4) set %print %print d4: $rand(1,4) / 
    else if ($gettok($1-,%counter,32) == 6) set %print %print d6: $rand(1,6) / 
    else if ($gettok($1-,%counter,32) == 8) set %print %print d8: $rand(1,8) / 
    else if ($gettok($1-,%counter,32) == 10) set %print %print d10: $rand(1,10) / 
    else if ($gettok($1-,%counter,32) == 12) set %print %print d12: $rand(1,12) / 
    else if ($gettok($1-,%counter,32) == 20) set %print %print d20: $rand(1,20) / 
    else if ($gettok($1-,%counter,32) == 100) set %print %print d100: $calc($rand(1,10) * 10) / 
    else set %print %print Entry %counter (d $+ $gettok($1-,%counter,32) $+ ) invalid / 
    set %counter $calc(%counter + 1)
  }
  set %print $deltok(%print,-1,32)
  if (%print) say %print
  unset %print
}


i want that to respond on a text.
i thought this would do the trick:
Code:
On 1:text:*!rol*:#:{
  /dice
}

Somehow it doesn't ..... please help

Bullseye #171398 23/02/07 10:59 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
By calling an alias, you no longer have a channel, so you can't use /say or /msg or whatever. To fix that, use:

Code:
On 1:text:*!rol*:#:{
  dice $chan
}


Then, in the Dice alias, replace any "say" with "msg $1".

Btw, if you'd like, I can show you my AD&D dice rolling script for comparison. Just let me know.

One point I'll make as well... you really should use "elseif" and not "else if". It's the correct syntax and in the future, "else if" may end up not working because it's the wrong syntax.


Invision Support
#Invision on irc.irchighway.net
Riamus2 #171412 24/02/07 02:04 AM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Actually, $chan, $nick, and other event identifiers are maintained and available from aliases that are called from within that event.

Code:
on *:TEXT:*:#:{
  myalias $1-
}

alias myalias {
  echo -s In $chan $+ , $nick said: $1-
}




@OP, it looks like your /dice alias requires parameters. Probably the value of the dice you want to roll. If there are no parameters, nothing will happen.



-genius_at_work

Last edited by genius_at_work; 24/02/07 02:09 AM.
genius_at_work #171415 24/02/07 02:43 AM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
I stand corrected. smile


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard