mIRC Home    About    Download    Register    News    Help

Print Thread
#204726 29/09/08 12:04 PM
Joined: Sep 2008
Posts: 4
D
DNL Offline OP
Self-satisified door
OP Offline
Self-satisified door
D
Joined: Sep 2008
Posts: 4
Hello (again),

Now that my link handling issue is fixed I have another question.
How do I make mIRC search within a certain .ini file to see if words in a message matches keywords in the file?

I've tried something useless as
Code:
on *:TEXT:*:#:{
  if (readini(db.ini,Words,CertainWords) == $1-) {
    echo Yay, found it!
  }
}


The .ini contains the following text
Code:
[Words]
CertainWords=Cheese
CertainWords=Pizza

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Ini files cannot contain more than one instance of the same ITEM within a single TOPIC. mIRC's ini commands will only find the first ITEM with a particular name. You need to name your ITEMs differently than each other (ie. sequential numbers) or separate identical ITEMs by putting them in different TOPICs. Example:

[TOPIC]
ITEM01=data01
ITEM02=data02
ITEM03=data03
ITEM04=data04
ITEM05=data05

or

[TOPIC01]
ITEM=data01
[TOPIC02]
ITEM=data02
[TOPIC03]
ITEM=data03
[TOPIC04]
ITEM=data04
[TOPIC05]
ITEM=data05

You can then loop through each ITEM using a while-loop and the $ini and $readini identifiers.

-genius_at_work

Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Why use a ini file? a *.txt or *.dat let you search true the file.

;---------- edit

maybe something like this
Usage: /testar word
Code:
alias testar {
  if ($gettok($read($qt($mircdirfile.dat), w, * $+ $1- $+ *),1,44) == $1) { $gettok($read($qt($mircdirfile.dat), w, * $+ $1 $+ *),2,44) }
}

By change the 2 the last part ,2,44) you can get diffrent replyes to the word, and you can use inc and the a %var instead of clean numbers.


Code:
on *:text:*:#: { {
  if ($gettok($read($qt($mircdirfile.dat), w, * $+ $1- $+ *),1,44) == $1) { echo -a $gettok($read($qt($mircdirfile.dat), w, * $+ $1 $+ *),[color:red]2[/color],44) }
}

The last code are triggered by the word in the file on a channel.

The file should look like:

word,word2,word3

word = trigger.
word2 = the 2 in the code you can change.

;--------- edit

played around a bit with the code.
Code:
on *:TEXT:*:#:{ {
    if (%flood) { halt }
    if ($gettok($read($qt($mircdirfile.dat), w, * $+ $1 $+ *),1,44) == $1) {
      if (%fpro = 3) { set -u5 %flood 1 | echo -a Ignoring for 5 sec. | unset %fpro }
      inc %fpro
      inc %xx
      if ($gettok($read($qt($mircdirfile.dat), w, * $+ $1 $+ *),%xx,44) == $null) { set %xx 2 }
      { msg $chan $gettok($read($qt($mircdirfile.dat), w, * $+ $1 $+ *),%xx,44) }
    }
  }
}

Last edited by sparta; 29/09/08 06:23 PM.

if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Link Copied to Clipboard