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.

cant add to next line! why?

Help for those learning Tcl or writing their own scripts.
Post Reply
P
Patty
Voice
Posts: 3
Joined: Thu Apr 27, 2006 7:12 am

cant add to next line! why?

Post by Patty »

Code: Select all

bind pub - !set chan:level
proc chan:level {nick uhost hand chan text} {
	set AuthNick [lindex $text 0]
	set Authlevel2 0
	set Authlevel 0
	set Authlevel [getchanlogin $nick]
	set Authlevel2 [getchanlogin $AuthNick]
	if {"$Authlevel2" == "0"} {
		putquick "NOTICE $nick :$AuthNick is not authed!"
		return 0
		} else {
	set fs [open $chan.ini r+]
	set finished 0
	while {![eof $fs] && !$finished} {
  	gets $fs line
    		if {"[lindex $line 0]" == "$Authlevel" && "[lindex $line 1]" == "owner" } {
			putquick "NOTICE $nick :$Authlevel $Authlevel2"
			puts $fs "$Authlevel2 [lindex $text 1]"
			close $fs
			set finished 1
			} else {
				putquick "NOTICE $nick :Your not set as Owner or Master to $chan"
			}
		}
	}
	return 0
}
it will not add to the next line but add it to the current line :S

please help :S
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

add to which line? your are missing a more detailed explanation of your problem. I really dont understand what you want.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

you may do better using

Code: Select all

set fs [open $chan.ini a+] 
r+ Open the file for both reading and writing; the file must already exist.
a+ Open the file for reading and writing. If the file doesn't exist, create a new empty file. Set the initial access position to the end of the file.

The r+ option does not tell it to start a new line for input.
Post Reply