Simple way of telling your bot to join or part a channel. Copy and paste into your script editor and have fun.
To set yourself as owner of the bot just type /set %owner without the "<>'s" in your bots mIRC
on 1:NOTICE:join*:?: {
if ($nick == %owner) {
JOIN $2 | .timer 1 3 msg $nick 6,1 I have joined $2
}
elseif ($nick !== %owner) {
/NOTICE $nick 4ACCESS DENIED!
}
}
on 1:NOTICE:part*:?: {
if ($nick == %owner) {
/PART $2 | .timer 1 3 msg $nick 6,1I Have Left $2
}
elseif ($nick !== %owner) {
/NOTICE $nick 4ACCESS DENIED!
}
}
on 1:TEXT:`join*:#: {
if ($nick == %owner) {
/JOIN $2 | .timer 1 3 msg $nick 6,1I Have Joined $2 }
elseif ($nick !== %owner) {
/NOTICE $nick 4ACCESS DENIDED NUB!!:|
}
}
on 1:TEXT:`part*:#: {
if ($nick == %owner) {
/PART $2 | .timer 1 3 msg $nick 6,1I Have Left $2
}
elseif ($nick != %owner) {
/NOTICE $nick 4ACCESS DENIDED NUB!! :|
}
}
jaytea! You're like a district attorney ready to represent the "prosecution" of any irreconcilable differences you've come across in any thread. Granted, I've been too meticulously judgemental of an example that I see as being unfit to my standard, but let's not to say I have the correct understanding or logic toward it. I really should cut myself some slack sometimes and not bag on any person and mind my own business. :P
The old post was bumped out of the circumstantial needs, where the user PyThOn caught my eye for unwarranted comments. Then Mr. Dean ensued his favorable teachings and everything just "went down the drain" from that point on.
Dean's version:
$read(file.txt,$rand(1,$lines(file.txt)))
Jethro's version:
$read(file.txt)
these are not the same, just as those 2 on TEXT events are not the same. aside from the obvious extra '$' in Dean's code, remember that '\s' also matches a tab, and '/join#chan' is obviously an incorrect command. but this is such a minor detail that i almost feel silly pointing it out ;P
if i see someone post a code that is simple and serves as a decent example given the overall circumstances, and i notice that it is not perfectly accurate and liable to fail on approximately 0.00001% of all realistic use cases, am i really doing them a service by mentioning it? might the result of me mentioning it lead to confusion and detract from the actual purpose of the code? or, worse yet, will it lead to beginner scripters worrying more about how to make their scripts 0.00001% better rather than focusing on improving their knowledge in leaps and bounds? these are things we all need to think about. it's a tricky business!
and what's the deal with the gratuitous bumping of old posts?
for those who dont know regex, they will think that you made a "great" modification on it... all you did was insert the "join" on reference... in fact when you say "should have been", is in fact modificate the $regml result, so it can be called all togheter, without the "join" command
inserting "join" on reference to modificate the $regml, is not "should have been" or extra mile, when it wont affect the final result, you will probably say that is "repetitive" or go an "extra mile", but no great modification were made, and the final result is the same
preventing people to join in ####channel_name is the same as forbidding ppl to choose a name for the channel
since ppl can choose chanel names like that, this script won't work
some server dont allow the use of extra # on channel's name, but there is a lot of server which allow it
so in fact, using a condition to prevent an extra # is not needed, where server by itself, can forbid it
That will trigger for ######deans_channel
I'll just tokenize 32 $strip($1-) in my example, but that won't prevent multiple $chantypes from being read.
If regex is the preferred choice, I'll do this instead:
on $*:text:/^!(join\s\043(?!\043)\S+)$/iS:#: $regml(1)
this will make sure it starts with one $chantypes to be the legit channel name. Since !join is the cmd, you could have just returned it with $regml(1) all together without specifying the default /join command again. Of course, I have nothing further to say if you call yourself an extra miler.
P.S. I know some channels can be made with #########blah and all that, but that's most likely rare, as people will choose #blah as being the channel.
PyThOn, you may consider doing this two ways to avoid an error:> on :text:!join:#: .join #$$2Or leave a space between the cmd and the asterisk:
on *:text:!join *:#: .join #$2
this way the $2 has to be filled with a value before the code can be executed. The dash after $2 is not necessary, 'cause a channel name can never consist in a space to be two tokens or more -- not that I have seen thus far.