Simple Notice Join/Part

By Kurama_ on Apr 30, 2009

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!! :| 
  }
}

Comments

Sign in to comment.
chachin   -  Oct 17, 2011

hi there's an error with this script.. when someone says: rejoin by itself the bot /notices them and says: you dont have access NUB!! :( and my bot got kb from 5 channels in 2 networks already :(
how to fix please :(

 Respond  
PyThOn   -  Aug 11, 2011

Any time Any time.
And lol @ 2009 Holy cow.

 Respond  
Jethro   -  Aug 11, 2011

I think Kurama has moved on for ages. Thanks to you, you resurrected his thread.

 Respond  
PyThOn   -  Aug 11, 2011

I like how Kurama_ isnt commenting ....

 Respond  
jaytea   -  Aug 11, 2011

jaytea! You're like a district attorney ready to represent the "prosecution" of any irreconcilable differences you've come across in any thread.

haha, everybody deserves a fair trial :P

 Respond  
Jethro   -  Aug 11, 2011

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.

 Respond  
_Dean_   -  Aug 11, 2011

i will take it

Dean's version:

$read(file.txt,$rand(1,$lines(file.txt)))

Jethro's version:

$read(file.txt)

as a joke... cause it not even ilustrate the example

Technically it's the same as passing [two] identifiers when [one] will get the job done right.

no, its not the same

 Respond  
jaytea   -  Aug 11, 2011

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?

 Respond  
Jethro   -  Aug 10, 2011

Again, do what makes you happy. Technically it's the same as passing [two] identifiers when [one] will get the job done right.

Dean's version:

$read(file.txt,$rand(1,$lines(file.txt)))

Jethro's version:

$read(file.txt)

Just food for thought...

 Respond  
_Dean_   -  Aug 10, 2011

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

 Respond  
Jethro   -  Aug 10, 2011

If what you say is to be bought, then your regex suggestion should have been:

on $*:text:/^!(join\s\43\S+)/iS:#: $regml(1)

 Respond  
_Dean_   -  Aug 10, 2011

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

 Respond  
Jethro   -  Aug 10, 2011

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.

 Respond  
_Dean_   -  Aug 10, 2011

the fact is, it will not strip ctrl commands... since, the person use
!join #roomname with colors
all it will return is
"Illegal channel name"

a simple solution would be

on $*:text:/^!join\s(\43\S+)$/iS:#: .join $regml(1)

if you want, you can improve regex to not accept special characters on match

 Respond  
PyThOn   -  Aug 10, 2011

Ok Smart kid Thanks.
lol

 Respond  
Jethro   -  Aug 10, 2011

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.

 Respond  
PyThOn   -  Aug 10, 2011

on :text:!join:#:{ .join #$2- } < Change wht u have 2 this

You have the cmd commands but u didnt instruct them

 Respond  
Keon191   -  May 24, 2010

does it matter what version of mirc you have because for some reason this isn't working for me :[

 Respond  
Aucun50   -  May 02, 2009

You could put the two on notices into one to shorten it and same with the on texts.

 Respond  
PATX   -  Apr 30, 2009

lol pretty good. might be a good idea to add how to set the owner var in the intro tho... cos some newbie would be like WUT????? lol.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.