| View previous topic :: View next topic |
| Author |
Message |
achilles1900 Voice
Joined: 21 Apr 2008 Posts: 30
|
Posted: Mon Jan 05, 2009 1:35 pm Post subject: Profile Script - Modification Request |
|
|
Hi,
I am running Darles greet script, Could anyone suggest how to make a minor modification?
I think he is not available anymore as i have emailed him and no answer.
1. Would like to be able to set the channel the script runs on.
2. Enable a normal user who joins the channel, to type a public command example !profile achilles and the bot displays the profile.
Currently, only the person who makes the profile can display it
script follows below, thanks for your help people .
#####################################################
#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: #
# #
# !profile <greet text> - add greet or change it #
# !delprofile - remove greet #
# !myprofile - show greet #
# #
#####################################################
# #
# THANKS FOR: #
# www.rulex.net - (For shell) #
# irc.quakenet.org @ QuakeNet #tcl (help) #
# #
#####################################################
### Necessary configuration ###
set patch "deleted"
# Example: "home/darles/eggdrop/greet"
set greetsize "100"
# Greet limit (symbols)
set floodtimer "30"
# Time after which person can change it's greet
### End of necessary configuration ###
### Other configuration ###
set floodtext "Don't flood!!! You could set profile after $floodtimer seconds"
# This is message will be showed for flooders
set greetok "Your profile has been successfully set"
# This message will be showed, when greet is OK
set greetbad "Your profile is longer than $greetsize symbols"
# This error message will be showed then greet is longer than it should be
set greetdel "Your profile successfully deleted"
# This message will be showed then greet will be successfully deleted
set greetdelerr "Your profile not found"
# This error message will be showed then greet file not found
set yourgreet "Your profile is:"
# This is message using in !mygreet command
#####################################################
# #
# PLEASE DO NOT EDIT LINES BELOW!!! #
# #
#####################################################
bind pub - !profile addgreet
bind pub - !delprofile remgreet
bind pub - !myprofile 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 :!profile <text> - set your greet, !delprofile - remove your greet, !myprofile - show your greet, !help - show this help"
putserv "NOTICE $nick :Greet script by darles."
}
putlog "TxTGreet 1.0 by darles successfully loaded" |
|
| Back to top |
|
 |
Nimos Halfop
Joined: 20 Apr 2008 Posts: 80
|
Posted: Tue Jan 06, 2009 5:22 pm Post subject: |
|
|
| 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: #
# #
# !profile <greet text> - add greet or change it #
# !delprofile - remove greet #
# !myprofile - show greet #
# #
#####################################################
# #
# THANKS FOR: #
# www.rulex.net - (For shell) #
# irc.quakenet.org @ QuakeNet #tcl (help) #
# #
#####################################################
### Necessary configuration ###
set patch "deleted"
# Example: "home/darles/eggdrop/greet"
set greetsize "100"
# Greet limit (symbols)
set floodtimer "30"
# Time after which person can change it's greet
set mychan "#lamest"
# The Channel the script is on
### End of necessary configuration ###
### Other configuration ###
set floodtext "Don't flood!!! You could set profile after $floodtimer seconds"
# This is message will be showed for flooders
set greetok "Your profile has been successfully set"
# This message will be showed, when greet is OK
set greetbad "Your profile is longer than $greetsize symbols"
# This error message will be showed then greet is longer than it should be
set greetdel "Your profile successfully deleted"
# This message will be showed then greet will be successfully deleted
set greetdelerr "Your profile not found"
# This error message will be showed then greet file not found
set yourgreet "Your profile is:"
# This is message using in !mygreet command
#####################################################
# #
# PLEASE DO NOT EDIT LINES BELOW!!! #
# #
#####################################################
bind pub - !profile addgreet
bind pub - !delprofile remgreet
bind pub - !showprofile mygreet
bind pub - !help help
bind join - * showgreet
proc addgreet {nick uhost hand chan arg} {
global file greetsize patch greetbad greetok floodtext floodtimer mychan
if {$chan == $mychan} {
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 mychan
if {$chan == $mychan} {
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 mychan
if {$chan == $mychan} {
if {$arg == ""} {set arg $nick}
if {[file exist /$patch/$arg.txt]} {
set file6 [open /$patch/$arg.txt r]
gets $file6 text
close $file6
putserv "NOTICE $nick :$yourgreet: \[$nick\] $text"
} else {
putserv "NOTICE $nick :Sorry, $arg was not found in my Database!"
}
}
}
}
proc remgreet {nick uhost hand chan arg} {
global patch greetdel greetdelerr mychan
if {$chan == $mychan} {
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} {
global mychan
if {$chan == $mychan} {
putserv "NOTICE $nick :My commands is:"
putserv "NOTICE $nick :!profile <text> - set your greet, !delprofile - remove your greet, !showprofile - show your or another someones greet, !help - show this help"
putserv "NOTICE $nick :Greet script by darles."
}}
putlog "TxTGreet 1.0 by darles successfully loaded" |
!showprofile => returns your greet
!showprofile I_like_cookies => returns I_like_cookies' greet
in the config, set the variable "mychan" to the channel of your choice (only one channel, if you need more, ask^^)
if theres an error, i have missed a { or } (happens often^^)
have fun |
|
| Back to top |
|
 |
achilles1900 Voice
Joined: 21 Apr 2008 Posts: 30
|
Posted: Wed Jan 07, 2009 5:50 am Post subject: RE: Tested heres what I found |
|
|
Hi Nimos,
thanks for taking the trouble man, really appreciate it
heres what i found after testing it:
1. file "scripts/greet.tcl" line 135)
<bot> invoked from within
<bot> "source scripts/greet.tcl"
<bot> (file "gail.conf" line 1350)
2. I set my profile, the bot writes the profile as a text file OK but
it wont display it when i enter or when i type !showprofile
i get this error in bot "Tcl error [mygreet]: can't read "yourgreet": no such variable"
best regards,
Achilles |
|
| Back to top |
|
 |
achilles1900 Voice
Joined: 21 Apr 2008 Posts: 30
|
Posted: Wed Jan 07, 2009 6:24 am Post subject: Possible Solutions?? |
|
|
Hi Nimos,
I was foolin around with it:
1. I deleted the last { on line 135 that seems to have started the bot.
2. In regards to "Tcl error [mygreet]: can't read "yourgreet": no such variable"
I asked a friend and he said to "change global patch to "global patch yourgreet mychan" inside the "mygreet" function.
I tried that and it works thus far.
3. One thing i would like to have is: currently when i do !showprofile <nick> it is case-sensitive, eg. Achilles will be displayed but not achilles. Any ideas on how to make it like that?
thanks Nimos, Achilles |
|
| Back to top |
|
 |
Nimos Halfop
Joined: 20 Apr 2008 Posts: 80
|
Posted: Wed Jan 07, 2009 3:51 pm Post subject: |
|
|
ok there I need the help of someone else...
is there something like "file existst -nocase", or do we have to set all the filenames with string tolower? |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Wed Jan 07, 2009 6:35 pm Post subject: |
|
|
| Code: | | if {[file exist /$patch/[string tolower $nick].txt]} { |
This is probably how your going to have to approach it. Also keep in mind nicknames can contain characters that cannot be made into filenames. People with strange nicknames will cause errors with this script. What it should do is make one text file array { nick greet } and store everything in that. Then to read you just scan the array. To write you scan the array, and lreplace. It's silly imo to make lots of one line files, just my 2 cents worth..  _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
|