Originally Posted By: Micahnameistaken
But this requires me to make multiple *.txt files, is there a way to make it use lines in a *.txt file? If the script is complicated, that's quite alright. I can always just stuff them into a folder for sorting purposes.


One possible method would be to use an INI file with everything in it...

Code:
on *:text:*:#: {
  if (Micah isin $1- && program isin $1- && ink isin $1-) {
    var %r = $rand(1,$ini(replies.ini,topic1,0))
    msg $chan $readini(replies.ini,topic1,%r)
  }
  elseif (coffee isin $1-) {
    var %r = $rand(1,$ini(replies.ini,topic2,0))
    msg $chan $readini(replies.ini,topic2,%r)
  }
}


Repeat the ELSEIF section as needed, changing only the comparison and the topic name (i.e. topic2). Note that the topic names can be anything you like... I just used "topic1" and "topic2" as generic topic names. Make them fit whatever your matchtext is. Now, your INI file would look like this:
Quote:

replies.ini
[topic1]
1=Reply 1
2=Reply 2
3=Reply 3
[topic2]
1=Reply 1
2=Reply 2
3=Reply 3


And so on. Make sure to number the lines in the topic from 1 to whatever number of replies there are in each topic or you'll run into problems. It will randomly read one of the items in the chosen topic. Remember that if you only need a single reply to a given matchtext, you can always just put that in the msg line without using $read or $readini. These methods are only if you want to have more than one possible response for variety.

Originally Posted By: Micahnameistaken

So, eh... I guess you wouldn't happen to know the code for a rather long and complicated seen script?

Seriously, I know this question is like pretty insane, but anyway here's the general layout on what I has on my mind. I'm not that into coding, so I'll use words out of context.

on ".seen WORD" (The seen script idea), reply with: WORD was last seen [RANDOM generated sentence from a list.]

Example:
SomeGuy: .seen Pikachu
Micah: Pikachu was last seen (Start) being eaten by Raptorjesus.

Where "being eaten by Raptorjesus" is on, for example, line 31 in a txt file. Is this possible at all? shocked I'll gladly make a new topic about it if that suits you better, _IF_ you know how to help.

Thanks again, sorry to ask so much. This one is only for a funny purpose, so it's not important. smile


As far as this goes, if you just want to use a specific list of responses for a specific list of words, you can do the same thing as the script above. Just put .seen* in the matchtext on the on TEXT line instead of just *. Remember to put it in a separate script file to avoid conflicts between multiple on TEXT events. Technically, you could put the .seen one at the top of the script file, but separate is easier. smile

If you want to capture text from within the channel and use it in this way, you'll want to either use your logs or else write the lines of text (all or just random lines) into a file and then use $read with the "w" option for wildcard matching to find lines that include the word(s) that you want to find. That would not be an easy script to make, and I don't think that's what you wanted anyhow, based on what you wrote.

In either case, you can use DJ_Sol's suggestion for including random nicks in this script if desired as well. Just include the $nick(...) part in the msg line in this script to include a random nick from the channel. (Just add one more closing parentheses in it that was missed... see below). And, if you only want the nicks to be Regular users (those who aren't voiced/opped/etc), adjust it to be:

$nick($chan,$rand(1,$nick($chan,0,r)),r)

"r" is for Regulat only (notice it's there twice).

To include voices, use "v". For ops, use "o". You can also combine multiple such as "rv". (No quotes, of course). Leaving out the letter as shown below will randomly select a nick out of everyone in the channel.

$nick($chan,$rand(1,$nick($chan,0)))

Last edited by Riamus2; 13/01/08 01:21 AM.

Invision Support
#Invision on irc.irchighway.net