mIRC Home    About    Download    Register    News    Help

Print Thread
Page 2 of 4 1 2 3 4
hixxy #186566 23/09/07 09:02 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Issues. My bot-op help script if flooding the bot off the server. Is there a line I can add? Like /wait ten seconds or something, so that the bot pauses the script long enough not to get flooded off, and then continues?

Mpot #186567 23/09/07 09:22 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Use a timer.

Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
No clue how.

Joined: Jan 2006
Posts: 111
N
Vogon poet
Offline
Vogon poet
N
Joined: Jan 2006
Posts: 111
Put the helptext in a file and play the file to the server

/help /play

Last edited by noMen; 23/09/07 09:33 PM.
noMen #186575 23/09/07 09:38 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
So it'll read a line, wait, read a line, wait?

noMen #186576 23/09/07 09:40 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Should have read the post thoroughly, I didn't realise it was a file that needed to be delayed.

Then that is correct, use /play.

/play plays the file to a target with a delay, if you read the help file it will tell you.

Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Actually no, it wasn't a file, but now getting the advice on /play, I'm going to put it into a file. What should I set the delay at?

Mpot #186582 23/09/07 09:57 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
It depends on you really. And the server of course, you want a decent delay so the messages don't go snail slow but also you don't want to get flooded off.

Try a delay of 1750.

To test it: /play target file 1750

Change the target to whatever, same with the file.

Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
So

/play C:\IcyBot2\Scripts\bot-op_help.txt 1750

Would be the command?


Mpot #186586 23/09/07 10:20 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Sort of, you need a target if you are calling it from a script.

Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
on syscon:TEXT:!botop_help:{

}

Needs to msg the file C:\IcyBot2\Scripts\botop_help.txt to the $nick with the delay. Why isn't this working:

Code:
on syscon:TEXT:!botop_help:*:{
  play C:\IcyBot2\Scripts\op_help.text 1750
  halt
}

Last edited by Mpot; 23/09/07 11:47 PM.
Mpot #186593 24/09/07 12:03 AM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
This is not working. Why? (Yes, the access level syscon is taken care of)

Code:
on syscon:text:!join*:#:{
if ($2 ischan) { /notice $nick I'm already on $2 | halt }
if ($3 == $null) { /join $2 | /notice $nick Join attempt on $$2 complete. | /write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $$1 $$2 on $chan | halt }
if ($3 != $null) { /join $2 $3 | /notice $nick Join attempt on $$2 with password $$3 complete. | /write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $$1 $$2 on $chan | halt }
}

Mpot #186594 24/09/07 12:08 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
on syscon:TEXT:!botop_help:*:{
  play $nick C:\IcyBot2\Scripts\op_help.text 1750
  halt
}

Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Any idea what's wrong with the !join?

Mpot #186600 24/09/07 03:16 AM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Many networks won't get you flooded if you do a delay of 1000 or 1250. However, if you might also be saying other things at the same time, then is where you may get flooded at the lower delays. So 1750 or 2000 is safer, but also takes longer. If you have a lot of lines to display, 2 seconds per line makes a 30 line file take a minute to display, which becomes problematic.

As for your !join script, I see you still aren't listening to advice given to you multiple times. You don't need /'s and you should use ELSEIF when two or more IF statements will not ever both be true (such as $3 == $null and $3 != $null). Of course, in that case, it's only 2 possibilities so you can just use ELSE instead of ELSEIF for that one. Also, you shouldn't use HALT when it isn't needed. You'll only need to halt the script on the first IF and you should use RETURN instead of HALT there. The other two do not need to be halted and should use ELSE as mentioned for the last IF.

As to why it won't work, what are you testing and what isn't working?


Invision Support
#Invision on irc.irchighway.net
Riamus2 #186622 24/09/07 11:40 AM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
I can't say I'm sure of when a script needs to be halted, or when it's going to halt itself, it seems safer to just add the line than to not. I can't see it hurting anything. Furthermore, when several if statements works just as well as ifelse and else, why use them and create something more confusing? The idea of my scripts most of the time isn't absolute speed, functionality, or properness. They're about me being able to understand them, how I wrote them, know exactly what they do, and they do what I want.

Mpot #186623 24/09/07 11:45 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Quote:
and they do what I want.


You just said your Join Text event doesn't work.

Joined: Jan 2006
Posts: 111
N
Vogon poet
Offline
Vogon poet
N
Joined: Jan 2006
Posts: 111
Originally Posted By: SladeKraven
Quote:
and they do what I want.


You just said your Join Text event doesn't work.


Thats why he asks questions smile

But Mpot has a point:
Originally Posted By: Mpot
Quote:
They're about me being able to understand them, how I wrote them, know exactly what they do, and they do what I want.

