mIRC Homepage
Hello everyone! o/

I am trying to get a bot to read a random line from a text file. Nothing too out of the ordinary there.

It even does work, but not at first or after as little as 10 minutes of bot inactivity. But once "activated", it will return a line from the text file without issues.

Example:

A relevant command will be entered and the bot will not do anything. Wait for the flood control to expire, do the exact same command, now the bot will respond correctly.

Now, if the bot goes inactive, when you try the command again, it will not respond. Starting the above process over.

The status window in mIRC says "/msg: insufficient parameters (line 15, remote.ini)" for the time that nothing happens. But will not show any errors for the time it does work (makes sense lol).

This is driving me crazy, as it does technically work. Thoughts?

n10=on *:text:*Test*:#: {
n11= if ((%floodTest) || ($($+(%,floodTest.,$nick),2))) { return }
n12= set -u10 %floodTest On
n13= set -u30 %floodTest $+ $nick On
n14= msg $chan $read(Test.txt)
n15=}
Not sure if this will help your issue, but 2 things you should do.

1) Save the file with a .mrc extension. Do not use .ini when saving scripts.

2) $read(Test.txt,n) -- use 'n' to prevent parsing evaluation of the text read from the script. Otherwise characters like '$' and '%' can cause errors.
you "set -u30 %floodTest $+ $nick On"
but you read
$($+(%,floodTest.,$nick),2), you have a dot '.' in here which isn't present when setting.
Originally Posted By: Raccoon
Not sure if this will help your issue, but 2 things you should do.

1) Save the file with a .mrc extension. Do not use .ini when saving scripts.


The .ini extension is the default mIRC is using for the scripts. Wasn't part of my doing.

Do you suggest changing it?

Originally Posted By: Raccoon
2) $read(Test.txt,n) -- use 'n' to prevent parsing evaluation of the text read from the script. Otherwise characters like '$' and '%' can cause errors.


Right, thank you. Don't need to make things harder on ourselves, right? lol

Also, which part of New Mexico are you in? I'm born and raised here.

Originally Posted By: Wims
you "set -u30 %floodTest $+ $nick On"
but you read
$($+(%,floodTest.,$nick),2), you have a dot '.' in here which isn't present when setting.


I was under the impression the period then comma was a part of the flood control scripting and wasn't necessarily supposed to be a part of the command itself.

Never-the-less, I can go in and add the period and give things a test.

Thanks for the help so far guys!
All right, I was able to test out two changes, to no avail.

I added the n to the read command, so that's good. Wasn't really expecting that one to to actually resolve the issue, but more just make the command coded more correctly.

Second, I added the period to:

set -u30 %floodTest $+ $nick On

To match the period in $($+(%,floodTest.,$nick),2) since again, I was under the impression it's supposed to be there for proper coding of the script.

Still no good though, so we're mostly still at square one.

Any other ideas or things for me to try are welcome!
I use the following as a "random fact" command for my bot. Works without problems. Just have to create your own fact file (which I saved in my mIRC folder). Feel free to use this and edit it to do whatever you want it to do on your bot.

Code:
ON *:TEXT:!fact:#: { 
  if ((%floodfact) || ($($+(%,floodfact.,$nick),2))) { return }
  set -u15 %floodfact. $+ $nick On
  msg $chan RANDOM FACT: $read(randomfact.txt,n)
}
Originally Posted By: Majeye
I use the following as a "random fact" command for my bot. Works without problems. Just have to create your own fact file (which I saved in my mIRC folder). Feel free to use this and edit it to do whatever you want it to do on your bot.

Code:
ON *:TEXT:!fact:#: { 
  if ((%floodfact) || ($($+(%,floodfact.,$nick),2))) { return }
  set -u15 %floodfact. $+ $nick On
  msg $chan RANDOM FACT: $read(randomfact.txt,n)
}


Thank you.

I'm giving it a test right now. After about 25 minutes of inactivity, it worked. Then it didn't work 40 seconds later.

I'm going to keep testing periods of inactivity and we'll see how things go.

Question, you don't use a global floodcontrol timer?


EDIT: Waited for 30+ minutes, didn't work. Says the error is on line 14 now, after removing the global flood control.

Quite the doozy we have here, boys!
Originally Posted By: Majeye
I use the following as a "random fact" command for my bot. Works without problems. Just have to create your own fact file (which I saved in my mIRC folder). Feel free to use this and edit it to do whatever you want it to do on your bot.

Code:
ON *:TEXT:!fact:#: { 
  if ((%floodfact) || ($($+(%,floodfact.,$nick),2))) { return }
  set -u15 %floodfact. $+ $nick On
  msg $chan RANDOM FACT: $read(randomfact.txt,n)
}


Why do you check for %floodfact and never set %floodfact?
On that note, the problem continues if I even remove the flood control.

If I remove the read() script and just make the bot say one thing, it works without problem. This, to me, narrows the problem down to the read() stuff, but it's obviously more difficult than that if no one here is willing to give it a shot.

I'm quite stumped and no one else I've contacted seems to have any clue either.
the file should be in the same folder as the script itself. otherwise you will need to provide a correct full/relative path to the file.
I believe I have discovered and fixed the problem!

Basically, in my text file, there was a blank line between each of the desired lines. Hitting enter twice at the end of a desired line.

I have removed the blank lines, saved, and now have had a 100% success rate.

I knew it was going to be something simple and embarrassing. I could have sworn there was supposed to be a blank line between them. Guess not!

I'll report back if it starts failing again, but I'm confident we got this one in the bag. Thanks everyone for your help and time!
Err ?
The file should be in his $mircdir, not in the same folder as the sccript file.
It's in the standard AppData\Roaming\mIRC folder, no worries.

Everything was being done correctly and in spite of the less accurate tips, I got it sorted out.

Thanks again!
© mIRC Discussion Forums