mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2023
Posts: 6
O
ontext Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Aug 2023
Posts: 6
Hello, currently i have this ontext

on 1:TEXT:*word*:#channel: { if ( $nick == nick) { Window -e @WORD | echo @WORD $timestamp $1- | haltdef } }


i have multiple of this example,
e.g.
on 1:TEXT:*word*:#channel: { if ( $nick == nick) { Window -e @WORD | echo @WORD $timestamp $1- | haltdef } }
on 1:TEXT:*word1*:#channel: { if ( $nick == nick) { Window -e @WORD | echo @WORD $timestamp $1- | haltdef } }
on 1:TEXT:*word2*:#channel: { if ( $nick == nick) { Window -e @WORD | echo @WORD $timestamp $1- | haltdef } }


can i combine all of my triggers in one script? also, how i can insted to create a popup window, to send them in a channel

thanx in advance!

Joined: Jul 2006
Posts: 4,164
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,164
You can use if (*word* iswm $1-) || (*word1* iswm $1-) || (*etc* iswm $1-) {Just replace @word by $chan in the /echo command to display in the channel


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Aug 2023
Posts: 6
O
ontext Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Aug 2023
Posts: 6
Originally Posted by Wims
You can use if (*word* iswm $1-) || (*word1* iswm $1-) || (*etc* iswm $1-) {Just replace @word by $chan in the /echo command to display in the channel

thank for the response, so the command goes something like that:

on 1:TEXT:if (*word* iswm $1-) || (*word1* iswm $1-) || (*etc* iswm $1-) {:#channel { if ( $nick == nickname ) { Window -e @TEST | echo @TEST $timestamp $1- | haltdef } }

?

Joined: Jul 2006
Posts: 4,164
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,164
No, I was giving the /if structure only, you still have to use the appropriate on text event:

on *:TEXT:*:#channel:{
if (*word* iswm $1-) || (*word1* iswm $1-) || (*etc* iswm $1-) {
if ($nick == nickname) {
window -e @TEST | echo @TEST $timestamp $1-
}
}
}


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Aug 2023
Posts: 6
O
ontext Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Aug 2023
Posts: 6
workd like a charm, thank you very much!

Joined: Aug 2023
Posts: 6
O
ontext Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Aug 2023
Posts: 6
it is poosible on the above script, to read the words from a file?
i want to add many words e.g. if (*word* iswm $1-) || (*word1* iswm $1-) || (*etc* iswm $1-) {
its more easy to me to have a .txt for an example with the keywords, on per line

thanx in advance!

Joined: Jul 2006
Posts: 4,164
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,164
It's possible but it's not very efficient

on *:text:*:#channel:{
var %a 1,%b $lines(listofexpr.txt)
while (%a <= %b) {
if ($read(listofexpr.txt,tn,%a) iswm $1-) {
if ($nick == nickname) {
window -e @TEST
echo @TEST $timestamp $1-
return
}
}
inc %a
}
}
The file listofexpr.txt must be placed in $mircdir

This can be made faster but if you only have a couple of small expression in the file it should be fine.
The best would be to use $hfind(,,W,<N>) function on item, and adding expression as item without data and saving only item to the text file, resulting in one expression per line I believe.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jan 2012
Posts: 316
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 316
Originally Posted by ontext
it is poosible on the above script, to read the words from a file?
i want to add many words, its more easy to me to have a .txt for an example with the keywords, on per line


Try to use this script code:
Code
on *:TEXT:*:#channel:{
  var %file = $mircdir\words.txt
  var %i 1 | while (%i <= $lines(%file)) {
    if ($read(%file,nt,%i) iswm $strip($1-)) {
      if ($nick == UserNick) {
        if (!$window(@TEST)) window -e @TEST $mircexe 21
        aline -h @TEST $timestamp $+($nick,:) $1-
      }
    }
    inc %i
  }
}

The variable "%file" contains the path to the file "$mircdir\words.txt" - you can change this to any other path.

The file "words.txt" contains on each line word-mask with wildcards. It must be filled in as follows:
Quote
*word*
*test*
*hello*
*etc*


🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Aug 2023
Posts: 6
O
ontext Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Aug 2023
Posts: 6
Originally Posted by Epic
Originally Posted by ontext
it is poosible on the above script, to read the words from a file?
i want to add many words, its more easy to me to have a .txt for an example with the keywords, on per line


Try to use this script code:
Code
on *:TEXT:*:#channel:{
  var %file = $mircdir\words.txt
  var %i 1 | while (%i <= $lines(%file)) {
    if ($read(%file,nt,%i) iswm $strip($1-)) {
      if ($nick == UserNick) {
        if (!$window(@TEST)) window -e @TEST $mircexe 21
        aline -h @TEST $timestamp $+($nick,:) $1-
      }
    }
    inc %i
  }
}

The variable "%file" contains the path to the file "$mircdir\words.txt" - you can change this to any other path.

The file "words.txt" contains on each line word-mask with wildcards. It must be filled in as follows:
Quote
*word*
*test*
*hello*
*etc*

i think its works perfectly! thank you very much!


Link Copied to Clipboard