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.

user profile script

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

Football wrote:an addition:

is it possible that when a user who has a profile setup, the bot will greet him when he joins by his name, like <Bot> Hi Tommy
but will also greet him by the bot's local time clock
like between 0-6: Good night Tommy. 6-12: good morning Tommy
12-17: good afternon Tommy and 17-24: good evening Tommy?

aswell as adding an option for defining his name?

* Can you paste the full scripts as they are fixed?
the date addon was the last addon which i've made for this script, sorry mate
c
crymsun
Voice
Posts: 33
Joined: Tue Nov 13, 2018 8:24 pm

Post by crymsun »

I have loaded the script below... but I'm not sure what kind of files/folders I'm supposed to set up in the eggdrop directory...

I created a "Profiles" folder in the directory... but not sure how the script links to it... do I need to set up text files, or does the script create them?

Any help would be appreciated. Here is the code I used:

Code: Select all

# Author: tomekk 
# e-mail:  tomekk/@/oswiecim/./eu/./org 
# home page: http://tomekk.oswiecim.eu.org/ 
# 
# Version 0.1 
# 
# This file is Copyrighted under the GNU Public License. 
# http://www.gnu.org/copyleft/gpl.html 

# channels for !setup 
set setup_chans {#channel1 #channel2} 

# dir with profile files 
set profiles_dir "profiles" 

# location msg 
set location_msg "Thanks for taking the time to set up a profile so we may better know you. For the first step you do !location (and area you live)" 

# sex msg 
set sex_msg "you are ready for the next step which is !SEX-OR type in your sex (male/female) and your D/s position (Top/Bottom, Dom/sub, Master/slave, Sadist, masochist, switch)" 

# age msg 
set age_msg "you are ready for the next step which is !age" 

# describe msg 
set describe_msg "now you are ready for the next step which is !describeME type info you want all on one line" 

# likes msg 
set likes_msg "Great all you have left is likes and limits .... type !mylikes and your likes all on one line." 

# limits msg 
set limits_msg " Fantastic, now you are ready for the last step which is !mylimits type info you want all on one line" 

# end msg 
set end_msg "Wonderful and thank you!!!!!! You have completed the last step of your profile. If you would like to view what you entered do !desc NICK , Thanks, have fun!" 

############################################################## 
bind pub - !setup setup_proc 
bind pub - !desc desc_proc 
bind msgm - "*" pm_proc 

set new_profiles_nicks [list] 

if {![file exists $profiles_dir]} { 
   file mkdir $profiles_dir 
} 

proc add_entry_to_profile { nick data } { 
   global profiles_dir 

   set small_nick [string tolower $nick] 

   set new_entry [open $profiles_dir/$small_nick a] 
   puts $new_entry $data 
   close $new_entry 
} 

proc lines_number { nick } { 
   global profiles_dir 

   set lines_counter 0 
    
   set small_nick [string tolower $nick] 

   if {[file exist $profiles_dir/$small_nick]} { 
      set fetch_data [open $profiles_dir/$small_nick r] 
      set lines_counter [llength [split [read $fetch_data] "\n"]] 
      close $fetch_data 
   } 

   if {$lines_counter > 0} { 
      set lines_counter [expr $lines_counter - 1] 
   } 

   return $lines_counter 
} 

proc setup_proc { nick uhost hand chan arg } { 
   global new_profiles_nicks location_msg profiles_dir setup_chans 

   if {[lsearch $setup_chans $chan] == -1} { 
      return 
   } 

   putquick "PRIVMSG $nick :$location_msg" 

   if {[lsearch $new_profiles_nicks $nick] == -1} { 
      lappend new_profiles_nicks $nick 
   } 

   set small_nick [string tolower $nick] 

   set new_profile_db [open $profiles_dir/$small_nick w] 
   close $new_profile_db 

} 

proc desc_proc { nick uhost hand chan arg } { 
   global new_profiles_nicks profiles_dir setup_chans 

   if {[lsearch $setup_chans $chan] == -1} { 
      return 
   } 

   set split_args [split $arg] 
   set input_nick [string tolower [lindex $split_args 0]] 

   if {$input_nick != ""} { 
      if {[file exists $profiles_dir/$input_nick]} { 
         set read_profile [open $profiles_dir/$input_nick r] 
         set full_data [read $read_profile] 
         close $read_profile 

         set desc_line_by_line [split $full_data "\n"] 

         putquick "PRIVMSG $nick :$input_nick\'s location is: [lindex $desc_line_by_line 0]" 
         putquick "PRIVMSG $nick :$input_nick is a: [lindex $desc_line_by_line 1]" 
         putquick "PRIVMSG $nick :$input_nick\'s age is: [lindex $desc_line_by_line 2]" 
         putquick "PRIVMSG $nick :$input_nick\'s description: [lindex $desc_line_by_line 3]" 
         putquick "PRIVMSG $nick :$input_nick\'s likes are: [lindex $desc_line_by_line 4]" 
         putquick "PRIVMSG $nick :$input_nick\'s limits are: [lindex $desc_line_by_line 5]" 
      } { 
         putquick "PRIVMSG $chan :$nick: sorry, $input_nick profile doesn't exist" 
      } 
   } { 
      putquick "PRIVMSG $chan :$nick: use, !desc <nickname>" 
   } 
} 

proc pm_proc { nick uhost hand arg } { 
   global new_profiles_nicks sex_msg age_msg describe_msg likes_msg limits_msg end_msg 

   set split_args [split $arg] 
   set cmd_name [string tolower [lindex $split_args 0]] 
   set cmd_data [join [lrange $split_args 1 end]] 

   set available_cmds {"!location" "!sex-or" "!age" "!describeme" "!mylikes" "!mylimits"} 

   if {[lsearch $available_cmds $cmd_name] == -1} { 
      return 
   } 

   if {[lsearch $new_profiles_nicks $nick] != -1} { 
      switch -- $cmd_name { 
         "!location" { 
            if {$cmd_data != ""} { 
               if {[lines_number $nick] == 0} { 
                  add_entry_to_profile $nick $cmd_data 
                  putquick "PRIVMSG $nick :$sex_msg" 
               } 
            } { 
               putquick "PRIVMSG $nick :use, !location <info>" 
            } 
         } 

         "!sex-or" { 
            if {$cmd_data != ""} { 
               if {[lines_number $nick] == 1} { 
                  add_entry_to_profile $nick $cmd_data 
                  putquick "PRIVMSG $nick :$age_msg" 
               } 
            } { 
               putquick "PRIVMSG $nick :use, !sex-or <info>" 
            } 
         } 

         "!age" { 
            if {$cmd_data != ""} { 
               if {[lines_number $nick] == 2} { 
                  add_entry_to_profile $nick $cmd_data 
                  putquick "PRIVMSG $nick :$describe_msg" 
               } 
            } { 
               putquick "PRIVMSG $nick :use, !age <info>" 
            } 
         } 

         "!describeme" { 
            if {$cmd_data != ""} { 
               if {[lines_number $nick] == 3} { 
                  add_entry_to_profile $nick $cmd_data 
                  putquick "PRIVMSG $nick :$likes_msg" 
               } 
            } { 
               putquick "PRIVMSG $nick :use, !describeme <info>" 
            } 
         } 

         "!mylikes" { 
            if {$cmd_data != ""} { 
               if {[lines_number $nick] == 4} { 
                  add_entry_to_profile $nick $cmd_data 
                  putquick "PRIVMSG $nick :$limits_msg" 
               } 
            } { 
               putquick "PRIVMSG $nick :use, !mylikes <info>" 
            } 
         } 

         "!mylimits" { 
            if {$cmd_data != ""} { 
               if {[lines_number $nick] == 5} { 
                  add_entry_to_profile $nick $cmd_data 

                  set temp_new_profiles_nicks [list] 

                  foreach profile_nick [split $new_profiles_nicks] { 
                     if {($profile_nick != "") && ($profile_nick != $nick)} { 
                        lappend temp_new_profiles_nicks $profile_nick 
                     } 
                  } 

                  set new_profiles_nicks $temp_new_profiles_nicks 

                  putquick "PRIVMSG $nick :$end_msg" 
               } 
            } { 
               putquick "PRIVMSG $nick :use, !mylimits <info>"    
            } 
         } 
      } 
   } { 
      putquick "PRIVMSG $nick :You need to type !setup on channel at first" 
   } 
} 

putlog "profile.tcl ver 0.1 by tomekk loaded" 
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

Basically, all you have to do is to run this script.
It will create new directory for user data.
c
crymsun
Voice
Posts: 33
Joined: Tue Nov 13, 2018 8:24 pm

Post by crymsun »

Got it!!! Thank you.

I wondered... is there any way to add an !editprofile feature? (Currently have it as !addprofile instead of !setup).

Rather than the user having to go through all the steps again... upon !editprofile the bot would bring up that nick's profile and the user could edit it?
c
crymsun
Voice
Posts: 33
Joined: Tue Nov 13, 2018 8:24 pm

Post by crymsun »

Also... the output profile's nick is given in all lowercase. I tried the fix you gave originally, but that didn't seem to work...

I am using the original code provided (changed only the chan name and "location" or "orientation").
User avatar
vam2u
Voice
Posts: 35
Joined: Sat Mar 27, 2021 11:19 pm
Location: Malaysia

Post by vam2u »

I'm newbie in using TCL's script but i found it to be very intresting :-)
I found this cool script but I got below error:-
Hope someone can help me out on this.
Thanks.

[21:58:38] Tcl error [int_proc_setup]: putdccraw is deprecated. Please use putdcc/putnow instead.
Post Reply