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.

Profile Script - Modification Request

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
a
achilles1900
Voice
Posts: 30
Joined: Mon Apr 21, 2008 5:40 am

Profile Script - Modification Request

Post by achilles1900 »

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"
N
Nimos
Halfop
Posts: 80
Joined: Sun Apr 20, 2008 9:58 am

Post by Nimos »

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: #
# #
# !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
a
achilles1900
Voice
Posts: 30
Joined: Mon Apr 21, 2008 5:40 am

RE: Tested heres what I found

Post by achilles1900 »

Hi Nimos,

thanks for taking the trouble man, really appreciate it :D

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
a
achilles1900
Voice
Posts: 30
Joined: Mon Apr 21, 2008 5:40 am

Possible Solutions??

Post by achilles1900 »

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
N
Nimos
Halfop
Posts: 80
Joined: Sun Apr 20, 2008 9:58 am

Post by Nimos »

ok there I need the help of someone else... :oops:

is there something like "file existst -nocase", or do we have to set all the filenames with string tolower?
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

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.. ;)
Post Reply