mIRC Home    About    Download    Register    News    Help

Print Thread
$read() command will not respond if inactive #252216 28/03/15 03:45 AM
Joined: Mar 2015
Posts: 7
S
SpiceWeasel Offline OP
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=}

Re: $read() command will not respond if inactive [Re: SpiceWeasel] #252218 28/03/15 10:15 AM
Joined: Feb 2003
Posts: 2,685
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,685
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!
Re: $read() command will not respond if inactive [Re: SpiceWeasel] #252222 28/03/15 11:48 AM
Joined: Jul 2006
Posts: 3,656
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,656
you "set -u30 %floodTest $+ $nick On"
but you read
$($+(%,floodTest.,$nick),2), you have a dot '.' in here which isn't present when setting.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: $read() command will not respond if inactive [Re: Wims] #252229 28/03/15 03:46 PM
Joined: Mar 2015
Posts: 7
S
SpiceWeasel Offline OP
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!

Re: $read() command will not respond if inactive [Re: SpiceWeasel] #252230 28/03/15 07:19 PM
Joined: Mar 2015
Posts: 7
S
SpiceWeasel Offline OP
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!

Re: $read() command will not respond if inactive [Re: SpiceWeasel] #252234 29/03/15 05:03 AM
Joined: Jan 2014
Posts: 101
M
Majeye Offline
Vogon poet
Offline
Vogon poet
M
Joined: Jan 2014
Posts: 101
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)
}

Re: $read() command will not respond if inactive [Re: Majeye] #252241 29/03/15 05:33 PM
Joined: Mar 2015
Posts: 7
S
SpiceWeasel Offline OP
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.
Re: $read() command will not respond if inactive [Re: Majeye] #252251 30/03/15 03:37 AM
Joined: Jun 2014
Posts: 248
B
Belhifet Offline
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?

Re: $read() command will not respond if inactive [Re: Belhifet] #252258 30/03/15 09:42 PM
Joined: Mar 2015
Posts: 7
S
SpiceWeasel Offline OP
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.

Re: $read() command will not respond if inactive [Re: SpiceWeasel] #252259 30/03/15 10:22 PM
Joined: Feb 2003
Posts: 2,685
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,685
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!
Re: $read() command will not respond if inactive [Re: SpiceWeasel] #252260 31/03/15 03:55 AM
Joined: Mar 2015
Posts: 7
S
SpiceWeasel Offline OP
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!

Re: $read() command will not respond if inactive [Re: Raccoon] #252267 31/03/15 12:49 PM
Joined: Jul 2006
Posts: 3,656
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,656
Err ?
The file should be in his $mircdir, not in the same folder as the sccript file.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: $read() command will not respond if inactive [Re: Wims] #252277 01/04/15 12:00 AM
Joined: Mar 2015
Posts: 7
S
SpiceWeasel Offline OP
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.