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.

What's wrong??

Help for those learning Tcl or writing their own scripts.
Post Reply
C
CyberianIce
Voice
Posts: 12
Joined: Fri Dec 28, 2007 3:21 am

What's wrong??

Post by CyberianIce »

What's wrong with this code???

Code: Select all

proc joincounter {nick host hand chan} {
 global jhits
 global botnick
 set temp 0
 set rchan [string tolower $chan]
 if {[file exists ./scripts/$rchan.jcount.txt]} {
  set o_fid [open "./scripts/$rchan.jcount.txt" "RDONLY"]
  gets $o_fid temp
  close $o_fid
 } else {
  set o_fid [open "./scripts/$rchan.jcount.txt" "CREAT RDWR"]
  puts $o_fid temp
  close $o_fid
 }
 set jhits $temp
 incr jhits
 putserv "NOTICE $nick : MESSAGE 1"
 putserv "NOTICE $nick : MESSAGE 2"
 if {[isop $botnick $chan] && [isop $nick $chan]} {
     putserv "NOTICE $nick :MESSAGE 3"
 }
 set o_id [open "./scripts/$rchan.jcount.txt" "WRONLY"]
 puts $o_id $jhits
 close $o_id
}
No errors, MESSAGE 1 (welcome and count) is ok, MESSAGE 2 (contain descriptions for bots !commands) is fine too, but MESSAGE 3 (wich shold be shown to @ users when the bot is also @, contain description how to use !op commands) does not work...
Image
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

use botisop $chan instead of isop $botnick $chan
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

That's because you're testing if the user is opped when the eggdrop only sees the join.

The user is probably not even opped yet.

Also you may want to fix the bug in your code regarding it having to create a new file since it'll create a file with the contents "temp" which can't be incremented.
C
CyberianIce
Voice
Posts: 12
Joined: Fri Dec 28, 2007 3:21 am

Post by CyberianIce »

You are in right! I forgot to write beggining of the code:

Code: Select all

bind join -|- joincounter
.....
and users on join does not have @ yet.
Image
Post Reply