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 1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Bidziil
Voice


Joined: 15 Feb 2009
Posts: 7

PostPosted: Sun Feb 15, 2009 2:52 am    Post subject: user profile script Reply with quote

I am requesting a profile script, I would like to be able to set which channels (on irc) it works in.

it would function like the following:

<Bidziil> !setup

after typing that trigger in the channel the bot would reply in pm:

<Bot> 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)
<Bidziil> !location SouthEast US
<Bot> 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)
<Bidziil> !SEX-OR Male/Dom
<Bot> you are ready for the next step which is !age
<Bidziil> !age 26
<Bot> now you are ready for the next step which is !describeME type info you want all on one line
<Bidziil> !describeME I am just Me
<Bot> Great all you have left is likes and limits .... type !mylikes and your likes all on one line.
<Bidziil{a}> !mylikes varied and assorted
<Bot> Fantastic, now you are ready for the last step which is !mylimits type info you want all on one line
<Bidziil> !mylimits push too far and Y/you will find out
<Bot> 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!

the !desc NICK trigger would work in the channels that are defined in the .tcl
it would pull the information for any users nick that has set up a profile


it would function like the following:

<Bidziil> !desc Bidziil


after typing that trigger in the channel the bot would reply in pm:

<Bot> Bidziil's location is: SouthEast US
<Bot> Bidziil is a: Male/Dom
<Bot> Bidziil's age is: 26
<Bot> Bidziil's description: I am just Me
<Bot> Bidziil's likes are: varied and assorted
<Bot> Bidziil's limits are: push too far and Y/you will find out





if anyone could code this up I would be very grateful
thank you
Back to top
View user's profile Send private message
tomekk
Master


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

PostPosted: Sun Feb 15, 2009 1:30 pm    Post subject: Reply with quote

try:

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"


Based on text files.
If you want to resetup your profile you have to type !setup again.
If you got dced during !setup, use !setup again.

Some changes or other things, write it here Smile

cheers
Back to top
View user's profile Send private message Visit poster's website
Bidziil
Voice


Joined: 15 Feb 2009
Posts: 7

PostPosted: Sun Feb 15, 2009 10:49 pm    Post subject: yayyyyyy Reply with quote

thank you so much tomekk
Back to top
View user's profile Send private message
manipulativeJack
Voice


Joined: 17 Feb 2009
Posts: 13

PostPosted: Wed Feb 18, 2009 2:06 pm    Post subject: Reply with quote

If you switch $input_nick with $split_args in the lines that display the profile you will get the correct caps on the nick (well, the caps that the person types in when requesting a profile) instead of an all lower case return.

I am not very good with TCL so I do not know if this might cause other problems...

Thanks again for this script, I have been trying something like this with bad results for years.
Back to top
View user's profile Send private message
tomekk
Master


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

PostPosted: Wed Feb 18, 2009 3:22 pm    Post subject: Reply with quote

or change it to:
Code:
 set input_nick [lindex $split_args 0]


Because $split_args are list.

I used "lower letters" cause of Unix systems.
In Unix systems, file name "Jack" != file name "jack".

cheers Smile
Back to top
View user's profile Send private message Visit poster's website
manipulativeJack
Voice


Joined: 17 Feb 2009
Posts: 13

PostPosted: Wed Feb 18, 2009 3:52 pm    Post subject: Reply with quote

Oh, nice!

I am trying to learn how to make it so IF someone has a profile they get a +v (voice) when they join.

Also trying to add a !teaser to the profile which will be a line the user can set which will display (like a greeting) when they join the channel.

Something like: !teaser Hi everyone, I am here to chat!

emily has joined #chat
bot has set mode +v emily
<bot> Teaser for emily - Hi everyone, I am here to chat! - to view the full profile type: !view emily
Back to top
View user's profile Send private message
tomekk
Master


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

PostPosted: Wed Feb 18, 2009 5:24 pm    Post subject: Reply with quote

ver 0.2 - teaser added, voice on join:
Code:
# Author: tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.2
#
# 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"

# dir with teasers
set teasers_dir "teasers"

