mIRC Home    About    Download    Register    News    Help

Print Thread
#249313 24/11/14 04:09 PM
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
I found a code on this website, but does not work.


Code:
on *:INPUT:#: {
  if ((/* !iswm $1) && (*: iswm $1)) {
    var %i = 1
    while ($nick($chan,%i)) {
      if ($replace($1,:,*) iswm $nick($chan,%i)) {
        msg $chan 6·7<4{6 $+ $nick($chan,%i) $+ 4}7>6·1 $2-
        halt
      }
      inc %i
    }
  }
}


EDIT:
The error: the code will use by default [b]":"[/ b] to trigger the nick completer, but when nick is named, not depart ":" default in mIRC.

How fix the bug?

Last edited by JuanAm; 24/11/14 05:28 PM. Reason: more information
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
I tried de-coding your code to see what kind of result you expected: Try this and tell me if this is what you wanted:
Code:
on *:INPUT:#: {
  if (: isin $1) {
    var %n $left($1,-1)
    var %f $fline(#,%n $+ *,0,1)
    while (%f) { 
      var %nick $fline(#,%n $+ *,%f,1).text
      msg # &b&k5 $+ %nick $+ &k&b&u:&u $2-
      dec %f
    }
  }
  halt
}


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
* Invalid format: $fline (line 4, script7.mrc)

Anyway, I wish the event is triggered when mentioning any nick, but without need to put ":" at the end of the nick.

EXAMPLE not work:
'James how are you?'

The code only works if I put
'James: how are you?'

This code works, but need to put ":" at the end of de nick
Code:
on *:INPUT:#: {
  if ((/* !iswm $1) && (*: iswm $1)) {
    var %i = 1
    while ($nick($chan,%i)) {
      if ($replace($1,:,*) iswm $nick($chan,%i)) {
        msg $chan 6¤3.11·13´6`9·4.13¤ $+ 1 $nick($chan,%i)  $+ 7¤3.11·13´6`9·4.11¤1 $2-
        halt
      }
      inc %i
    }
  }
}


This code I wish modificate to fix the bug smile

Last edited by JuanAm; 24/11/14 06:17 PM. Reason: more information
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Oh, I see.
That's not a bug at all, you specified it to work that way.
Code:
on *:INPUT:#: {
  if (%multi) {
    var %f $fline(#,$1 $+ *,0,1).text
    while (%f) {
      var %n $fline(#,$1 $+ *,%f,1).text
      msg # $effect(%n) $2- 
      dec %f
    }
  }
  else { 
    var %n $fline(#,$1 $+ *,1,1).text
    msg # $effect(%n) $2-
  }
  halt
}
menu channel { 
  $iif(%multi,$style(1)) Multi user : $iif(%multi,unset %multi,set %multi 1)
}
alias -l effect return 6¤3.11·13´6`9·4.13¤ $+ 1 $1 7¤3.11·13´6`9·4.11¤1
Try this and let me know if it's what you want. You can right click in a channel and enable "Multi user" so that if you type "nill" it will message the channel for each nick it matches. like Nillen, Nillens, Nillensbot etc.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
Originally Posted By: Nillen
Oh, I see.
That's not a bug at all, you specified it to work that way.
Code:
on *:INPUT:#: {
  if (%multi) {
    var %f $fline(#,$1 $+ *,0,1).text
    while (%f) {
      var %n $fline(#,$1 $+ *,%f,1).text
      msg # $effect(%n) $2- 
      dec %f
    }
  }
  else { 
    var %n $fline(#,$1 $+ *,1,1).text
    msg # $effect(%n) $2-
  }
  halt
}
menu channel { 
  $iif(%multi,$style(1)) Multi user : $iif(%multi,unset %multi,set %multi 1)
}
alias -l effect return 6¤3.11·13´6`9·4.13¤ $+ 1 $1 7¤3.11·13´6`9·4.11¤1
Try this and let me know if it's what you want. You can right click in a channel and enable "Multi user" so that if you type "nill" it will message the channel for each nick it matches. like Nillen, Nillens, Nillensbot etc.


Work only one user mode, but but after using the nick completation, everything I write out the nick completation, I do not really write.

I will write:
Peter
how
are you?

Returns:
Quote:
<pepito> 6¤3.11·13´6`9·4.13¤1 Peter 7¤3.11·13´6`9·4.11¤1
<pepito> 6¤3.11·13´6`9·4.13¤1 7¤3.11·13´6`9·4.11¤1
<pepito> 6¤3.11·13´6`9·4.13¤1 7¤3.11·13´6`9·4.11¤



If I enable "Multi user" error:* Invalid format: $fline (line 5, script7.mrc)
And, I can not keep writing the canal, after that error.

I will write:
Quote:

Peter Maria Pedro Juan
* Invalid format: $fline (line 5, script7.mrc)



Last edited by JuanAm; 24/11/14 06:49 PM.
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Ok, let's try not using $fline then. I dunno why it's not working for you, tested and worked fine for me. Anyway, try this code instead:
Code:
menu channel { 
  $iif(%multi,$style(1)) Multi user : $iif(%multi,unset %multi,set %multi 1)
}
alias -l effect return 6¤3.11·13´6`9·4.13¤ $+ 1 $1 7¤3.11·13´6`9·4.11¤1
on *:INPUT:#: {
  var %nicks $nick(#,0) 
  var %i 1
  while (%i <= %nicks) {
    var %nick $nick(#,%i) 
    if ($1 isin %nick) { 
      var %true 1
      msg # $effect(%nick) $2- 
      if (!%multi) halt 
    }
    inc %i
  }
  if (%true) halt
}
How does that work? It might be slow in channels with a high population.





Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
Originally Posted By: Nillen
Ok, let's try not using $fline then. I dunno why it's not working for you, tested and worked fine for me. Anyway, try this code instead:
Code:
menu channel { 
  $iif(%multi,$style(1)) Multi user : $iif(%multi,unset %multi,set %multi 1)
}
alias -l effect return 6¤3.11·13´6`9·4.13¤ $+ 1 $1 7¤3.11·13´6`9·4.11¤1
on *:INPUT:#: {
  var %nicks $nick(#,0) 
  var %i 1
  while (%i <= %nicks) {
    var %nick $nick(#,%i) 
    if ($1 isin %nick) { 
      var %true 1
      msg # $effect(%nick) $2- 
      if (!%multi) halt 
    }
    inc %i
  }
  if (%true) halt
}
How does that work? It might be slow in channels with a high population.


Don't work Multi user mode, does what a one user mode.

ONE USER MODE:
Quote:
<pepito> 6¤3.11·13´6`9·4.13¤1 Peter 7¤3.11·13´6`9·4.11¤1 Maria Juan


MULTI USER MODE:
Quote:
<pepito> 6¤3.11·13´6`9·4.13¤1 Peter 7¤3.11·13´6`9·4.11¤1 Maria Juan

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
I think you're misunderstanding my multi user statement. By multi user I mean if the first word matches more than one user: like Nill matches Nillen, Nillens and Nillensbot.

That code should work, but try this code as well, I updated the $fline code to make sure it actually hits a target. It should be a ton faster in big channels.
Code:
on *:INPUT:#: {
  if (%multi) {
    var %f $fline(#,$1 $+ *,0,1).text
    if (%f) {
      var %true 1
      while (%f) {
        var %n $fline(#,$1 $+ *,%f,1).text
        msg # $effect(%n) $2- 
        dec %f
      }
    }
  }
  else { 
    var %n $fline(#,$1 $+ *,1,1).text
    if (%n) { 
      var %true 1
      msg # $effect(%n) $2-
    }
  }
  if (%true) halt
}
menu channel { 
  $iif(%multi,$style(1)) Multi user : $iif(%multi,unset %multi,set %multi 1)
}
alias -l effect return 6¤3.11·13´6`9·4.13¤ $+ 1 $1 7¤3.11·13´6`9·4.11¤1

Works fine for me:
Quote:
<@nillens> Hello there, how are you?
<@nillens> 6¤3.11·13´6`9·4.13¤1 nillensbot 7¤3.11·13´6`9·4.11¤1 are you there?
<@nillens> 6¤3.11·13´6`9·4.13¤1 nillens 7¤3.11·13´6`9·4.11¤1 are you there?
<@nillens> Hello?
<@nillens> 6¤3.11·13´6`9·4.13¤1 nillensbot 7¤3.11·13´6`9·4.11¤1 ???
<@nillens> 6¤3.11·13´6`9·4.13¤1 nillens 7¤3.11·13´6`9·4.11¤1 ???


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
Originally Posted By: Nillen
I think you're misunderstanding my multi user statement. By multi user I mean if the first word matches more than one user: like Nill matches Nillen, Nillens and Nillensbot.

That code should work, but try this code as well, I updated the $fline code to make sure it actually hits a target. It should be a ton faster in big channels.
Code:
on *:INPUT:#: {
  if (%multi) {
    var %f $fline(#,$1 $+ *,0,1).text
    if (%f) {
      var %true 1
      while (%f) {
        var %n $fline(#,$1 $+ *,%f,1).text
        msg # $effect(%n) $2- 
        dec %f
      }
    }
  }
  else { 
    var %n $fline(#,$1 $+ *,1,1).text
    if (%n) { 
      var %true 1
      msg # $effect(%n) $2-
    }
  }
  if (%true) halt
}
menu channel { 
  $iif(%multi,$style(1)) Multi user : $iif(%multi,unset %multi,set %multi 1)
}
alias -l effect return 6¤3.11·13´6`9·4.13¤ $+ 1 $1 7¤3.11·13´6`9·4.11¤1

Works fine for me:
Quote:
<@nillens> Hello there, how are you?
<@nillens> 6¤3.11·13´6`9·4.13¤1 nillensbot 7¤3.11·13´6`9·4.11¤1 are you there?
<@nillens> 6¤3.11·13´6`9·4.13¤1 nillens 7¤3.11·13´6`9·4.11¤1 are you there?
<@nillens> Hello?
<@nillens> 6¤3.11·13´6`9·4.13¤1 nillensbot 7¤3.11·13´6`9·4.11¤1 ???
<@nillens> 6¤3.11·13´6`9·4.13¤1 nillens 7¤3.11·13´6`9·4.11¤1 ???


Ok, I thought that was used to appoint multiple different nicks at the same time.

smile

Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
I sent you a private message because malfunctioning code.

Example 1:
There is a nick named 'olivares' in the channel and if I digit the letter 'a' result:
¤. · '`· .¤olivares¤. · '`· .¤

Example2:
If a nick 'Osito_BoT' and digit 'b' and push enter result:
¤. · '`· .¤Osito_Bot¤. · '`· .¤

So the same thing happens if I digit the first letter of a nick, I can not write, because it shows the nick completation with the name of the nickname.



Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
That's "intended", you didn't request any length in the string so. This code should have exactly what you want
Code:
on *:INPUT:#: {
  if (%length !isnum) set %length 3
  if ($len($1) >= %length) { 
    if ($fline(#,$1 $+ *,0,1)) { 
      var %nicks $v1
      while (%nicks) {
        var %nick $fline(#,$1 $+ *,%nicks,1).text
        msg # $effect(%nick) $2- 
        if (!%multi) break
        dec %nicks
      }
      halt
    }
  }
}

menu channel { 
  Nick Fill
  .$iif(%multi,$style(1)) Multi user : $iif(%multi,unset %multi,set %multi 1)
  .Length ( $+ $iif(%length isnum,$v1,3) $+ ) : set %length $?="Enter length of string"
}
alias -l effect return 6¤3.11·13´6`9·4.13¤ $+ 1 $1 7¤3.11·13´6`9·4.11¤1




Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
I had already fixed the bug of your first code was on line 10.

I replaced this line:
Code:
if ($1 isin %nick) {


For this:
Code:
if ($findtok(%nick,$1,32)) { 

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Try using the latest script that uses $fline. It shouldn't give you any problems. Only thing I can think of is that it returns the last user first if you're using multi user. Such as
@Josephine
Joseph

If you type jos Hello there, it will use Joseph instead of Josephine. If you'd rather want it to start from the top I can change that too.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
The latest code works! smile

One only question: For what serving this part of the code?
Code:
.Length ( $+ $iif(%length isnum,$v1,3) $+ ) : set %length $?="Enter length of string"

What should I put there? "Enter length of string" ?

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Try right clicking in the channel. You don't need to edit the code at all. That part of the code sets the length, if you don't specify a length manually it will use 3 as the default value. If you happen to accidentally use a value that's not valid such as "asd" instead of a number it will detect that and use 3 as the default value as well.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
Can you help me in this post ?


Link Copied to Clipboard