19:52:40 <@player1> !setup
19:52:40 <botty> interview - 3 questions, okey, let's start...
19:52:40 <botty> here is your profile key, please save it: 51777b09ff44cdaadc6e2ab47e0a1afb
19:52:40 <botty> 1st - what is your age?
19:52:47 <player1> 22
19:52:47 <botty> 2nd - what is your sex?
19:52:50 <player1> alien
19:52:50 <botty> 3rd - where are you from?
19:52:55 <player1> space
19:52:56 <botty> thanks, that's all
19:52:56 < botty> new profile for player1
19:52:40 <@player1> !index
19:53:48 <botty> profiles list: player1 player2
mysql:20:08:58 <botty> 1st - what is your age?
20:09:01 <player3> abc
20:09:01 <botty> only numbers are allowed (99 is max)
20:09:02 <player3> 21
20:09:02 <botty> 2nd - what is your sex?
20:09:05 <player3> some
20:09:06 <botty> male, female or alien...
20:09:09 <player3> male
20:09:09 <botty> 3rd - where are you from?
20:09:12 <player3> home
20:09:12 <botty> thanks, that's all
of course you can make more or less columns,mysql> select * from users;
+----+----------+----------------------------------+------+-------+----------+
| id | nickname | md5key | age | sex | location |
+----+----------+----------------------------------+------+-------+----------+
| 24 | player1 | 51777b09ff44cdaadc6e2ab47e0a1afb | 22 | alien | space |
| 25 | player2 | ed79eb8d907a3508a47b08b45a0449f8 | 32 | male | home |
+----+----------+----------------------------------+------+-------+----------+
2 rows in set (0.00 sec)
Code: Select all
# mysql user
set int_mysql_user "user"
# mysql pass
set int_mysql_pass "pass"
# mysql db
set int_mysql_db "profiles"
# mysql host
set int_mysql_host "localhost"
# &k - will be a md5 key
# &n - will be a nickname
# msg occurs when the interview starts
set int_start_msg "interview - 3 questions, okey, let's start..."
# msg occurs when the interview ends
set int_end_msg "thanks, that's all
# msg occurs when the second person is trying to use !setup in the same time with other person"
set int_started_msg "interview started by someone else, please try again later"
# msg occurs when script shows the profile key (key for deleting profile by user)
set int_key_msg "here is your profile key, please save it: &k"
# msg occurs when someone is trying to make a profile with name which already exists in db
set int_profile_exist_msg "profile for this nick already exists"
# msg occurs on the channel when the interview ends
set int_end_chan_msg "new profile for &n"
# msg occurs when nick with registered profile joins the channel
set int_join_msg "profile for &n is available, you can view it by using !profile &n"
# msgs occurs when some type !profile
# the number of fields must be the same like the number of question_keys
set preview_texts {
"&n age:"
"&n sex:"
"&n location:"
}
# mysql extra columns names (the same names like in mysql database, don't change this to anything else)
# of course, you can define more, but you have to change this in your db too ;)
# id, nickname, md5key must be always
set questions_keys {
"age"
"sex"
"location"
}
# text for each question
set questions_texts {
"1st - what is your age?"
"2nd - what is your sex?"
"3rd - where are you from?"
}
# optional regexp for each question
# if want to disable regexp, use {.*} - that means any chars
set questions_regexps {
{^([0-9]{1,2})$}
{^(male|female|alien)$}
{.*}
}
# if some regexp don't match, output proper info to the user
set regexps_texts {
"only numbers are allowed (99 is max)"
"male, female or alien..."
""
}
Code: Select all
create table users (
id int(4) auto_increment,
nickname varchar(32),
md5key varchar(32),
age varchar(2),
sex varchar(6),
location varchar(64),
primary key(id)
);
Code: Select all
set int_bind(setup) "!setup"
set int_bind(update) "!update"
set int_bind(dev_tool) "!sessions"
set int_bind(questions_start) "fill_me_now"
set int_msg(begin) "Hey! Your profile has been created, write: 'fill_me_now' if you want to update your profile information now (3 extra questions about your person)"
set int_msg(key) "here is your key: &k, save it, you will need it later for edit or delete your profile"
set int_msg(end) "thanks for the answers, bye!"
set int_msg(profile_exists) "profile with that name already exists in db!"
set int_msg(setup_already_in_use) "you can't use this command twice in the same time"
set int_msg(setup_profile_name_already_in_use) "someone is making setup with that name right now"
set int_msg(setup_help) "use: !setup <profile_name>"
set int_msg(edit_help) "use: !update <profile_name>"
set int_questions_key {
"age"
"sex"
"from"
}
set int_questions_list {
"1. what is your age?"
"2. what is your sex?"
"3. where are you from?"
}
set int_questions_regexp {
{^([0-9]{1,2})$}
{^(male|female|alien)$}
{.*}
}
set int_question_help {
"only numbers are allowed (99 is max)"
"male, female or alien..."
""
}
# this proc checks if some nick exists or not (in some DB),
# proc should return 0 - if profile doesn't exists, 1 - when profile exists
# proc takes 4 arguments, nick/uhost/chan of profile creator, profile name
# write here some sql query, check some file - whatever...
proc int_check_if_exists { nick uhost chan profile_name } {
putquick "PRIVMSG $nick :int_check_if_exists{}: $nick $uhost $chan $profile_name 0"
return 0
}
# this proc is called when new profile is created
# proc takes 6 arguments, nick/uhost/chan of profile creator, profile name, profile key and profile creation time
# write this data to sql or some file - whatever...
proc int_new_profile_event { nick uhost chan profile_name profile_key action_time} {
putquick "PRIVMSG $nick :int_new_profile_event{}: $nick $uhost $chan $profile_name $profile_key $action_time"
}
# this proc is called after every answer
# proc takes 6 arguments, nick/uhost/profile name of answerer, answer, action time and question key
# write this data to sql or some file - whatever...
proc int_answer_event { nick uhost profile_name arg action_time question_key } {
putquick "PRIVMSG $nick :int_answer_event{}: $nick $uhost $profile_name $arg $action_time $question_key"
}
Code: Select all
# start interviewer-addon config
set int_bind(setup) "!setup"
set int_bind(update) "!update"
set int_bind(dev_tool) "!sessions"
set int_bind(questions_start) "fill_me_now"
set int_msg(begin) "Hey! Your profile has been created, write: 'fill_me_now' if you want to update your profile information now (3 extra questions about your person)"
set int_msg(key) "here is your key: &k, save it, you will need it later for edit or delete your profile"
set int_msg(end) "thanks for the answers, bye!"
set int_msg(profile_exists) "profile with that name already exists in db!"
set int_msg(setup_already_in_use) "you can't use this command twice in the same time"
set int_msg(setup_profile_name_already_in_use) "someone is making setup with that name right now"
set int_msg(setup_help) "use: !setup <profile_name>"
set int_msg(edit_help) "use: !update <profile_name>"
set int_questions_key {
"age"
"sex"
"from"
}
set int_questions_list {
"1. what is your age?"
"2. what is your sex?"
"3. where are you from?"
}
set int_questions_regexp {
{^([0-9]{1,2})$}
{^(male|female|alien)$}
{.*}
}
set int_question_help {
"only numbers are allowed (99 is max)"
"male, female or alien..."
""
}
# end of interviewer-addon config
# some other script variables, like in normal tcl script for eggdrop...
set myvar 0
set myvar2 "whatever"
######################################################################
# some other script bind, like in normal tcl script for eggdrop...
bind pub -|- !view view_proc
# some normal, script proc
proc view_proc { nick uhost hand chan arg } {
putquick "PRIVMSG $chan :here is proc for viewing the profile, write here what you need, sql query, fetch some data from file and print it out ;)"
}
# proc from interviewer-addon
proc int_check_if_exists { nick uhost chan profile_name } {
putquick "PRIVMSG $nick :int_check_if_exists{}: $nick $uhost $chan $profile_name 0"
return 0
}
# proc from interviewer-addon
proc int_new_profile_event { nick uhost chan profile_name profile_key action_time} {
putquick "PRIVMSG $nick :int_new_profile_event{}: $nick $uhost $chan $profile_name $profile_key $action_time"
}
# proc from interviewer-addon
proc int_answer_event { nick uhost profile_name arg action_time question_key } {
putquick "PRIVMSG $nick :int_answer_event{}: $nick $uhost $profile_name $arg $action_time $question_key"
}
putlog "some-profile-script.tcl ver 0.666"
# don't forget to add this line at the end of your script
# interviewer include
source scripts/interviewer-0.1.tcl
now some irc actions:[tomekk@zonk]:~/eggdrop# ./restart
Eggdrop v1.6.18+RC1 (C) 1997 Robey Pointer (C) 2006 Eggheads
[13:50] --- Loading eggdrop v1.6.18+RC1 (Thu Aug 6 2009)
[13:50] Listening at telnet port 1666 (users).
[13:50] Module loaded: server
[13:50] Module loaded: channels
[13:50] Module loaded: irc
[13:50] Module loaded: blowfish
[13:50] Module loaded: dns
[13:50] some-profile-script.tcl ver 0.666
[13:50] interviewer-addon.tcl ver 0.1b by tomekk loaded
[13:50] Userfile loaded, unpacking...
[13:50] === botty: 1 channels, 2 users.
Launched into the background (pid: 4756)
- priv13:40:13 <@tomekk> !setup myprofile
this example without any db implementation, just with PUTQUICK's echoes13:40:13 -!- Irssi: Starting query in 10 with botty
13:40:13 <botty> int_check_if_exists{}: tomekk tomekk@oswiecim.eu.org #kupa myprofile 0
13:40:13 <botty> int_new_profile_event{}: tomekk tomekk@oswiecim.eu.org #kupa myprofile
37ddc19f9ea6e0c8b1eee0d50ea5b140 1249558721
13:40:13 <botty> Hey! Your profile has been created, write: 'fill_me_now' if you want to update your profile
information now (3 extra questions about your person)
13:40:17 <botty> here is your key: 37ddc19f9ea6e0c8b1eee0d50ea5b140, save it, you will need it later for edit or
delete your profile
13:40:20 <tomekk> fill_me_now
13:40:20 <botty> 1. what is your age?
13:40:23 <tomekk> asd
13:40:23 <botty> only numbers are allowed (99 is max)
13:40:25 <tomekk> 22
13:40:25 <botty> int_answer_event{}: tomekk tomekk@oswiecim.eu.org myprofile 22 1249558733 age
13:40:26 <botty> 2. what is your sex?
13:40:33 <tomekk> hard to say
13:40:33 <botty> male, female or alien...
13:40:35 <tomekk> alien
13:40:35 <botty> int_answer_event{}: tomekk tomekk@oswiecim.eu.org myprofile alien 1249558743 sex
13:40:35 <botty> 3. where are you from?
13:41:00 <tomekk> home
13:41:00 <botty> int_answer_event{}: tomekk tomekk@oswiecim.eu.org myprofile home 1249558768 from
13:41:00 <botty> thanks for the answers, bye!
I'm thinking about the update/delete function.13:40:55 <botty> nick | uhost | profile | qidx | amode
13:40:55 <botty> tomekk | tomekk@oswiecim.eu.org | myprofile | 2 | 1
Code: Select all
# if you want to use commands from this script on your chan, type in eggdrop console (via telnet or DCC chat)
# .chanset #channel_name +intadd
# and later .save
# interviewer-addon config <cut>
# autostart of 'questions', without any extra word
set int_questions_auto_start 0
# regexp for !setup, !remove commands (default, only small and BIG letters are allowed)
set int_bind_regexp {^[a-zA-Z]+$}
# uniq key of each question
set int_questions_key {
"age"
"sex"
"from"
"fps"
"map"
"track"
}
# questions lists, one by one
set int_questions_list {
"1. what is your age?"
"2. what is your sex?"
"3. where are you from?"
"4. what is your fav FPS game?"
"5. what is your fav map?"
"6. what is your fav game music track?"
}
# questions regexps, one by one
set int_questions_regexp {
{^([0-9]{1,2})$}
{^(male|female|alien)$}
{.*}
{^(quake(1|2|3|4)|doom(1|2|3)|half life(1|2))$}
{.*}
{.*}
}
# questions help messages, one by one
set int_question_help {
"only numbers are allowed (99 is max)"
"male, female or alien..."
""
"quake1,2,3 or doom1,2,3 or half life1,2"
""
""
}
# bind for setup procedure
set int_bind(setup) "!setup"
# bind for remove procedure
set int_bind(delete) "!remove"
# bind for sessions procedure
set int_bind(sessions) "!sessions"
# bind for questions start
set int_bind(questions_start) "fillme"
# messages
set int_msg(int_start) "Hey! Your profile has been created, write: 'fillme' if you want to update your profile information now (3 extra questions about your person)"
set int_msg(int_key) "here is your key: &k, save it, you will need it later for update or delete your profile"
set int_msg(int_end) "thanks for the answers, bye!"
set int_msg(remove_start) "Hi, if you want to remove this profile you have to type your profile key now (paste it and press enter)"
set int_msg(remove_end) "profile has been successfully removed"
set int_msg(wrong_key) "you typed wrong key, if you want to try again, please use !remove <profile_name> again"
set int_msg(just_one_command) "you can use just one command in the same time, !setup or !remove"
set int_msg(profile_exists) "profile with that name already exists"
set int_msg(profile_not_exists) "profile with that name doesn't exists"
set int_msg(setup_already_in_use) "you can't use this command twice in the same time"
set int_msg(remove_already_in_use) "you can't use this command twice in the same time"
set int_msg(setup_profile_name_already_in_use) "someone is already making setup with that name"
set int_msg(remove_profile_name_already_in_use) "someone is already trying to remove profile with that name"
set int_msg(setup_help) "use: !setup <profile_name>"
set int_msg(remove_help) "use: !remove <profile_name>"
set int_msg(bind_help) "only small and BIG letters are allowed, sorry"
# interviewer-addon config </cut>
# procs from interviewer-addon to use in your script
# or if you want, you can use this script, but i think,
# it will be easier to include these procs in some other script
# this proc checks if some nick exists or not (in some DB),
# proc should return 0 - if profile doesn't exists, 1 - when profile exists
# proc takes 4 arguments, nick/uhost/chan of user and profile name
# write here some sql query, check some file - whatever...
proc int_check_if_profile_exists { nick uhost profile_name chan } {
putquick "PRIVMSG #debug :int_check_if_profile_exists{}: $nick $uhost $profile_name $chan r0"
return 0
}
# this proc checks if key is correct or not
# proc should return 1 - if is correct, 0 - if is not
# proc takes 4 arguments, nick/uhost of user, profile name and profile key
# write here some sql query, check some file - whatever...
proc int_check_if_key_is_correct { nick uhost profile_name profile_key } {
putquick "PRIVMSG #debug :int_check_if_key_is_correct{}: $nick $uhost $profile_name $profile_key r1"
return 1
}
# this proc is called when a profile needs to be removed
# proc takes 4 arguments, nick/uhost of user, profile name and action time
# write here some sql query, remove profile from some file - whatever
proc int_remove_profile_event { nick uhost profile_name action_time } {
putquick "PRIVMSG #debug :int_remove_profile_event{}: $nick $uhost $profile_name $action_time"
}
# this proc is called when new profile is created
# proc takes 6 arguments, nick/uhost/chan of user, profile name, profile key and action time
# write this to sql or some file - whatever...
proc int_new_profile_event { nick uhost chan profile_name profile_key action_time} {
putquick "PRIVMSG #debug :int_new_profile_event{}: $nick $uhost $chan $profile_name $profile_key $action_time"
}
# this proc is called after every answer
# proc takes 6 arguments, nick/uhost/profile name of user, answer, action time and question key
# write this to sql or some file - whatever...
proc int_answer_event { nick uhost profile_name arg action_time question_key } {
putquick "PRIVMSG #debug :int_answer_event{}: $nick $uhost $profile_name $arg $action_time $question_key"
}
priv, later:09:53:26 <@tomekk> !setup myprofile
actions during the interview, #debug:09:53:26 <botty> Hey! Your profile has been created, write: 'fillme' if you want to update your profile
information now (3 extra questions about your person)
09:53:26 <botty> here is your key: d7a6dad627a189a85e6e1165c26957a9, save it, you will need it later for update
or delete your profile
09:53:33 <tomekk> fillme
09:53:33 <botty> 1. what is your age?
09:53:35 <tomekk> 22
09:53:36 <botty> 2. what is your sex?
09:53:38 <tomekk> alien
09:53:38 <botty> 3. where are you from?
09:53:43 <tomekk> Poland
09:53:43 <botty> 4. what is your fav FPS game?
09:53:48 <tomekk> blood
09:53:48 <botty> quake1,2,3 or doom1,2,3 or half life1,2
09:53:51 <tomekk> quake2
09:53:52 <botty> 5. what is your fav map?
09:54:00 <tomekk> The Edge - q2dm1
09:54:00 <botty> 6. what is your fav game music track?
09:54:10 <tomekk> sonic mayhem - operation overlord
09:54:11 <botty> thanks for the answers, bye!
some other user, chan:09:53:26 < botty> int_check_if_profile_exists{}: tomekk tomekk@oswiecim.eu.org myprofile #kupa r0
09:53:26 < botty> int_new_profile_event{}: tomekk tomekk@oswiecim.eu.org #kupa myprofile
d7a6dad627a189a85e6e1165c26957a9 1250495495
09:53:36 < botty> int_answer_event{}: tomekk tomekk@oswiecim.eu.org myprofile 22 1250495504 age
09:53:38 < botty> int_answer_event{}: tomekk tomekk@oswiecim.eu.org myprofile alien 1250495507 sex
09:53:43 < botty> int_answer_event{}: tomekk tomekk@oswiecim.eu.org myprofile Poland 1250495512 from
09:53:52 < botty> int_answer_event{}: tomekk tomekk@oswiecim.eu.org myprofile quake2 1250495520 fps
09:54:00 < botty> int_answer_event{}: tomekk tomekk@oswiecim.eu.org myprofile The Edge - q2dm1 1250495528 map
09:54:11 < botty> int_answer_event{}: tomekk tomekk@oswiecim.eu.org myprofile sonic mayhem - operation overlord
1250495539 track
priv, later:09:53:26 < player2> !remove someprofile
#debug:09:55:13 <botty> Hi, if you want to remove this profile you have to type your profile key now (paste it and
press enter)
09:55:22 <player2> somemd5keyhere
!sessions (its just tool to see what is going on):09:55:13 < botty> int_check_if_profile_exists{}: player2 tomekk@10.0.1.10 myprofile #kupa r0
09:55:23 < botty> int_check_if_key_is_correct{}: player2 tomekk@10.0.1.10 myprofile somemd5keyhere r1
09:55:23 < botty> int_remove_profile_event{}: player2 tomekk@10.0.1.10 myprofile 1250495611
When I find some time,09:55:40 <botty> nick | uhost | profile | qidx | qkey | amode | pmode
09:55:40 <botty> tomekk | tomekk@oswiecim.eu.org | myprofile | 3 | fps | 1 | setup
09:57:19 <botty> player2 | tomekk@10.0.1.10 | someprofile | 0 | age | 0 | remove
Sorry. Was answering this yesterday and then work bit me on the bottom firmly.tomekk wrote:hi,
Which fields do you need there?
-age
-from aka location
-sex
what else?
I will make db for you, will be easier and faster.