# 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 pub - !teaser teaser_proc
bind msgm - "*" pm_proc
bind join - "*" do_on_join

set new_profiles_nicks [list]

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

if {![file exists $teasers_dir]} {
   file mkdir $teasers_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 teaser_proc { nick uhost hand chan arg } {
   global profiles_dir teasers_dir profiles_dir setup_chans

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

   set teaser_data $arg
   set small_nick [string tolower $nick]

   if {[file exists $profiles_dir/$small_nick]} {
      if {$arg != ""} {
         set new_teaser [open $teasers_dir/$small_nick w]
         puts $new_teaser $arg
         close $new_teaser

         putquick "PRIVMSG $nick :done."
      }
   } {
      putquick "PRIVMSG $nick :at first, you need to make your profile, use !setup"   
   }

}

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 do_on_join { nick uhost hand chan } {
   global profiles_dir teasers_dir setup_chans botnick

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

   if {$botnick == $nick} {
      return
   }

   set small_nick [string tolower $nick]

   if {[file exists $profiles_dir/$small_nick]} {
      putquick "MODE $chan +v $nick"

      if {[file exists $teasers_dir/$small_nick]} {
         set user_teaser ""

         set get_teaser [open $teasers_dir/$small_nick r]
         gets $get_teaser user_teaser
         close $get_teaser

         putquick "PRIVMSG $chan :Teaser for $nick - $user_teaser - to view the full profile type: !desc $nick"
      }
   }
}

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.2 by tomekk loaded"


!teaser <some text> works only for ppl with profile, the same with +v.

Test it.

cheers
Back to top
View user's profile Send private message Visit poster's website
manipulativeJack
Voice


Joined: 17 Feb 2009
Posts: 13

PostPosted: Sun Feb 22, 2009 12:16 am    Post subject: Reply with quote

I am getting tons of use out of this, it is great!
I even learned how to add extra !triggers

It seems to be erroring on people with special characters in their names though. (like {}s)

I found a web page about how to write scripts that do not choke on special characters but I have not had any luck modifying it yet...

any advice?
Back to top
View user's profile Send private message
tomekk
Master


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

PostPosted: Sun Feb 22, 2009 8:02 am    Post subject: Reply with quote

i tested it with nick like:
Code:
< {AoD}`sdfsdf>


and its working good Smile

Can you write something more, what nicks?
Back to top
View user's profile Send private message Visit poster's website
zombie_gaz
Voice


Joined: 25 Feb 2009
Posts: 7

PostPosted: Wed Feb 25, 2009 8:09 pm    Post subject: Profile addition for default to nick requesting. Reply with quote

The code displayed below I found in this forum... it's awesome. Thanks to tomekk for that. I made a few small changes... I changed !desc to !profile, I made it so that !setup, !Setup, !SETup, !sEtUP, !profile, !Profile, !PROfile, etc work, and I changed minor config things so that the script applies to my channel.

My request, however, is that !profile defaults to the profile of the person requesting. Right now you have to do a !profile NICK and if you do just !profile you get a message that says you must specify a nick. Is there a way to make it so that just !profile will default to the nick of the person requesting?

Thanks in advance!

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 {#taxreligion #EPL #EPL-Staff}



# dir with profile files

set profiles_dir "profiles"



# location msg

set location_msg "Thanks for setting up your profile on QuakeNet's EPL channel. For the first step, set up your location using !location. For example: !location London, UK"



# sex msg

set sex_msg "Next, you will specify your sex using !sex. For example: !sex male"



# age msg

set age_msg "Now we will specify your age using !age. For example: !age 28"



# describe msg

set describe_msg "We use !describeme to set a short description of yourself. For example: !describeme I am the greatest forward you will ever meet."



# team msg

set team_msg "Great all you have left is your favored team and player... use !team for your team. For example: !team Liverpool"



# player msg

set player_msg "Now you are ready for the last step which is !player. For example: !player Ronaldo"



# end msg

set end_msg "Thanks for setting up your profile with QuakeNet's EPL channel. If you would like to view what you entered use !profile NICK , Thanks, have fun!"



##############################################################

bind pub -|- !setup setup_proc

bind pub -|- !profile 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 :\0037Profile for $split_args\003 \002Sex:\002 [lindex $desc_line_by_line 1], \002Age:\002 [lindex $desc_line_by_line 2], \002Location:\002 [lindex $desc_line_by_line 0], \002Supported Team:\002 [lindex $desc_line_by_line 4], \002Favorite Player:\002 [lindex $desc_line_by_line 5], \002Description:\002 [lindex $desc_line_by_line 3]"

      } {

         putquick "PRIVMSG $chan :$nick: Sorry, $input_nick hasn't used !setup to create a profile."

      }

   } {

      putquick "PRIVMSG $chan :$nick: use, !profile <nickname>"

   }

}



proc pm_proc { nick uhost hand arg } {

   global new_profiles_nicks sex_msg age_msg describe_msg team_msg player_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" "!age" "!describeme" "!team" "!player"}



   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" {

            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 <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 :$team_msg"

               }

            } {

               putquick "PRIVMSG $nick :use, !describeme <info>"

            }

         }



         "!team" {

            if {$cmd_data != ""} {

               if {[lines_number $nick] == 4} {

                  add_entry_to_profile $nick $cmd_data

                  putquick "PRIVMSG $nick :$player_msg"

               }

            } {

               putquick "PRIVMSG $nick :use, !team <info>"

            }

         }



         "!player" {

            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, !player <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
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Wed Feb 25, 2009 9:00 pm    Post subject: Re: Profile addition for default to nick requesting. Reply with quote

zombie_gaz wrote:
My request, however, is that !profile defaults to the profile of the person requesting. Right now you have to do a !profile NICK and if you do just !profile you get a message that says you must specify a nick. Is there a way to make it so that just !profile will default to the nick of the person requesting?

Thanks in advance!

Code:
# inside the proc desc_proc
# Change this:
set input_nick [string tolower [lindex $split_args 0]]

# Into this:
if {![string length [set input_nick [string tolower [lindex $split_args 0]]]} { set input_nick $nick }

_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
zombie_gaz
Voice


Joined: 25 Feb 2009
Posts: 7

PostPosted: Wed Feb 25, 2009 9:08 pm    Post subject: Reply with quote

When I use !profile the bot says that I haven't set up a profile. Yet using !profile NICK still works. Could it have something to do with it not recognising case?

EDIT: Yeah... when I change my nick to all lowercase, just !profile brings up my profile (but without my nick showing up in the message like when I use !profile NICK... $split_args).
Back to top
View user's profile Send private message
tomekk
Master


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

PostPosted: Thu Feb 26, 2009 8:14 am    Post subject: Reply with quote

zombie_gaz wrote:
When I use !profile the bot says that I haven't set up a profile. Yet using !profile NICK still works. Could it have something to do with it not recognising case?

EDIT: Yeah... when I change my nick to all lowercase, just !profile brings up my profile (but without my nick showing up in the message like when I use !profile NICK... $split_args).


hmm, i don't get it Smile

I tried setup with nick tomekk, TOMEKK and after desc with tomekk, tomEKK, TOMEKK - always working cause all nicks in the script are in lower case, file names too :>
Back to top
View user's profile Send private message Visit poster's website
zombie_gaz
Voice


Joined: 25 Feb 2009
Posts: 7

PostPosted: Thu Feb 26, 2009 9:37 am    Post subject: !profile alone... Reply with quote

Yeah... all the different cases work.

I need to be able to just type: !profile (with NO nickname at all) and have it default to the nick I am using when I type that.

For example:

<zombie_gaz> !profile
<BOT> Here's the profile for zombie_gaz...
Back to top
View user's profile Send private message
zombie_gaz
Voice


Joined: 25 Feb 2009
Posts: 7

PostPosted: Thu Feb 26, 2009 10:14 am    Post subject: Reply with quote

Nevermind... I got it! That line should have been:

if {![string length [set input_nick [string tolower [lindex $split_args 0]]]]} { set input_nick [string tolower $nick] }
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 1, 2, 3, 4, 5  Next
Page 1 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