mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2003
Posts: 12
M
monk Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Feb 2003
Posts: 12
i found this script from forum search and DaveC wrote it, I think it doesn't work well with numbers. For example the %answer is $50,000. Can you help me?
<triviabot> hint 1/5: $**,***
<triviabot> hint 2/5: $******
<triviabot> hint 3/5: $**,***
<triviabot> hint 4/5: $**,0**
<triviabot> hint 5/5: $*0,0**

hint.method2 {
var %answer = $gettok($1,1-,32)
var %hint = $gettok($2,1-,32)
if (!%hint) {
!.echo -q $regsub(%answer,/[^ ]/g,*,%hint)
}
elseif ($regex(%hint,/^[* ]+$/iS)) {
var %i = $numtok(%hint,32)
while (%i) {
var %hint = $puttok(%hint,$+($left($gettok(%answer,%i,32),1),$mid($gettok(%hint,%i,32),2)),%i,32)
dec %i
}
}
elseif ($pos(%hint,*,0)) {
var %i = $numtok(%hint,32)
while (%i) {
var %hword = $gettok(%hint,%i,32)
if ($pos(%hword,*,0) > 1) {
var %pos = $pos(%hword,*,$rand(1,$v1))
var %hint = $puttok(%hint,$+($left(%hword,$calc(%pos - 1)),$mid($gettok(%answer,%i,32),%pos,1),$mid(%hword,$calc(%pos + 1))),%i,32)
}
dec %i
}
}
return %hint
}

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I suggest you go back and read the instructions closer, I just ran the original script and it functions as specified.

The fact your first hint is comming back with something vastly different from what it should, and then the 2nd hint has removed a , and replaced it with a *, leads me to believe your either altered the code or your passing it rubbish values, in which case its quite happly passing you rubbish back.

its usage is $hint.method2( <answer> , [<hint>] )
You start by passing it JUST the answer (or if your in a loop you insure the current <hint> value is nothing)
Each returned value can be used as the next <hint> value.

Here is an example first using a
The second part even uses your example hint 1/5 "$**,***"

Code:
alias test {
  var %answer = $!50,000
  var %hint
  var %hint = $hint.method2(%answer,%hint) | echo -a Hint 1 %hint
  var %hint = $hint.method2(%answer,%hint) | echo -a Hint 2 %hint
  var %hint = $hint.method2(%answer,%hint) | echo -a Hint 3 %hint
  var %hint = $hint.method2(%answer,%hint) | echo -a Hint 4 %hint
  var %hint = $hint.method2(%answer,%hint) | echo -a Hint 5 %hint
  var %hint = $hint.method2(%answer,%hint) | echo -a Hint 6 %hint
  var %hint = $hint.method2(%answer,%hint) | echo -a Hint 7 %hint
  var %hint = $hint.method2(%answer,%hint) | echo -a Hint 8 %hint
  echo -a ---
  var %answer = $!50,000
  var %hint = $!**,***                     | echo -a Hint 1 %hint
  var %hint = $hint.method2(%answer,%hint) | echo -a Hint 2 %hint
  var %hint = $hint.method2(%answer,%hint) | echo -a Hint 3 %hint
  var %hint = $hint.method2(%answer,%hint) | echo -a Hint 4 %hint
  var %hint = $hint.method2(%answer,%hint) | echo -a Hint 5 %hint
  var %hint = $hint.method2(%answer,%hint) | echo -a Hint 6 %hint
}



Your code that producede the <triviabot> hint 1/5: $**,*** to <triviabot> hint 5/5: $*0,0** would have been more usfull to post, as I suspect that is where the problem lies.

Joined: Feb 2003
Posts: 12
M
monk Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Feb 2003
Posts: 12
Thank you so much for your help DaveC, It works now grin


Link Copied to Clipboard