mIRC Home    About    Download    Register    News    Help

Active Threads | Unanswered Past 24 hours | Past 48 hours | Past Week | Past Month | Past Year
Scripts & Popups Jump to new posts
Re: Random Issue maroon 4 hours ago
You can use the 'goto' command to go to a label, which is a text string beginning with a colon. You could do something like:

if ( $rand(1,2) ) == 1 goto goodbean
else goto badbean

code goes here
goto label123

code goes here
goto label123

code goes here
obviously, you didn't need the "goto badbean" since that label was on the next line. and same goes for the goto at the end of the goodbean code.

You can simplify your script by keeping your messages either in separate text files, or in a hashtable. hashtable has the advantage of being kept in memory, so you don't need a disk read each time. text file has the advantage of being easy to /play the text file and see a list of all your messages.

Also, the $read command has the random feature built into it, when you don't give it a line number to read. This example uses the 'n' switch because that prevents any word beginning with $ or % from being replaced by how they evaluate. i.e. a line in the text file containing $me would print the literal "$me" instead of using your nick.

var %message $read(goodbean.txt,nt) $+ 1,0Enjoy The Bean

This fills a variable with a random line from the text file. This way you don't need to keep adjusting your script each time you add another message. Notice how I appended the final portion of the 'good bean' message, so you don't need to put that on every line of the text. If you find it harder to put the Ctrl+K symbol into the text file when using something like notepad, you can choose a character that will never be used in any of your messages, and use that in place of the color code. For example, assume the character will be the asterisk, the text file would contain lines like:

Black Pepper *15,1( *4Black*15 *4Pepper*15 )
Garlic *30,1( *4Garlic*30 )

and then you can fetch random lines like this, while changing the asterisk back to the Ctrl+K symbol:

msg %beanch Hands %victem a $replace($read(badbean.txt,nt),*,$chr(3)) $+ 1,0 Ohhh You've Been BeanBoozeled

After you read a random line, if you need to know which line was most recently read from any disk file, the line number is contained in $readn

Something else you should change in your script is that your variables are being created as global variables which continue to be saved in your vars tab of the scripts editor long after your script is used, even though they aren't needing to be saved for later. You can make them be local by either using /set -l or using /var

var %victem $nick
var %beanch #PoulsKitchen

It looks like
set -kl %badcount + 1
is supposed to be a counter for how many times the bad routine has been hit. By using the -l flag, this creates the variable as a local variable which doesn't exist outside the ON TEXT event. What this is doing is defining the variable as the literal string "+ 1". If you want to increment a global variable, you can do it like: /inc %badcount
1 24 Read More
Scripts & Popups Jump to new posts
Re: Help Needed for a Script. *please* Epic Yesterday at 06:53 AM
I read your request and decided to try writing my own script, and this is what I got cool
3 types of protective checks for flooding, installation and automatic removal of the mode on the channel and kick on the bully's nickname.
All control in the alias "af_data". You can enable and disable different types of verification separately, as well as adjust the number of actions and the number of seconds after which need to respond.

#   AntiFlood v1.0
#   Description: Catching different types of flood on channels
#   Author: Epic

