mIRC Homepage
Posted By: DuXxXieJ Option for scripts - 09/05/07 04:36 PM
Is there an Option/Script for:

When you're typing !Scripts the bot will say all the scripts that are loaded or are in remote?

Like:

<TesT> !Scripts
<TesT2> mirc.ini mirc1.ini mirc4.ini

That stuff
Posted By: Riamus2 Re: Option for scripts - 09/05/07 04:50 PM
Code:
on *:text:!scripts:#:{
  var %cnt = $script(0)
  while (%cnt) {
    var %scripts = $nopath($script(%cnt)) %scripts
    dec %cnt
  }
  msg $chan %scripts
}


Or, if you want it easier to read, you can add colors:
Code:
on *:text:!scripts:#:{
  var %cnt = $script(0)
  while (%cnt) {
    var %scripts =  $+ $rand(3,15) $nopath($script(%cnt)) %scripts
    dec %cnt
  }
  msg $chan %scripts
}


Keep in mind that either method will have problems if you have too many scripts loaded -- * /set : line too long or whatever the error is. However, you'll need either a LOT of scripts loaded or else really long filenames for them. I have 31 loaded and it works fine and that's more scripts than most people keep loaded.
Posted By: DuXxXieJ Re: Option for scripts - 09/05/07 04:59 PM
Thanks smile
Posted By: DuXxXieJ Re: Option for scripts - 20/12/08 01:07 PM
Maybe a late reply, but I was busy this year. Today I tried to make it from a TEXT to a INPUT script, but it doesn't work. What's wrong with:

Code:
on *:INPUT:!scripts:{
  var %cnt = $script(0)
  while (%cnt) {
    var %scripts =  $+ $rand(3,15) $nopath($script(%cnt)) %scripts
    dec %cnt
    halt
  }
  echo -a %scripts
  halt
}


I added halt functions so my input wont be seen in a channel <so it wont be posted in a channel>.

I also tried this:


Code:
on *:INPUT:*:{
if $1 == !scripts {
  var %cnt = $script(0)
  while (%cnt) {
    var %scripts =  $+ $rand(3,15) $nopath($script(%cnt)) %scripts
    dec %cnt
    halt
  }
  echo -a %scripts
  halt
 }
}
Posted By: SCNDRL Re: Option for scripts - 20/12/08 02:34 PM
Code:
on *:INPUT:!scripts:{
  var %cnt = $script(0)
  while (%cnt) {
    var %scripts =  $+ $rand(3,15) $nopath($script(%cnt)) %scripts
    dec %cnt
  }
  echo -a %scripts
  halt
}
Posted By: Wims Re: Option for scripts - 20/12/08 02:51 PM
You've corrected the fact that he was halting the script before to echo %scripts, but you don't correct the fact that the on input event does not work like that (on *:input:!trigger:{).
Also, little thing like this could be done with one $regsubex :

Code:
on *:INPUT:*:{
if ($1- == !scripts) {
echo -a $regsubex($str(a,$script(0)),/a/g,$+($chr(3),$r(3,14),$nopath($script(\n)),$chr(15),$chr(32)))
halt
 }
}


Posted By: DuXxXieJ Re: Option for scripts - 23/12/08 08:24 PM
Thanks! This one works fine smile
Posted By: DuXxXieJ Re: Option for scripts - 18/01/09 01:48 PM
Ok, I still use it and it shows perfectly my bot's loaded scripts. But, I've got like 40 scripts loaded and now it doesn't fit anymore when he needs to say it xD. How can I get it to 2 single messages? Example:

<DJ-Serv> SCRIPTS: script1 script2 script3 (untill it doesn't fit anymore)
<DJ-Serv> SCRIPTS: script40 script41 (untill it doesn't fit anymore again)


Script:
Code:
on 20:text:.scripts:#:{
  var %cnt = $script(0)
  while (%cnt) {
    var %scripts =  $+ $rand(3,15) $+ $nopath($script(%cnt)) %scripts
    dec %cnt
  }
  msg $chan SCRIPTS: %scripts
}



-EDIT- This is what he shows when it doesn't fit:

<+DJ-Serv> SCRIPTS: Load Disconnect QueryAccess TotalScripts Modes Nickchanger Scripts Nickcheck EightBall Network Highlight AddVar DLLCheck Annoy Open First Unset NTWRK-Echo Upgrade001 Reconnect Connect [De]Oper Killing ChanCentral ChannelAccess OperHelp Calc FunCom Weather2 AutoVoice Topic Loggin AddUrl Annoy3 Idle Access RulesList NTWRK WhoisKill AdminShow VHos

The LAST one (VHos) should be VHostShow. So it doesn't fit frown

Posted By: Horstl Re: Option for scripts - 18/01/09 02:15 PM
The max. text lengh per line varies from network to network. Below, "250" is used (to play safe), you may try putting a higher number there.

Code:
on 20:text:.scripts:#:{
  var %cnt = 1, %scripts
  ; loop scripts
  while ($script(%cnt)) {
    ; add the currently processed script to the variable
    var %scripts = %scripts $+(,$base($rand(3,15),10,10,2),$nopath($v1))
    ; if the variable reached a certain length: output, clear variable
    if ($len(%scripts) > 250) {
      msg $chan SCRIPTS: %scripts
      var %scripts
    }
    inc %cnt
  }
  ; all scripts processed. if there is remaining data in the variable: output
  if (%scripts) { msg $chan SCRIPTS: %scripts }
}

"$base(N,10,10,2)" is used to ensure numbers are in 2-digit-format (e.g. "05" instead of "5") for the random colors.
Posted By: DuXxXieJ Re: Option for scripts - 18/01/09 02:22 PM
Yes, thank you! smile I have changed the 250 first to 300, that worked fine, then I made it to 400. Works fine too. No errors given so. Another question: When the second message is full ("doesn't fit anymore"), wil it automaticly msg a new msg? So not 2 message's but 3 message's

-Bad in english-
Posted By: Horstl Re: Option for scripts - 18/01/09 02:29 PM
Yepp, it will. Note that at the moment it won't delay the output of the lines itself - so if you want to send a large list (a dozen lines), the script may count the lines and delay each line with a timer:
Code:
on 20:text:.scripts:#:{
  var %cnt = 1, %scripts, %lines = 0
  ; loop scripts
  while ($script(%cnt)) {
    ; add the currently processed script to the variable
    var %scripts = %scripts $+(,$base($rand(3,15),10,10,2),$nopath($v1))
    ; if the variable reached a certain length: output, clear variable
    if ($len(%scripts) > 250) {
      .timer 1 %lines msg $chan SCRIPTS: %scripts
      var %scripts
      inc %lines
    }
    inc %cnt
  }
  ; all scripts processed. if there is remaining data in the variable: output
  if (%scripts) { .timer 1 %lines msg $chan SCRIPTS: %scripts }
}

© mIRC Discussion Forums