Okay, so dev came up with the idea to have Red_Queen read random text from a log and at a random time have her send this text to the channel.

It sounds simple, but damn, it was a mission coming up with the code, which in itself ended up being simple. Go figure.

Now there currently isn't an example for this on the net, all the examples available relies on a specific !trigger and timer, which isn't what we wanted. Also, reading from the mIRC generated log would cause issues, as it logs the timestamps and nicknames, something that we don't want our Red_Queen repeating, and the code to strip those would just over complicate things. So I created 1 event that would log text from the channel and write it to a specified text file. It will also generate a random number between 1 and 8, then it will check if the random number equals the number that I specified for it to do the random say.

This is the actual code: (with added comments)

on 1:text:*:#vampyres_cathedral: {
; First write whatever anyone says in the channel to the RandomSay.txt file in the mirc directory.
  write -i RandomSay.txt $1-

; Generates a random value between 1 and 8. Then set the %r variable to this number.
; Then set the %randomtalk variable to the randomly generated number in the %r variable.
  var %r = $rand(1,8)
  set %randomtalk %r

; This checks if the randomly generated number is the number I specified for it to do the say
; on, which is 6, if so - then perform the say. 
; The echo is not needed, I only use it to check how often the number 6 is generated.
  if (%randomtalk == 6) .msg #vampyres_cathedral $read(RandomSay.txt)
  .echo ** The current variable is %randomtalk and we are looking for 6

If anyone wants to reuse this code, leave a comment, or contact me using the contact form. But feel free, just remember to credit NickLeStrange and devSaturnine.

**Update 09/01/2013

So, I have updated the randomization a bit more. Instead of making the number to match a static number, it's
now also a random number.

Here it is:

on 1:TEXT:*:#vampyres_cathedral: {
  write -i RandomSay.txt $1-
  var %r = $rand(1,40)
  var %r2 = $rand(1,60)
  set %randomtalk %r
  set %randommatch %r2
  if (%randomtalk == %randommatch) .msg #vampyres_cathedral $read(RandomSay.txt)
  .echo ** The current variable is %randomtalk and we are looking for %randommatch

Read More …