mIRC Homepage
Posted By: LostServ TEXT Help - 15/06/04 08:09 PM
How can I have the trigger of like
on 1:TEXT:*word*:#:commands
be read from a text file so that *word* could be any word in the txt file?
Posted By: Online Re: TEXT Help - 15/06/04 08:45 PM
Create an INI file with the following content:
  • [hashtable]
    *word1*=
    *word2*=
    *word3*=
When the bot joins its channel, the INI file will be loaded into the memory:
  • On me:*:join:#channel:{
    if $hget(keys) { hfree keys }
    hmake keys
    hload -i keys file.ini
    }
Whenever somebody speaks in the channel, the items in the memory will me matched against the text, to see if it contains any of the triggers you defined:
  • On *:text:$($hfind(keys,$1-,1,W)):#channel:{
    msg # $matchkey matched your text.
    }
Posted By: LostServ Re: TEXT Help - 15/06/04 08:49 PM
Quote:
On *:text:$($hfind(keys,$1-,1,W)):#channel:{
msg # $matchkey matched your text.
}


what does $matchkey return?
Posted By: Online Re: TEXT Help - 15/06/04 08:53 PM
$matchkey holds the value that $hfind() returned, i.e. the trigger that matched the sentence in question.
Posted By: LostServ Re: TEXT Help - 15/06/04 09:00 PM
Wow, it works great Online, thanks!
Posted By: Online Re: TEXT Help - 15/06/04 09:06 PM
You're welcome
Posted By: LostServ Re: TEXT Help - 15/06/04 09:16 PM
I have a question, say I was to make a dialog, how would I fix it where the user could add/remove words to the trigger list (file.ini)

//edit\\ I have no experience with writing raw dialog code
I use to use a stuido editor thing, but dont have it anymore and i've frogotten where to get it and the name of it..kinda sad//edit\\
Posted By: Online Re: TEXT Help - 15/06/04 10:23 PM
Try this code: http://members.lycos.co.uk/onln/files/keywords.txt

Type /editor to bring the keywords dialog.

Note that file [keys.txt] has a different format now:
  • *word1*<LF><LF>*word2*<LF><LF>*word3*<LF><LF>
But it doesn't really matter because all editing will be done from the dialog.
Posted By: Online Re: TEXT Help - 15/06/04 10:26 PM
Btw, the Dialog Studio and a couple of other editors are available here.
© mIRC Discussion Forums