Some discussions on this forum are about speed. Benchmarking shows that executing a certain command 20.000 times takes 1024 milisecs and executing a similar command only 800 msec. But did anybody ever make a script that does the same thing 20.000 times? On modern PC's the speed of a script is not an issue. Understanding your script is more important, although I never would use a script that was written in the way Mpot proposes ....

noMen #186675 24/09/07 08:34 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
I was able to get my on !join working perfectly, but I'd like more in it. For instance, instead of just msging Join attempted, it would tell you wether or not the attempt working. I don't know the commands for interpreting data from Services.

Current script:

Code:
;Bot controls

;Part
on syscon:text:!part*:?:{
  if ($2 == $null) { /notice $nick Specify channel. | halt }
  if ($2 !ischan ) { /notice $nick I'm already off $$2 $+ . | halt }
  if ($2 != $null) { /part $2 | /notice $nick Parted $$2 $+ . | /write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $$1 $$2 via msg | halt } 
}

on syscon:text:!part*:#:{
  if ($2 == $null) { /part $chan | msg $chan Parted $chan $+ . | /write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $$1 on $chan| halt }
  if ($2 !ischan ) { msg $chan I'm already off $$2 $+ . | halt }
  if ($2 != $null) { /part $2 | msg $chan Parted $$2 $+ . | /write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $$1 $$2 on $chan | halt } 
}
;Join
on syscon:text:!join*:?:{
  if ($2 == $null) { /notice $nick Specify channel. | halt }
  if ($3 == $null) { goto ?$3null }
  :?$3null
  if ($2 ischan) { /notice $nick I'm already on $$2 $+ . | halt }
  if ($3 != $null) { /join $$2 $$3 | /notice $nick Join attempt on $$2 with key $$3 complete. | /write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $$1 $$2 with key $$3 via msg | halt }
  if ($2 != $null) { /join $$2 | /notice $nick Join attempt on $$2 complete. | /write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $$1 $$2 via msg | halt }
}

on syscon:text:!join*:#:{
  if ($2 == $null) { msg $chan Specify channel. | halt }
  if ($3 == $null) { goto ?$3null }
  :?$3null
  if ($2 ischan) { /notice $nick I'm already on $$2 $+ . | halt }
  if ($3 != $null) { /join $$2 $$3 | msg $chan Join attempt on $$2 with key $$3 complete. | /write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $$1 $$2 with key $$3 via msg | halt }
  if ($2 != $null) { /join $$2 | msg $chan Join attempt on $$2 complete. | /write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $$1 $$2 via msg | halt }
}

; #uranme part
on uranmepart:text:!leave_uranme:*:{
  if ($me ischan #uranme) { /part #uranme | /notice $nick Parted #uranme | halt }
  if (me !ischan #uranme) { /notice $nick I'm not on #uranme. | halt }
}



Last edited by Mpot; 24/09/07 08:37 PM.
Mpot #186678 24/09/07 08:49 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Originally Posted By: Mpot
I can't say I'm sure of when a script needs to be halted, or when it's going to halt itself, it seems safer to just add the line than to not. I can't see it hurting anything. Furthermore, when several if statements works just as well as ifelse and else, why use them and create something more confusing? The idea of my scripts most of the time isn't absolute speed, functionality, or properness. They're about me being able to understand them, how I wrote them, know exactly what they do, and they do what I want.


A script halts automatically when nothing else is in it or when nothing else will run (ie. You just did an IF that matched, so an ELSE that follows it won't run). So there's no reason to halt a script in these situations. And, as mentioned, don't use HALT anyhow. Use RETURN. Others can get into the reasons why using HALT for this form of halting can cause problems, but you should avoid using HALT for this type of halting.

As far as IF/ELSEIF/ELSE, yes it does affect speed, but that's not why I said that you should use it. If you look at my posts in topics that discuss speed, you'll find that I often point out that minor speed improvements aren't really that important. The main reason, imo, that you should use IF/ELSEIF/ELSE is just what you said... ease of understanding. If all you see are a lot of IFs, then you will have to go through and read every single one to figure out what needs done or not done. If you have IF followed by 6 ELSEIFs and then an ELSE at the end, you know automatically that you can ignore the rest if the first IF matches, or ignore everything after the first ELSEIF if that matches, and so on. ELSEIF isn't any more difficult to understand and it prevents you from having to TRY to understand it in the first place if you know that you already matched the IF or ELSEIF before it.

Trust me, you should always try to learn and use good and efficient programming/scripting methods at all times even if they are confusing to you when you're learning. Otherwise you get into bad habits that can make your scripts harder to understand and more prone to bugs and problems than you would otherwise have. That isn't to say that you need to do the most efficient method every time (ie. you don't have to use regex if you don't know how to if you can use another method instead). It does mean that if you know how to do something mroe efficiently and you're choosing not to just because you don't feel like it, *that* is when it's a bad idea.


Invision Support
#Invision on irc.irchighway.net
Page 2 of 4 1 2 3 4

Link Copied to Clipboard