This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Voice Only Who On The List

Old posts that have not been replied to for several years.
User avatar
AbuAli
Voice
Posts: 35
Joined: Sat Jun 12, 2004 2:49 am

Voice Only Who On The List

Post by AbuAli »

Hey, i need help about how to make a tcl give voice to who join a channel but on my auto voice list.. with out use flag +v..
useing serach from a list
if he join the channel and he is on the list (vnick.txt) give him voice..
thx :>
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

set vlist "vnick.txt"

bind join - * voice:join

proc voice:join {nick uhost handle chan} {
  if {[isbotnick $nick] || ![botisop $chan] || ![file exists $::vlist]} {
    return
  }
  set f [open $::vlist r] 
  while {[gets $f n]>-1} { 
    if {[string match -nocase $nick $n]} {
      pushmode $chan +v $nick
    }
  }
}
Once the game is over, the king and the pawn go back in the same box.
User avatar
AbuAli
Voice
Posts: 35
Joined: Sat Jun 12, 2004 2:49 am

Post by AbuAli »

thx for help,
i test it .. dont work..
i put the nicks on the vlist.txt .. on scripts/

and how can i do that only in 2 channel. :-?

thx
User avatar
AbuAli
Voice
Posts: 35
Joined: Sat Jun 12, 2004 2:49 am

dont work :(

Post by AbuAli »

oops! i mean i put the nicks on vnick.txt and dont work!!
i have to put the host ? nick!*@* ? and the other nicks on the next line ?
thx
User avatar
AbuAli
Voice
Posts: 35
Joined: Sat Jun 12, 2004 2:49 am

Post by AbuAli »

sorry "caesar"
i test it again.. working!!!
..
another question..
how can i do this tcl ..
####
on *:VOICE:#channel:/write vnick.txt $vnick
####

on any op give voice to a user.. i add the user on the list vnick ?
thx for help and sorry again
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

did you add one nick at each line?

Code: Select all

#make sure this points to the right location of your file
set vlist "[pwd]/scripts/vnick.txt" 

#just add more binds and change the channelname if you want more channels...
bind join - "#channel1 *" voice:join 
bind join - "#channel2 *" voice:join

proc voice:join {nick uhost handle chan} { 
  if {[isbotnick $nick] || ![botisop $chan] || ![file exists $::vlist]} { 
    return 
  } 
  set f [open $::vlist r] 
  while {[gets $f n]>-1} { 
    if {[string match -nocase $nick $n]} { 
      pushmode $chan +v $nick 
    } 
  } 
}
Elen sila lúmenn' omentielvo
User avatar
AbuAli
Voice
Posts: 35
Joined: Sat Jun 12, 2004 2:49 am

Post by AbuAli »

yeah.. its working now..
about the write command ?
like this on mirc,
####
on *:VOICE:#channel:/write vnick.txt $vnick
####

on any op give voice to a user on special channel .. add the user on the list vnick.txt ?

:D
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

why dont you use eggdrop's internal functions for voice and op, its 10x better than messing with external text files
User avatar
AbuAli
Voice
Posts: 35
Joined: Sat Jun 12, 2004 2:49 am

Post by AbuAli »

gb:
how can i make the bot do the same job with internal functions ...

on any op voice a user on the channel. i add this user on the autovoice!!
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

bind mode - "#channel1 +v" proc:addtofile
proc proc:addtofile {nick host hand chan mc vc} {
  set fid [open $::vlist a]
  puts $fid $vc
  catch {close $fid}
}
note that this does not check if the one beeing voiced already is in the file
Elen sila lúmenn' omentielvo
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Add only if is not there allready:

Code: Select all

set vlist "vnick.txt" 

bind mode - "#channel +v" vlist:add

proc vlist:add {nick host hand chan mc vc} { 
  set f [open $::vlist a] 
  set i 0
  while {[gets $f n]>-1} { 
    if {[string match -nocase $vc $n]} { 
      incr i
    }
  } 
  if {$i} {
    puts $f $vc
  }
  close $f
}
Ps: The previous code I have pasted had two checks (actualy 3) that stop the proc if the conditions are met.
1. [isbotnick $nick] means if $nick is bot's nick then return, no need to voice itself.
2. ![botisop $chan] means if the bot is not oped there to not attempt to voice the user
3. ![file exists $::vlist] means if the vlist.txt file dosen't exist to not try to read it and check if $nick is listed there for voicing.
Questions? Shoot! And please drop the "is not working" s**t! Tell exactly what problem you have encounted in order to get an proper answer.

And the nicks in the vlist.txt file should be like:
nick1
nick2
and so on..
Once the game is over, the king and the pawn go back in the same box.
User avatar
AbuAli
Voice
Posts: 35
Joined: Sat Jun 12, 2004 2:49 am

Post by AbuAli »

i got this msg

Tcl error [vlist:add]: channel "file9" wasn't opened for reading

Code: Select all

set vlist "vnick.txt" 

bind mode - "#channel +v" vlist:add 

proc vlist:add {nick host hand chan mc vc} { 
  set f [open $::vlist a] 
  set i 0 
  while {[gets $f n]>-1} { 
    if {[string match -nocase $vc $n]} { 
      incr i 
    } 
  } 
  if {$i} { 
    puts $f $vc 
  } 
  close $f 
} 

Code: Select all

set vlist "vnick.txt" 

bind join - "#channel *" voice:join  

proc voice:join {nick uhost handle chan} { 
  if {[isbotnick $nick] || ![botisop $chan] || ![file exists $::vlist]} { 
    return 
  } 
  set f [open $::vlist r] 
  while {[gets $f n]>-1} { 
    if {[string match -nocase $nick $n]} { 
      pushmode $chan +v $nick 
    } 
  } 
} 
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

set f [open $::vlist a]

#should be:

set f [open $::vlist a+] 
Elen sila lúmenn' omentielvo
User avatar
AbuAli
Voice
Posts: 35
Joined: Sat Jun 12, 2004 2:49 am

Post by AbuAli »

hummm,
i change the (a) to (a+)

i give to a nick voice.. when i open vnick.txt is empty!!
so :(
with out show any error!!

the code to voice .. working
the code to write .. not working

and another qs: when the bot give the voice.. he will add the nick again on vnick.txt ? .. if YES! what to do to fix it ..
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

Why not use normal eggdrop flags, and save the users to the eggdrop userlist, its much more efficient and less prune to errors.

If you want to automaticly add everyone that get +v from one of the ops, to the bot, try something like this:

Code: Select all

bind mode - "* +v *" auto:addvoice
proc auto:addvoice {nick uhost hand chan text} {
 if {![validuser $hand]} {
   adduser $nick [maskhost $uhost]
   chattr $nick +v $chan
 }
}
Locked