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.

script not working right

Old posts that have not been replied to for several years.
Locked
l
lsn
Voice
Posts: 25
Joined: Mon Jul 19, 2004 8:11 am

script not working right

Post by lsn »

Code: Select all

 
set qfile web.txt 

bind pub n !noreg add:noreg

proc add:noreg { nick uhost hand chan arg } {
  global qfile
  set nchan [lindex $arg 0]
  if {!([string match "#*" $chan]) || ($nchan == "") } {
    putserv "NOTICE $nick :$nick Usage: noreg <#channel> \[reason\]"
    return 0
  }
  set file [open $qfile a] 
  puts $file "$nchan :added by $hand [ctime [unixtime]]" 
  close $file 
  putserv "NOTICE $nick :Added noreg chan: $nchan" 
  return 1
}
works but if you do !noreg test
bot not recognize that the # is missing
:((

can you help ?
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Here take a look at this:

Code: Select all

if {(![string match "#*" $chan])} {
#This is incorrect logic as the pub trigger is always peformed on a public channel hence the variable $chan will always contain an # of the channel name like #mychannel.

#If you want you can use:
if {([string match "#*" $chan])} {
#Although it is not necessary as the variable $chan always contains an #
To correct your script only use:

Code: Select all

#The correct way
if {(![string match "#*" $nchan]) || ($nchan == "")} { 

OR

if {(![string equal "#" [string index $nchan 0]]) || ($nchan == "")} { 
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Locked