PCTechTalkhttp://www.pctechtalk.com/forums/

Go Back   PCTechTalk > Community > PCTechTalk IRC (#pctechtalk.com)

Reply
 
LinkBack Thread Tools Display Modes
Old 11-06-2003, 01:15 PM   #1 (permalink)
AdMiN oF RoCk!
 
RipperRoo's Avatar
 
Join Date: Mar 2003
Location: uk
Posts: 2,080
RipperRoo is on a distinguished road
Useful Scripts Thread

Use This Thread To Share scripts you have written/found.

if you found a good script on the web, post the link (credit where credit is due ect) and if you use a script from this thread, please keep the details of the originator in the script, its considered polite.
when posting a script you wrote, please also post a set of instructions on whats needed to load and use the script, in order to make it accessable to everyone, no matter the level of scripting knowlage.( from NONE to err McGreff )

here is an example script to start the thread off, it had a few changes made to the original by Mcgreff, so i added my own credit, this in irc scripting terms is classed as 'acceptable use' unless otherwise stated by the creator.

------------------------------------------
Code:
;Nicksaver script version 2
;written for use on irc.p2pchat.net
;this script is designed to prevent you losing your nick
;in the event of a netsplit or disconnection
;if it detects your nick changed to p2p4567767 
;it waits 60 seconds then changes your nick 
;and reidentifys you using the nick/pass set in the script
;it also tracks nick changes, so if you swap between nicks
; in your group and disconnect, it will change your nick back 
;and issue the set group password to identify you
;change 'nickname' to your own nickname
;change 'password' to your password in the line below
;original script written by McGreff of #pctechtalk.com
;testing final adjustments and introduction/credits
;by RipperRoo of #pctechtalk.com

var %mypass
var %mynick
on:load: { 
  set %myNick nickname 
  set %mypass password
} 

on 1:nick: { 
  ; revert back the preferred nick if revoked by nickserv 
  if ($nick == %myNick && $left($newnick, 3) == p2p) { 
    /timer 1 66 nick %myNick 
    /timer 1 68 msg nickserv identify %mypass
    /timer 1 70 amsg 6I'm using 'Nicksaver' get it from:
    /timer 1 71 amsg 12http://www.pctechtalk.com/ 
  } 
  ; track the nick change otherwise 
  else if ($nick == %myNick) { 
    set %myNick $newnick 
  } 
}
* edit by greffov: wrapped code in [code]-block
__________________
PcTechtalk.com Admin
A7V8X xp2600 Barton SLK 97U, GeForce FX 5700, 1GB 2700DDR Ram
Sony DVD -R/+R/RW, SB Live 5.1 Digital, 1 x 30gb 3 x 200GB 2x120GB 1 x 250GB HDD'S, 19" TFT Epson R265
HP NX6125 Laptop 1gb memory

http://www.minotaur-computers.co.uk/
RipperRoo is offline   Reply With Quote
Old 11-06-2003, 01:19 PM   #2 (permalink)
AdMiN oF RoCk!
 
RipperRoo's Avatar
 
Join Date: Mar 2003
Location: uk
Posts: 2,080
RipperRoo is on a distinguished road
and here is the zip.
unzip to your script folder then follow these brief instructions,
as you need to set your nick and pass within the script its best to load it via the script editor,
on your mirc client go to 'Tools' 'Script Editor' (ALT+R is the shortcut) - go to the remote tab, click 'File' then 'Load' and find load the script called 'nicksaver-V2.mrc'
once loaded change the nickname and password as instructed within the script and away you go
Attached Files
File Type: zip nicksaver-v2.zip (735 Bytes, 4 views)
__________________
PcTechtalk.com Admin
A7V8X xp2600 Barton SLK 97U, GeForce FX 5700, 1GB 2700DDR Ram
Sony DVD -R/+R/RW, SB Live 5.1 Digital, 1 x 30gb 3 x 200GB 2x120GB 1 x 250GB HDD'S, 19" TFT Epson R265
HP NX6125 Laptop 1gb memory

http://www.minotaur-computers.co.uk/
RipperRoo is offline   Reply With Quote
Old 11-06-2003, 01:54 PM   #3 (permalink)
Da House Nerd
 
greffov's Avatar
 
Join Date: Dec 1969
Location: One CPU Lane
Posts: 3,512
greffov will become famous soon enough
A little piece of code from RaDiOBoT:

Code:
; automatic voicing system:
; the radiobot automatically voices users not op or hop
; because the chanbot is slower than radiobot, we have to wait a little before
; checking if a person should be voiced or not
on 1:join:#pctechtalk.com: ./timer 1 2 /voiceuser $nick $chan $gettok($chan(#pctechtalk.com).mode,1,32)
alias voiceuser {
  if (m !isin $3) {
    if ($1 !isop $2 && $1 !ishop $2) {
      mode $2 +v $1
    }
  }
}
The timer is used to trigger the voiceuser alias aftert 2 seconds to give chanbot a little time. After that the alias does the actual work. First it tries to find out if the channel is moderated (mode +m), if not, it gives voice to the user if not op or hop already.
__________________
Linux virusscanner detected a virus:
Windows 95 ... delete [Y/n] y
~
~

:wq
greffov is offline   Reply With Quote
Old 11-11-2003, 01:34 PM   #4 (permalink)
Lurking AdMiN
 
Cirga's Avatar
 
Join Date: Mar 2003
Location: In my own little world. Buts its ok. They know me here.
Posts: 3,245
Cirga is on a distinguished road
Nothing special here.. just a little diddy to make things easier for you. This script will identify your registered nickname and then join any number of channels you specify. Saves me time every day since I hang out in about 10 channels.

Code:
/p2p {
  /msg nickserv identify password
  /j #pctechtalk.com
  /j #channel
  /j #channel
  /j #channel
  /j #channel
  /j #channel
  /j #channel
  /j #channel
}
You can change teh commands to /join if you are not using a mIRC spin off version for your client.

Enjoy
__________________
Vote For Us! -- It will get you hot chicks. No really It will!


----
www.myTego.com - Give your devices a face! Dont be a conformist!
Cirga is offline   Reply With Quote
Old 11-11-2003, 02:47 PM   #5 (permalink)
Da House Nerd
 
greffov's Avatar
 
Join Date: Dec 1969
Location: One CPU Lane
Posts: 3,512
greffov will become famous soon enough
Hey, want it to connect and join automagically? Put it in remotes:
Code:
on 1:connect: {
  nick mynick
  msg nickserv identify password
  join #1
  join #2
  ...
}
__________________
Linux virusscanner detected a virus:
Windows 95 ... delete [Y/n] y
~
~

:wq
greffov is offline   Reply With Quote
Old 11-12-2003, 02:00 PM   #6 (permalink)
Registered User
 
Join Date: Oct 2003
Location: UK
Posts: 6
Mick
Here is a "Mass Voicer" which could be found useful

Code:
on *:TEXT:!massvoice Channel:#: massvoice $chan
alias massvoice {
  if ( $1 == $null || $me !isop # || $nick !isop # ) { halt }
  set %mvoice1 1
  set %mvoice2 2
  set %mvoice3 3
  :loop
  mode $1 +vvvvvv $nick($1,%mvoice1,a,voh) $nick($1,%mvoice2,a,voh) $nick($1,%mvoice3,a,voh) 
  if $nick($1,%mvoice1,a,voh) == $null goto end
  inc %mvoice1 3
  inc %mvoice2 3
  inc %mvoice3 3
  goto loop
  :end
  unset %mvoice1
  unset %mvoice2
  unset %mvoice3
}

*EDIT as this is a loop that can have any number of %mvoice variables, its been cut down from 6 to three in order to save the frames, the unaltered script can be found HERE or attached to the thread below as a zipped .mrc file

RipperRoo

Last edited by Mick; 11-12-2003 at 02:21 PM.
Mick is offline   Reply With Quote
Old 11-12-2003, 02:13 PM   #7 (permalink)
Da House Nerd
 
greffov's Avatar
 
Join Date: Dec 1969
Location: One CPU Lane
Posts: 3,512
greffov will become famous soon enough
Hmmm... why 6 at once? Is that for performance reasons? I would have done it with a while-loop construct... What's the idea behind this one?

B.T.W. TOOO bad for the design here, I need to be able to read the code here.
__________________
Linux virusscanner detected a virus:
Windows 95 ... delete [Y/n] y
~
~

:wq
greffov is offline   Reply With Quote
Old 11-12-2003, 02:31 PM   #8 (permalink)
Registered User
 
Join Date: Oct 2003
Location: UK
Posts: 6
Mick
Quote:
why 6 at once? Is that for performance reasons?
To be honest, i chose six as a random number, any more than six woulda meant more typing, did not choose 1 or 2 etc as i invisaged its use in large channels, so yes i thought performance may come into it, not so many loops

Quote:
I would have done it with a while-loop construct
ok, just an inside to my scripting history, ok i admit it, i have never seen while-loop i have only been scripting for a short time, still learning / teaching myself, thanks for the heads up, i will endeavour to read some books

I would appreciate seeing what you would have used, instead of the one i made, thanks in advance

Last edited by Mick; 11-12-2003 at 02:41 PM.
Mick is offline   Reply With Quote
Old 11-13-2003, 01:55 AM   #9 (permalink)
AdMiN oF RoCk!
 
RipperRoo's Avatar
 
Join Date: Mar 2003
Location: uk
Posts: 2,080
RipperRoo is on a distinguished road
Mick's massvoice script (zipped) saved as an .mrc file

(the full 6 at once version)
Attached Files
File Type: zip massvoice.zip (361 Bytes, 1 views)
__________________
PcTechtalk.com Admin
A7V8X xp2600 Barton SLK 97U, GeForce FX 5700, 1GB 2700DDR Ram
Sony DVD -R/+R/RW, SB Live 5.1 Digital, 1 x 30gb 3 x 200GB 2x120GB 1 x 250GB HDD'S, 19" TFT Epson R265
HP NX6125 Laptop 1gb memory

http://www.minotaur-computers.co.uk/
RipperRoo is offline   Reply With Quote
Old 11-13-2003, 04:55 AM   #10 (permalink)
Da House Nerd
 
greffov's Avatar
 
Join Date: Dec 1969
Location: One CPU Lane
Posts: 3,512
greffov will become famous soon enough
Quote:
Originally posted by Mick
ok, just an inside to my scripting history, ok i admit it, i have never seen while-loop i have only been scripting for a short time, still learning / teaching myself, thanks for the heads up, i will endeavour to read some books

I would appreciate seeing what you would have used, instead of the one i made, thanks in advance
It was not meant to criticize your way of doing it... I'm a starter also, and mIRC is driving me nuts on a regular base.

Code:
on 1:text:!massvoice *:*: {
  ; find out if we have a chan to voice, 
  ; if we are op and the user issuing the command is op too.
  ; If not, stop the script...
  if ($2 == $null || $me !isop $2 || $nick !isop $2) {
    msg $chan Either you ( $+ $nick $+ ) or me ain't op in $2
    halt
  }

  ; iterate through all members in the chan
  var %i
  set %i 1
  ; we request only users which have no state (yet)
  while ($nick($2, %i, a, voh)) {
    mode $2 +v $nick($2, %i, a, voh)
    set %i $calc(%i + 1) 
  }
}
I tested this and it seems to work also! yay
I added this command to RaDiOBoT, thanks Mick!
__________________
Linux virusscanner detected a virus:
Windows 95 ... delete [Y/n] y
~
~

:wq
greffov is offline   Reply With Quote
Old 11-13-2003, 08:26 AM   #11 (permalink)
Da House Nerd
 
greffov's Avatar
 
Join Date: Dec 1969
Location: One CPU Lane
Posts: 3,512
greffov will become famous soon enough
Ok, Dunce tempted me to improve this little script, here the results:

Code:
on 1:text:!massvoice:*: {
  ; find out if we are op and the user issuing the command is op too.
  ; If not, stop the script...
  if ($me !isop $chan || $nick !isop $chan) {
    msg $chan Either you ( $+ $nick $+ ) or me ain't op in $chan
    halt
  }

  ; iterate through all members in the chan
  var %i, %voicestr
  set %i 1
  ; we request only users which have no state (yet)
  while ($nick($chan, %i, a, voh)) {
    set %voicestr v $+ %voicestr $nick($chan, %i, a, voh)
    set %i $calc(%i + 1) 
  }
  mode $chan + $+ %voicestr
}

on 1:text:!massdevoice:*: {
  ; find out if we are op and the user issuing the command is op too.
  ; If not, stop the script...
  if ($me !isop $chan || $nick !isop $chan) {
    msg $chan Either you ( $+ $nick $+ ) or me ain't op in $chan
    halt
  }

  ; iterate through all members in the chan
  var %i, %voicestr
  set %i 1
  ; we request only users which have state v
  while ($nick($chan, %i, v)) {
    set %voicestr v $+ %voicestr $nick($chan, %i, v)
    set %i $calc(%i + 1) 
  }
  mode $chan - $+ %voicestr
}
Actual change: it now voices/devoices any one in one line, instead of multiple.
It also operates on the channel it is called in, for I saw no issue in giving the channel to operate on.
__________________
Linux virusscanner detected a virus:
Windows 95 ... delete [Y/n] y
~
~

:wq
greffov is offline   Reply With Quote
Old 11-13-2003, 03:59 PM   #12 (permalink)
Registered User
 
Join Date: Oct 2003
Location: UK
Posts: 6
Mick
Nice modification, well done, thanks for the "enlightenment"

p.s Critisism makes perfection... I took it as Good critisism.....
Mick is offline   Reply With Quote
Old 11-13-2003, 04:17 PM   #13 (permalink)
Registered User
 
Join Date: Oct 2003
Location: UK
Posts: 6
Mick
Just an observation:
Your use of
on 1:text:!massvoice:*:
would indicate usage in other forms other than just text in channel: Agreed?
ie: in a notice perhaps....

yet both returns are in $chan output would it be wise to use

on 1:text:!massvoice:#:

or use

on 1:text:!massvoice *:*:

and change all $chan to $1

which will enable the trigger "!massvoice #channame" in any format

I take it this would work: please advise
Mick is offline   Reply With Quote
Old 11-13-2003, 07:05 PM   #14 (permalink)
AdMiN oF RoCk!
 
RipperRoo's Avatar
 
Join Date: Mar 2003
Location: uk
Posts: 2,080
RipperRoo is on a distinguished road
Quote:
Originally posted by Mick
Just an observation:
Your use of
on 1:text:!massvoice:*:
would indicate usage in other forms other than just text in channel: Agreed?
ie: in a notice perhaps....

yet both returns are in $chan output would it be wise to use

on 1:text:!massvoice:#:

or use

on 1:text:!massvoice *:*:

and change all $chan to $1

which will enable the trigger "!massvoice #channame" in any format

I take it this would work: please advise

using $1 would make the channrl name '!massvoice', you would need to use $2 to pick up the second word. also using it this way with 'on 1:text:!massvoice *:*: ' would enable the op of one channel your bot is in to send the command to any other, so it would need to be locked down to either an access list or a control channel.
heres is an exaple of an access list script from radiobot; the 1st section adds a nick to the text file used, notice the initial usernick is hardcoded into the script to prevent unautherised aditions, once people are added, because of the way the script is written, they can add others to the list:


Code:
on 1:text:!addaccess *:*: {
 if ($read(conf/access.txt, s, $nick) == true || $nick == McGreff) {
  write conf/access.txt $2 true
  }
}

next the alias that is used in commands that querys the text file:

Code:
alias isAccess {
  if ($read(conf/access.txt, s, $1) == true) {
    return true
  }
  else {
    return $null
  }
}

and finaly an example of its use:

Code:
on 1:text:radiobot do you need a reboot:#: {
  if ($isAccess($nick)) {
    msg $chan 6Yes Please $nick
  }
}

the above code (taken from radiobot) was written by McGreff



some command triggers have been renamed to preserve the security of RaDiOBoT
__________________
PcTechtalk.com Admin
A7V8X xp2600 Barton SLK 97U, GeForce FX 5700, 1GB 2700DDR Ram
Sony DVD -R/+R/RW, SB Live 5.1 Digital, 1 x 30gb 3 x 200GB 2x120GB 1 x 250GB HDD'S, 19" TFT Epson R265
HP NX6125 Laptop 1gb memory

http://www.minotaur-computers.co.uk/
RipperRoo is offline   Reply With Quote
Old 11-14-2003, 02:46 AM   #15 (permalink)
Da House Nerd
 
greffov's Avatar
 
Join Date: Dec 1969
Location: One CPU Lane
Posts: 3,512
greffov will become famous soon enough
Quote:
Originally posted by Mick
Just an observation:
Your use of
on 1:text:!massvoice:*:
would indicate usage in other forms other than just text in channel: Agreed?
ie: in a notice perhaps....
I'm not very aware of the difference of * and #, but I found out the bot not responding when PMing, so I decided to stay consistent and use * everywhere.
Quote:

yet both returns are in $chan output would it be wise to use

on 1:text:!massvoice:#:
That depends on what theory lies behind # and *. It's obviously I don't know You please tell me, I might have some work to do afterwards
Quote:

or use

on 1:text:!massvoice *:*:

and change all $chan to $1
RipperRoo already explained it should be $2. But I like to point out also that it could have been !massvoice *:#: in my knowledge. Or you have to prove me the opposite. Again, I don't know the diff.
Quote:

which will enable the trigger "!massvoice #channame" in any format

I take it this would work: please advise
The first version uses the syntax as you just described, but I removed that in the second just for the sake of usability.
RaDiOBoT in fact only controls #pctechtalk.com, therefore it's useless for me to have to type !massvoice #pctechtalk.com if I'm in #pctechtalk.com.
I just require you to be in the channel you want to mass(de)voice. And to prevent misuse I also require you to have yourself the permissions to do it.
__________________
Linux virusscanner detected a virus:
Windows 95 ... delete [Y/n] y
~
~

:wq
greffov is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 12:03 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
2001 PCTechTalk