So, my friend "dev" came up with this idea, where our bot quotes random stuff that we said from a log at random times. It seems a simple idea when you think about it, but once you start scripting it's sort of hard to imagine how it will do it. Well this is how it was for me. Until bam - it hit me.
Instead of reading from the regular channel log that mIRC creates, it will read from a log that the script creates, because the standard mIRC log comes with timestamps and nicknames, and stripping them will take way too much effort in scripting, though, I am quite positive that someone with tons more skill than my basic skills can do so.
Now this script assumes that you have the text file already in the mIRC directory.
It will generate two random numbers and compare them, if both numbers match, it does a random say. This is to ensure that it doesn't do it very often, which can get annoying.
Feel free to adjust the values. Higher values will reduce the amount of times a number will match. Reducing of course means a higher matching rate.
Simple right?
** Use as is if you want. Just give credit to myself and devSaturnine
*** Modify it if you want, just give us credit, and let me know.
Written for mIRC 6.35.
on 1:TEXT:*:#channel_name: {
; Logs whatever is said in the channel to the RandomSay.txt file
write -i RandomSay.txt $1-
; Generates a random number
var %r = $rand(1,166)
; Generates another random number
var %r2 = $rand(1,180)
; Sets the variables with the two random numbers
set %randomtalk %r
set %randommatch %r2
; If both random numbers corresponds, then it does the say with a random line from
; the text file.
if (%randomtalk == %randommatch) .msg #channel_name $read(RandomSay.txt)
.echo ** The current variable is %randomtalk and we are looking for %randommatch
}
Would there be a way to have this work across many different channels? I've tried just copying and pasting it on different lines and changing the channel, but that doesn't seem to work. Also tried $chan, but that will just go to one channel every time.
I used this for my twitch bot that I let my friends have access too, any help would be greatly appreciated! ^^
Oh, you meant the say part. Hmm, that's quite an interesting proposition. I'll have to think about that. Technically it should do it for the chan in which it was triggered. Unless mIRC only sends to the chan that is in focus.
Edit: You could try adding a var %ch = $chan (just below the write).
Then in the random match area, change #channel_name to %ch (that should do the trick).
on 1:text:*:#: {
That should do the trick.