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 

user profile script
Goto page Previous  1, 2, 3, 4, 5
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Fri Nov 27, 2009 1:36 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
crymsun
Voice


Joined: 13 Nov 2018
Posts: 31

PostPosted: Sun Dec 09, 2018 12:29 am    Post subject: Reply with quote

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:
# 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"
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Sun Dec 09, 2018 5:34 am    Post subject: Reply with quote

Basically, all you have to do is to run this script.
It will create new directory for user data.
Back to top
View user's profile Send private message Visit poster's website
crymsun
Voice


Joined: 13 Nov 2018
Posts: 31

PostPosted: Sun Dec 09, 2018 6:24 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
crymsun
Voice


Joined: 13 Nov 2018
Posts: 31

PostPosted: Mon Dec 10, 2018 3:11 pm    Post subject: Reply with quote

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").
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
Goto page Previous  1, 2, 3, 4, 5
Page 5 of 5

 
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