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!
B
Bidziil
Voice
Posts: 7
Joined: Sun Feb 15, 2009 2:12 am

user profile script

Post by Bidziil »

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
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

try:

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"
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 :)

cheers
B
Bidziil
Voice
Posts: 7
Joined: Sun Feb 15, 2009 2:12 am

yayyyyyy

Post by Bidziil »

thank you so much tomekk
m
manipulativeJack
Voice
Posts: 13
Joined: Tue Feb 17, 2009 9:52 pm

Post by manipulativeJack »

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.
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

or change it to:

Code: Select all

 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 :)
m
manipulativeJack
Voice
Posts: 13
Joined: Tue Feb 17, 2009 9:52 pm

Post by manipulativeJack »

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
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

ver 0.2 - teaser added, voice on join:

Code: Select all

# 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
m
manipulativeJack
Voice
Posts: 13
Joined: Tue Feb 17, 2009 9:52 pm

Post by manipulativeJack »

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?
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

i tested it with nick like:

Code: Select all

< {AoD}`sdfsdf>
and its working good :)

Can you write something more, what nicks?
z
zombie_gaz
Voice
Posts: 7
Joined: Wed Feb 25, 2009 7:40 pm

Profile addition for default to nick requesting.

Post by zombie_gaz »

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: 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 {#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"
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Re: Profile addition for default to nick requesting.

Post by speechles »

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: Select all

# 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 }
z
zombie_gaz
Voice
Posts: 7
Joined: Wed Feb 25, 2009 7:40 pm

Post by zombie_gaz »

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).
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

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 :)

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 :>
z
zombie_gaz
Voice
Posts: 7
Joined: Wed Feb 25, 2009 7:40 pm

!profile alone...

Post by zombie_gaz »

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...
z
zombie_gaz
Voice
Posts: 7
Joined: Wed Feb 25, 2009 7:40 pm

Post by zombie_gaz »

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] }
Post Reply