mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2015
Posts: 7
S
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2015
Posts: 7
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=}

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
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.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
you "set -u30 %floodTest $+ $nick On"
but you read
$($+(%,floodTest.,$nick),2), you have a dot '.' in here which isn't present when setting.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Mar 2015
Posts: 7
S
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2015
Posts: 7
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!

Joined: Mar 2015
Posts: 7
S
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2015
Posts: 7
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!

Joined: Jan 2014
Posts: 107
M
Vogon poet
Offline
Vogon poet
M
Joined: Jan 2014
Posts: 107
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)
}

Joined: Mar 2015
Posts: 7
S
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2015
Posts: 7
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!

Last edited by SpiceWeasel; 29/03/15 06:08 PM.
Joined: Jun 2014
Posts: 248
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
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?

Joined: Mar 2015
Posts: 7
S
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2015
Posts: 7
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.

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
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.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Mar 2015
Posts: 7
S
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2015
Posts: 7
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!

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Err ?
The file should be in his $mircdir, not in the same folder as the sccript file.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Mar 2015
Posts: 7
S
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2015
Posts: 7
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!

Last edited by SpiceWeasel; 01/04/15 12:00 AM.

Link Copied to Clipboard