alias af_data {
  .hadd -m af check-mess true
  .hadd -m af check-rep true
  .hadd -m af check-words true
  .hadd -m af check-mode true
  .hadd -m af check-kick true
  .hadd -m af max-mess 5
  .hadd -m af max-mess-sec 3
  .hadd -m af max-rep 3
  .hadd -m af max-rep-sec 10
  .hadd -m af max-words 200
  .hadd -m af max-words-sec 10
  .hadd -m af mode +m
  .hadd -m af demode -m
  .hadd -m af mode-sec 300
  .hadd -m af reason flood/spam
alias afcheck {
  var %af_check count- $+ $1 $+ $2
  if ($prop == rep) return $hget(af_rep,%af_check)
  if ($prop == rsec) return $hget(af_rsec,%af_check)
  if ($prop == mes) return $hget(af_mess,%af_check)
  if ($prop == msec) return $hget(af_msec,%af_check)
  if ($prop == words) return $hget(af_words,%af_check)
  if ($prop == wsec) return $hget(af_wsec,%af_check)
alias af_count_mes {
  var %af_count count- $+ $1 $+ $2
  if (!$hget(af_msec,%af_count)) .hadd -mz af_msec %af_count $hget(af,max-mess-sec)
  if (!$hget(af_mess,%af_count)) .hadd -mu $+ $hget(af,max-mess-sec) af_mess %af_count 0
  if ($hget(af_msec,%af_count) > 0) .hinc -m af_mess %af_count 1
alias af_count_rep {
  var %af_count count- $+ $1 $+ $2
  if (!$hget(af_rsec,%af_count)) || ($3- !isin $hget(af_rep_text,%af_count)) {
    .hadd -mz af_rsec %af_count $hget(af,max-rep-sec)
    .hadd -mu $+ $hget(af,max-rep-sec) af_rep %af_count 0
    .hadd -m af_rep_text %af_count $3-
  else { .hinc -mu $+ $hget(af,max-rep-sec) af_rep %af_count 1 }
alias af_count_words {
  var %af_count count- $+ $1 $+ $2
  if (!$hget(af_wsec,%af_count)) .hadd -mz af_wsec %af_count $hget(af,max-words-sec)
  if (!$hget(af_words,%af_count)) .hadd -mu $+ $hget(af,max-words-sec) af_words %af_count 0
  if ($hget(af_wsec,%af_count) > 0) .hinc -m af_words %af_count $numtok($3-,32)
on *:TEXT:*:#:{
  af_data | var %af_count count- $+ $nick $+ $chan
  if ($hget(af,check-mess) == true) af_count_mes $nick $chan
  if ($hget(af,check-rep) == true) af_count_rep $nick $chan $1-
  if ($hget(af,check-words) == true) af_count_words $nick $chan $strip($1-)

  ;# Debug check script echo
  ;/echo -s 28debug:18 $nick $chan 28 message:53 $hget(af_mess,%af_count) $hget(af_msec,%af_count) 28 repeat:41 $hget(af_rep,%af_count) $hget(af_rsec,%af_count) 28 words:29 $hget(af_words,%af_count) $hget(af_wsec,%af_count)

  if ($afcheck($nick,$chan).mes >= $hget(af,max-mess) && $afcheck($nick,$chan).msec > 0) {
    /echo -a FLOOD $chan $nick :40 $afcheck($nick,$chan).mes messages in40 $hget(af,max-mess-sec) seconds.
    if ($hget(af,check-mode) == true) af_mode_chan $nick $chan
    if ($hget(af_mess,%af_count)) .hdel -sw af_mess count-* | if ($hget(af_msec,%af_count)) .hdel -sw af_msec count-*
  if ($afcheck($nick,$chan).rep >= $hget(af,max-rep) && $afcheck($nick,$chan).rsec > 0) {
    /echo -a FLOOD $chan $nick :40 $afcheck($nick,$chan).rep reps in40 $hget(af,max-rep-sec) seconds.
    if ($hget(af,check-mode) == true) af_mode_chan $nick $chan
    if ($hget(af_rep,%af_count)) .hdel -sw af_rep count-* | if ($hget(af_rsec,%af_count)) .hdel -sw af_rsec count-*
  if ($afcheck($nick,$chan).words >= $hget(af,max-words) && $afcheck($nick,$chan).wsec > 0) {
    /echo -a FLOOD $chan $nick :40 $afcheck($nick,$chan).words words in40 $hget(af,max-words-sec) seconds.
    if ($hget(af,check-mode) == true) af_mode_chan $nick $chan
    if ($hget(af_words,%af_count)) .hdel -sw af_words count-* | if ($hget(af_wsec,%af_count)) .hdel -sw af_wsec count-*
alias af_mode_chan {
  if ($hget(af,check-kick) == true) /kick $2 $1 $hget(af,reason)
  if (!$timer(AF $+ $2)) {
    /mode $2 $hget(af,mode)
    .timerAF $+ $2 1 $hget(af,mode-sec) /mode $2 $hget(af,demode)
1 126 Read More
Bug Reports Jump to new posts
Re: $regml().pos $regmlex().pos maroon Yesterday at 02:17 AM
This behavior will be difficult to script around. The $2 parm requires a byte offset, but the .pos property returns a character offset. So, a script will be able to do $bvar(&binvar,$regml(foo,1).pos,length) to handle the match string only if the binvar contains only codepoints 1-127. When dealing with binvars, it would be helpful to have a $regml().bytepos property so the script can know the match's actual offset in the &binvar.

And, with returning offsets smaller than the $2 parm will also be confusing for addressing the binvar, so scripts will be forced to copy the section of binvar to a new binvar, into which they would search at offset 1.
2 106 Read More
Scripts & Popups Jump to new posts
Re: dll errors when clicking custom toolbar maroon Yesterday at 01:48 AM
You'd need to hope there's someone out there who uses this dll, which I've never heard of. A dll is like a collection of 1-or-more identifiers or commands wrapped up inside an external binary. Hopefully you have some documentation telling you which procedure names are inside the dll, and hopefully the docs tell you the syntax of how to use them.

The procedures inside the dll are similar to alias names inside the dll which can do things a scripted alias can't do by itself, and the procedures need to be called in their exact case-sensitive name. You can call them like a command, as in:

/dll filename.dll procedurename this is the $1- for the procedure
//echo -a $dll(filename.dll,procedurename,this is the $1- for the procedure)

We'll have a hard time helping you when your problem is that, not only are you not feeding the $1- to the dll's procedure, you're not even passing the name of the procedure either.

edit: if you have trouble figuring out that dll, perhaps better luck with spopup.dll http://www.xise.nl/mirc/
3 64 Read More