mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2003
Posts: 27
S
SirUrza Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2003
Posts: 27
Some how along the lines I broke my script..

on 1:input:!d*:#:{
if (%duser = 1) { /d $$1 }
}

alias d { $!-
if ($count($1-,d) > 1) { halt }
%input = $1-
%ctr = 1
%legalChars = $chr(32) $+ $chr(42) $+ $chr(43) $+ $chr(45) $+ $chr(35)
%check = $mid(%input,%ctr,1)

etc etc etc etc.
}


It's a dice roller script. Now I can /d 1d20 and it will roll a 1 20 sided dice just fine (kinda) I get..

$- Unknown command

In the status window.

When others try to roll it doesn't work at all anymore and the unknown command still appears in the status window. Used to work.. don't know what happened to make it stop though, maybe version changes.

So how can I fix this?

Last edited by SirUrza; 29/06/08 09:28 PM.
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
1) It's obvious to me that the problem is in the d alias, which you have not provided in full.
2) In the future please remember to use the Code Tags around code. In this forum the Code Tags are set by clicking the # button at the top of the screen where you're entering the actual code.
3) You might want to check the dice scripts in Hawkee Snippets

Joined: Apr 2008
Posts: 43
Z
Ameglian cow
Offline
Ameglian cow
Z
Joined: Apr 2008
Posts: 43
alias d { $!-

$!- whats that do? doesn't look right to me , but i could be wrong blush

Joined: Jan 2003
Posts: 27
S
SirUrza Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2003
Posts: 27
Here's the whole d alias.

Code:
alias d { $!-
  if ($count($1-,d) > 1) { halt }
  %input = $1-
  %ctr = 1
  %legalChars = $chr(32) $+ $chr(42) $+ $chr(43) $+ $chr(45) $+ $chr(35)
  %check = $mid(%input,%ctr,1)

  :scan
  if (%check != $null) {  
    if (((%check !isnum 0-9) && (%check !isletter d)) && (%check !isin %legalChars) ) { halt }
    else {
      inc %ctr
      %check = $mid(%input,%ctr,1)
      goto scan
    }
  }

  ; Check that there is not more than one of each legal non-digit character in the input
  ; Separate input into two variables: number of sets and a string of remaining dice data
  ; Either a pound sign '#' or a blank space '  ' is used as the delimeter for separating the variables
  if (($count(%input,+) > 1) || ($count(%input,-) > 1) || ($count(%input,x) > 1)) { /dice Too many parameters $+ . | halt }
  if (($chr(35) !isin %input) && ($chr(32) !isin %input)) { 
    %raw = %input
    %sets = 1
  }
  else {
    if ($chr(35) isin %input) { %del = 35 } 
    else { %del = 32 }
    %sets = $gettok(%input,1,%del)
    %raw = $gettok(%input,2,%del) 
  }
  if (%sets > 12) { /dice 12 sets of dice maximum per roll $+ . | halt }

  %checkset = 0
  %multiply = 1
  %modifier = 0
  %total = $null
  :begin
  inc %checkset
  if (%checkset > %sets)  { goto final }  
  ; Assign values to multiply and modifier variables
  ; Check values for erroneous size
  if ($chr(42) isin %raw) { %multiply = $gettok(%raw,2,42) | %raw = $remtok(%raw,%multiply,42) }
  if (+ isin %raw) { %modifier = $gettok(%raw,2,43) | %raw = $remtok(%raw,%modifier,43) }
  else if (- isin %raw) { %modifier = $gettok(%raw,2,45) | %raw = $remtok(%raw,%modifier,45) | %modifier = %modifier * -1 }
  if ($len(%modifier) > 6) { /dice That modifier is too large $+ . | halt }
  if (%multiply > 20) { /dice That multiplier is too large $+ . | halt }

  ; Set number of sides on die and number of times it is rolled
  ; Check for erroneous values
  if ($left(%raw,1) isnum) {
    %sides = $gettok(%raw,2,100)
    %times = $gettok(%raw,1,100)
  }
  else { %sides = $remove(%raw,d) | %times = 1 }
  if ($len(%sides) > 6) { /dice There are too many sides on that die $+ . | halt }
  if (%times > 1000) { /dice 1000 dice of any type maximum $+ . | halt }
  %result = 0
  %checkresult = 1
  :rolldice
  if (%checkresult <= %times) {
    %result = %result + $rand(1,%sides)
    %rstore = %result
    inc %checkresult
    goto rolldice
  }

  ; Apply multiplier/modifiers, if any
  if (%modifier != 0) { %result = %result + %modifier }
  if (%multiply != 1) { %result = %result * %multiply }
  %total = %total %result
  goto begin
  :final
  ;  describe $chan throws the bones for $nick ( $+ $1- $+ ) and gets %total $+ .
  /dice Rolling: ( $+ $1- $+ ) Results: %total $+ .
  if (%duser = 1) { /msg $chan $nick rolls ( $+ $1- $+ ) and gets %total $+ . }

  ; Check to see type of roll.. standard d20 or to hit
  if ( %tohit = 1 )      {
    if ( %rstore = 20 )  { 
      /dice Critical Hit! Rerolling for hit..
  /crit  }  
   }
  %tohit = 0
}

alias crit { %tohit = 1  
/d 1d20  }

alias tohit { %tohit = 1  
  /dice Rolling Attack...
/d 1d20 }


Last edited by SirUrza; 29/06/08 11:08 PM.
Joined: Jan 2003
Posts: 27
S
SirUrza Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2003
Posts: 27
Originally Posted By: zantetsuken
alias d { $!-

$!- whats that do? doesn't look right to me , but i could be wrong blush


Getting rid of it doesn't hurt the script. It actually makes the whole status problem go away, but nothing appears now when someone tries to !d it. smile

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Good catch, and something I missed. I thought it read $1- not $!-, which could be the whole problem.

Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
If ever you get an error that is unknown CTRL+F in your script and post the ENDing of the error, 70% of time youll be able to detect that simple. While other time's its the in proper syntax of code.


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Joined: Jan 2003
Posts: 27
S
SirUrza Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2003
Posts: 27
Originally Posted By: RusselB
Good catch, and something I missed. I thought it read $1- not $!-, which could be the whole problem.


When I change it to that nothing happens. When I run the strip /d 1d6 it works and posts the results, but in the status window it says..

1D6 Unknown command

So yeah.. no help.

But when I remove it /d still works (with no message in status) but people triggering with !d doesn't.

Last edited by SirUrza; 19/07/08 12:51 AM.

Link Copied to Clipboard