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.

TxTGreet 1.0 by darles needs fix [SOLVED]

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
c
cache
Master
Posts: 306
Joined: Tue Jan 10, 2006 4:59 am
Location: Mass

TxTGreet 1.0 by darles needs fix [SOLVED]

Post by cache »

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: Select all

#####################################################
#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.
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

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

http://members.dandy.net/~fbn/greet.tcl.txt
c
cache
Master
Posts: 306
Joined: Tue Jan 10, 2006 4:59 am
Location: Mass

Post by cache »

Thanks rosc :)
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

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

Code: Select all

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. :oops:
c
cache
Master
Posts: 306
Joined: Tue Jan 10, 2006 4:59 am
Location: Mass

Post by cache »

Thanks speechles that trick did work :D
Post Reply