egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TxTGreet 1.0 by darles needs fix [SOLVED]

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
cache
Master


Joined: 10 Jan 2006
Posts: 306
Location: Mass

PostPosted: Sat Aug 18, 2007 7:39 pm    Post subject: TxTGreet 1.0 by darles needs fix [SOLVED] Reply with quote

I need help fixing this, it works but only one problem.. if you type !greet This is my "greet' message!! /cool\! as you noticed I used special characters like "" and / \ ... these characters are being added to txt file like \greet\ {cool} replacing the " with \ and others with { }

Can someone help me or show me a sample please?

p.s. tried to contact as stated in header but no such domains anymore.
Code:
#####################################################
#TxTGreet 1.0 by darles (TCL script for eggdrop 1.x)#
#TxTGreet released: 09.08.2005                      #
#---------------------------------------------------#
#  Homepage: http://egghelp.nasa-team.net           #
#  e-mail: darles@takas.lt                          #
#  IRC: irc.data.lt:6667 @ Aitvaras.net #egghelp    #
#---------------------------------------------------# 
#  Please don't change my nick to your...           #
#  Thanks, darles                                   #
#####################################################
#  Commands:                                        #
#                                                   #
#  !greet <greet text> - add greet or change it     #
#  !remgreet - remove greet                         #
#  !mygreet - show greet                            #
#                                                   #
#####################################################
#                                                   #
#  THANKS FOR:                                      #             
www.rulex.net - (For shell)                      #
#  irc.quakenet.org @ QuakeNet #tcl (help)          #
#                                                   #
#####################################################

### Necessary configuration ###

set patch "patch/to/your/greet/dir"
# Example: "home/darles/eggdrop/greet"

set greetsize "100"
# Greet limit (symbols)

set floodtimer "20"
# Time after which person can change it's greet

### End of necessary configuration ###

### Other configuration ###

set floodtext "Don't flood!!! You could set greet after $floodtimer seconds"
# This is message will be showed for flooders

set greetok "Your greet has been successfully set"
# This message will be showed, when greet is OK

set greetbad "Your greet is longer than $greetsize symbols"
# This error message will be showed then greet is longer than it should be

set greetdel "Your greet successfully deleted"
# This message will be showed then greet will be successfully deleted

set greetdelerr "Your greet not found"
# This error message will be showed then greet file not found
set yourgreet "Your greet is:"
# This is message using in !mygreet command

#####################################################
#                                                   #
#        PLEASE DO NOT EDIT LINES BELOW!!!          #
#                                                   #
#####################################################             

bind pub - !greet addgreet
bind pub - !remgreet remgreet
bind pub - !mygreet mygreet
bind pub - !help help
bind join - * showgreet

proc addgreet {nick uhost hand chan arg} {
global file greetsize patch greetbad greetok floodtext floodtimer
set file "$nick.txt2"
if {[file exist /$patch/$file]} {
set file2 [open /$patch/$file r]
gets $file2 ignore
close $file2
putserv "NOTICE $nick :$ignore"
} else {
set file3 [open /$patch/$nick.txt w+]
set text [lrange [split $arg] 0 end]
if {[string length $text] >= $greetsize} {
putserv "NOTICE $nick :$greetbad"
return 1
} else {
puts $file3 "$text"
close $file3
putserv "NOTICE $nick :$greetok"
set file4 [open /$patch/$file w+]
puts $file4 $floodtext
close $file4
utimer $floodtimer del
}
}
}
proc del {} {
global file patch
file delete "/$patch/$file"
}
proc showgreet {nick uhost hand chan} {
global patch
if {[file exist /$patch/$nick.txt]} {
set file5 [open /$patch/$nick.txt r+]
gets $file5 text
close $file5
putserv "PRIVMSG $chan :\[$nick\] $text"
}
}
proc mygreet {nick uhost hand chan arg} {
global patch
if {[file exist /$patch/$nick.txt]} {
set file6 [open /$patch/$nick.txt r]
gets $file6 text
close $file6
putserv "NOTICE $nick :$yourgreet: \[$nick\] $text"
}
}
proc remgreet {nick uhost hand chan arg} {
global patch greetdel greetdelerr
if {[file exist /$patch/$nick.txt]} {
file delete "/$patch/$nick.txt"
file delete "/$patch/$nick.txt2"
putserv "NOTICE $nick :$greetdel"
} else {
putserv "NOTICE $nick :$greetdelerr"
}
}
proc help {nick uhost hand chan arg} {
putserv "NOTICE $nick :My commands is:"
putserv "NOTICE $nick :!greet <text> - set your greet, !remgreet - remove your greet, !mygreet - show your greet, !help - show this help"
putserv "NOTICE $nick :Greet script by darles."
}
putlog "TxTGreet 1.0 by darles successfully loaded"


Last edited by cache on Sat Aug 18, 2007 8:09 pm; edited 1 time in total
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Sat Aug 18, 2007 7:47 pm    Post subject: Reply with quote

Complete re-write, handles tcl special chars, etc..

http://members.dandy.net/~fbn/greet.tcl.txt
Back to top
View user's profile Send private message
cache
Master


Joined: 10 Jan 2006
Posts: 306
Location: Mass

PostPosted: Sat Aug 18, 2007 7:53 pm    Post subject: Reply with quote

Thanks rosc Smile
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sat Aug 18, 2007 7:56 pm    Post subject: Reply with quote

Code:
set text [lrange [split $arg] 0 end]
If I'm reading correctly, this right here is your offender.

Code:
set text [join [lrange [split $arg] 0 end]]
To correct the offender use something like this possibly.

Learned this trick from Sir_Fz Wink
The guide on how to write eggdrop scripts that won't choke on special characters is here as well.

Edit: Haw, I had a phone call during my post, and appears I was beaten to the punch, literally. At least my post is still relevant, but your better off using rosc2112's script, she r0x. Embarassed
Back to top
View user's profile Send private message
cache
Master


Joined: 10 Jan 2006
Posts: 306
Location: Mass

PostPosted: Sat Aug 18, 2007 8:09 pm    Post subject: Reply with quote

Thanks speechles that trick did work Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber