[ABD] Forum AI v0.2.0

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Locked
GrandiJoos
Registered User
Posts: 28
Joined: Tue Apr 01, 2003 7:21 pm
Location: Breda, The Netherlands
Contact:

Post by GrandiJoos »

I think I will wait since I dont see any public use for me. Its fun to play with it on my own computer (testing) but I dont rent that big a webspace.
And you will do a great job, placing everything in 1 post. Then you only have to say "look at that post" instead of "look at that topic (with 1.000+ posts)".
I'll shut up for now because its getting more like a chitchat than testing the bot :lol: .

GrandiJoos :cool:
parad0x
Registered User
Posts: 93
Joined: Fri Apr 18, 2003 12:41 am
Contact:

Topic Consolidation

Post by parad0x »

Last Updated: Sept 13, 2003

Just trying to consolidate everything since the release of Version 0.2.0
I may (and most likely have) left things out, as this has turned out to be a fairly large task. If you spot something that I need to add or change, please let me know. I will keep this post up to date as best I can. I hope this helps.


Name: Forum AI
Author: zemaj
Description: This mod with give your forums an "artificial intelligence" bot based on the ALICE system (Program E by Paul Rydell) which will respond to users' posts in your forum and chat with users.
Main download: http://www.phpbb.com/phpBB/viewtopic.php?t=24191
Project site: http://palgn.com/iai/
Prerequisites: PHP (4.0.4+) compiled --with-mysql and --with-xml and a recent version of MySQL 3.23.xx and Apache.


AIML files:
(make sure you know what you are doing if you choose to overwrite)
http://www.crucialpc.com/media/ext.zip (file extensions)
http://www.crucialpc.com/media/comp_terms.zip (computer terms)
http://www.crucialpc.com/media/jargon.zip (computer jargon)
http://www.crucialpc.com/media/Love_and_Fear.zip (phobias and such)
http://207.44.163.250/anna/anna_patched.zip
http://www.alicebot.org/downloads/
http://j-alice.sourceforge.net/
http://prdownloads.sourceforge.net/prog ... p?download
http://www.cocoanutstech.com/charliedownloads.html


Other third party files:
http://www.netclectic.com/forums/files/ ... uilder.zip


Q&A
Q. Can I delete the AIML files after I install them to the brain?
A. Yes, but you will need them again if you wipe the brain.

Q. My bot is stupid or makes no sense, what is wrong with her?
A. You most likely need to install more AIML files.

Q. Some of the AIML files time out when I try to install them, what do I do?
A. http://www.phpbb.com/phpBB/viewtopic.ph ... &start=984

Q. Can I make my own AIML files? Where should I start?
A. Yes. http://www.phpbb.com/phpBB/viewtopic.ph ... 542#767542

Q. I get an error similar to this: XML error: mismatched tag at line 15430
A. http://www.phpbb.com/phpBB/viewtopic.ph ... &start=987

Q. My bot will sometimes post her reply before my question, is there a fix? (pick one)
A. http://www.phpbb.com/phpBB/viewtopic.ph ... &start=480 (sleep method)
A. http://www.phpbb.com/phpBB/viewtopic.ph ... &start=867 (cron method)
A. http://www.phpbb.com/phpBB/viewtopic.ph ... &start=953 (php ver. of cron)

Q. How do I load multiple sets of AIML files, what if there are duplicates?
A. http://www.phpbb.com/phpBB/viewtopic.ph ... &start=922

Q. How do I keep the bot from replying to smilies?
A. http://www.phpbb.com/phpBB/viewtopic.ph ... &start=925

Q. My bot posts in response to me deleting a post. (pick one)
A. http://www.phpbb.com/phpBB/viewtopic.ph ... &start=878 (mr.luc fix)
A. http://www.phpbb.com/phpBB/viewtopic.ph ... &start=472 (netclectic fix)

Q. Will this MOD take up much space on my server?
A. It depends on how many AIML files you have installed. Mine is nearing 30meg in the db.

Q. I want the online/offline images to work with the bot.(2 diff versions)
A. http://www.phpbb.com/phpBB/viewtopic.ph ... &start=506
A. http://www.phpbb.com/phpBB/viewtopic.ph ... start=1139

Q. The bots name isn't colored like it should be.
A. http://www.phpbb.com/phpBB/viewtopic.ph ... &start=513

Q. I want my bot to look like she is always online, how do I do this? (do both)
A. http://www.phpbb.com/phpBB/viewtopic.ph ... &start=484
A. http://www.phpbb.com/phpBB/viewtopic.ph ... &start=486

Q. Can I make my bot look like she is doing something in the Who's online?
A. http://www.phpbb.com/phpBB/viewtopic.ph ... &start=964

Q. Will this work with the Last Visit mod by Niels?
A. Yes, do this: http://www.phpbb.com/phpBB/viewtopic.ph ... &start=493

Q. My bot doesn't seem to respond correctly when using PM.
A. http://www.phpbb.com/phpBB/viewtopic.ph ... &start=965

Q. I don't speak English well, are there any other languages available?
A. Yes, French, German, Indonesian, and Italian AIML are available here:
http://www.phpbb.com/phpBB/viewtopic.ph ... &start=965

Q. Is it possible to integrate this with the Prillian MOD?
A. Yes, http://www.phpbb.com/phpBB/viewtopic.ph ... start=1018

Q. Does this work with Shoutbox by Neils?
A. Yes, http://www.phpbb.com/phpBB/viewtopic.ph ... start=1031

Q. How do I keep my bots post count from increasing?
A. http://www.phpbb.com/phpBB/viewtopic.ph ... start=1134

Q. Where can I see a live demo of this?
A. There are several people in this thread that have listed their sites, some are down and some are live. You may also see a bot on the forum in my sig.
Last edited by parad0x on Sat Sep 13, 2003 7:32 pm, edited 5 times in total.
zemaj
Registered User
Posts: 267
Joined: Thu Mar 07, 2002 3:58 am
Location: Australia
Contact:

Re: Topic Consolidation

Post by zemaj »

WOW! Thanks!

I'll add this to the front page. Really, that's awesome. I'll see what I can do to get it into a release version.

I'm sooooooo tempted to use Program E v 0.8 (The newest version - currently IAI uses 0.7). It allows for multiple bots - other than that there's not much difference, but I'm a lot more experienced at coding now than I was when I first wrote the IAI code, so if I was to go through it again it would probably be a lot better.... hmmm... Arrggghhhh... If only I didn't have so much other work. I might try to pull an all nighter next week and get most of it done.

Many, many thanks for doing that though.

BTW - with the new line thing... there's no easy way. You see since the bot has to b able to respond both in the forum and on the chat pane it's not possible to add something that will work for both. The <br /> should work for the chat pane and \n should work for the forum. However with the forum I think I might have actually added some code there to stop newline's being processed, because if the bot is responding to several sentences you get some very wierd formatting in your responses.

-zem
parad0x
Registered User
Posts: 93
Joined: Fri Apr 18, 2003 12:41 am
Contact:

Post by parad0x »

Don't mention it zemaj. I'm just happy to be able to help in some small way on this one.

Thanks for the info on the line breaks. At least I know what I'm up against now. I tend to be a very stubborn person, so I'm sure I will continue to poke at this. I can't help but think that there has to be a way to do a very "selective" line break, so as not to cause formatting problems elsewhere. If I get anything to work properly, I'll be sure to let you know.

Also, I have plans for more AIML files (as time permits). I think as time goes by and I feel more at home with AIML, the files should start getting more complex and "life like" for lack of a better word. However, let me caution everyone on this ... if you have limited space available for your database, you might want to be selective with your AIML file installs. My IAI tables are nearing 30meg and are sure to grow much larger as I include new files. Since size is not a factor with me, I will continue to stuff my bot with as much information as I can come up with (and will post here for those that want them). If however size is a concern for you, you should maybe stick with the AIML files that come with the MOD and the core ALICE AIML files (as those are the most important) ... then, if you still have space to burn, toss in a few of the others. The more quality AIML files you load, the more she will know, but my files by themselves would turn your bot into an idiot savant :wink:

sorry for being so long winded :?
mr.luc
Registered User
Posts: 213
Joined: Mon Feb 24, 2003 4:09 pm
Contact:

Post by mr.luc »

another thought.. for the forum.. and concerning line breaks..
is there a way, if your board has not html enabled, that you enable html just for the bot postings... some posts like: <condition>blabal </condition> would then disapear...
Textus
Registered User
Posts: 5
Joined: Thu May 01, 2003 3:40 pm

Post by Textus »

Hmmm Strange...
Why do I get this error when I install:

Running :: ALTER TABLE 1f_forums ADD iai_override TINYINT(1) DEFAULT '0' NOT NULL -> FAILED ---> Access denied for user: 'temporalstudios_to_j_com@localhost' to database 'temporalstudios_to_j_com'

Running :: ALTER TABLE 1f_forums ADD iai_percentage INT(3) DEFAULT '0' NOT NULL -> FAILED ---> Access denied for user: 'temporalstudios_to_j_com@localhost' to database 'temporalstudios_to_j_com'

Running :: ALTER TABLE 1f_forums ADD iai_stop_words TINYINT(1) DEFAULT '1' NOT NULL -> FAILED ---> Access denied for user: 'temporalstudios_to_j_com@localhost' to database 'temporalstudios_to_j_com'

The rest turn out fine!
In fact the AI Forum panel can be seen in the administrative panel but I just couldn't configure it. It says:

Couldn't update Forum AI configuration.

This mod is designed for MySQL so please contact the author if you have troubles. If you can offer a translation of the SQL into other database formats, please send them to:
zemaj@palgn.com

DEBUG MODE

SQL Error : 1054 Unknown column 'iai_override' in 'field list'

UPDATE 1f_forums SET iai_override = '', iai_stop_words = '1', iai_percentage = '0' WHERE forum_id = '1'

Line : 89
File : /home/vhosts/temporalstudios.to-j.com/1f-ex/admin/admin_iai_forum.php

:? I wonder what is wrong?
Trust
Registered User
Posts: 175
Joined: Sun May 12, 2002 10:51 am
Location: Europe, The Netherlands, Zwijndrecht
Contact:

Post by Trust »

The D.aiml is totally screwed. I must change a lot lines becuase there're errors in it.
Dr DLP
Registered User
Posts: 527
Joined: Sat Mar 29, 2003 5:34 pm
Location: France
Contact:

Post by Dr DLP »

Hello ,
This mod seems more than interesting !
How can I do to translate it in french ?
parad0x
Registered User
Posts: 93
Joined: Fri Apr 18, 2003 12:41 am
Contact:

Post by parad0x »

@mr.luc I think I have my line breaks under control but am still waiting to see if there are any drawbacks to what I have done. I think I know the reason zemaj disabled this (please correct me if I am wrong). In the forum, if it sees a hard enter from the AIML file it will produce a line break. So, depending on how the AIML files were edited (if they used hard enters) it could make for some horrible formatting on the bots part. If you are after line breaks (in the forum alone), here is what I have done:

Code: Select all

# 
#-----[ Open ]------------------------------------------ 
# 
mods\iai\includes\iai_functions.php 
# 
#-----[ FIND ]------------------------------------------ 
# 
	$finalanswer = str_replace("\n", " ", $finalanswer);
# 
#-----[ REPLACE, WITH ]------------------------------------------ 
# 
//  Commented to Allow hard enter line breaks in forum
//	$finalanswer = str_replace("\n", " ", $finalanswer);
//  Commented to Allow hard enter line breaks in forum
# 
#-----[ SAVE/CLOSE ALL FILES ]---------------------------------
# 
# EoM
@zemaj If you can give me a specific example (that I can reproduce) of when this could cause a formatting problem, I would be grateful. I would really like to be able to cause line breaks, so if you can show me when this causes a problem, I could maybe come up with a work-around.

@mr.luc If you still want to enable html for the bot, you might want to start with this http://www.phpbb.com/phpBB/viewtopic.ph ... html+admin With this, you would have to make your bot an ADMIN (or change the code to MOD) to use html. LOL, I think I would have bad dreams at night if my bot were an ADMIN/MOD on my board. I would hate to try to login and find out that the bot had a misfire and banned me :roll: I haven't tried this, but I would think you could adapt the mod to look for a user_id or even a username instead of user_level. That way, you wouldn't have to change the user_level of your bot but she could still use html.

Also made this change in my iai_functions.php to allow for the bot to post URLs. Before, she would post like this www. yahoo. com with spaces in the URL

Code: Select all

# 
#-----[ Open ]------------------------------------------ 
# 
mods\iai\includes\iai_functions.php 
# 
#-----[ FIND ]------------------------------------------ 
# 
	$finalanswer = str_replace(".", ". ", $finalanswer);
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	$finalanswer = str_replace("www. ", "www.", $finalanswer);
	$finalanswer = str_replace(". com", ".com", $finalanswer);
	$finalanswer = str_replace(". org", ".org", $finalanswer);
	$finalanswer = str_replace(". net", ".net", $finalanswer);
# 
#-----[ SAVE/CLOSE ALL FILES ]---------------------------------
# 
# EoM
This still doesn't account for subdomains like forum.crucialpc.com It will still add a space in the URL for sub domains, but I'm not sure there is a way around it.

@Dr DLP There is a French (as well as a few other languages) AIML located here http://www.alicebot.org/downloads/
zemaj
Registered User
Posts: 267
Joined: Thu Mar 07, 2002 3:58 am
Location: Australia
Contact:

Post by zemaj »

I mean that if you have a response to one sentence then another with the line break in it, then, then another without the line break, the output will look something like this:

Code: Select all

Hi, I was just wanting to talk to you. No I don't, but it could be:
Good or
Bad. Enough about me, let's talk about my dress.
I guess as long as you put line breaks before and after ie:

Code: Select all

Hi, I was just wanting to talk to you.
No I don't, but it could be:
Good or
Bad.

Enough about me, let's talk about my dress.
It might be ok. You might want to think about that.

-zem
mr.luc
Registered User
Posts: 213
Joined: Mon Feb 24, 2003 4:09 pm
Contact:

Post by mr.luc »

@paradox
wow!!!!

great job!!!

(he he the funny thing is -like everybody- you talk about the bot being of the opposite sex "she" :wink: )
--------------------------
you are right!! (concerning the bot admin) :mrgreen:

i think i'll just fix it by using the $bot_name to enable the html...
in that case (and as am not using the chat) i will test the replacement of /n by <br />

--------------------------

I have just finished a PM delay for the bot... but i have no time to release it as a mod (i am leaving on a 10 day buiseness trip) in an hour...
can be tested on my site.. as it is not officially online yet.. you can register and play around.. i'll have to clean it up anyway before going public...

I'll see what i can do releasing it when i come back...

-------------------------

I'll also think of a todo list while i'm gone

-------------------------
zemaj
Registered User
Posts: 267
Joined: Thu Mar 07, 2002 3:58 am
Location: Australia
Contact:

Post by zemaj »

parad0x wrote:

Code: Select all

# 
#-----[ Open ]------------------------------------------ 
# 
mods\iai\includes\iai_functions.php 
# 
#-----[ FIND ]------------------------------------------ 
# 
	$finalanswer = str_replace(".", ". ", $finalanswer);
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	$finalanswer = str_replace("www. ", "www.", $finalanswer);
	$finalanswer = str_replace(". com", ".com", $finalanswer);
	$finalanswer = str_replace(". org", ".org", $finalanswer);
	$finalanswer = str_replace(". net", ".net", $finalanswer);
# 
#-----[ SAVE/CLOSE ALL FILES ]---------------------------------
# 
# EoM
This still doesn't account for subdomains like forum.crucialpc.com It will still add a space in the URL for sub domains, but I'm not sure there is a way around it.


The way to get around it would be to use pattern matching - I'm not good enough at it to be able to write the code for it though.

-zem
Dr DLP
Registered User
Posts: 527
Joined: Sat Mar 29, 2003 5:34 pm
Location: France
Contact:

Post by Dr DLP »

I am sorry if th e question has already been asked .
Does this wonderful mod work with Lycos ?
Because I have many errors .
Wyr!H@x!mu$
Registered User
Posts: 802
Joined: Fri Jan 24, 2003 12:06 pm
Location: Koedijk, Alkmaar, The Netherlands
Name: Cees-Jan
Contact:

Post by Wyr!H@x!mu$ »

Hi,

I intergrated IAI within The Prillian MOD:
http://www.phpbbhacks.com/viewhack.php?id=1307
#################################################################
## Mod Title: Prillian witn IA
## Mod Version: 0.1.1
## Author: WyriHaximus < webmaster@web-texh.tk > (Cees-Jan Kiewiet) http://www.web-texh.tk/
## Description: This mod will add IA to Prillian.
##
## Installation Level: easy
## Installation Time: less then 5 Minutes
##
## Files To Edit: /includes/page_header.php
## /mods/prillian/im_send.php
##
#################################################################
## Security Disclaimer: This MOD Cannot Be Posted To Or Added At Any Non-Official phpBB Sites
#################################################################
##
## Author Note:
##
## You need the IAI mod, you can download it @ palgn.com/iai
##
## PLEASE place questions @ my forum: http://www.web-texh.tk/
##
##################################################################
##
## Chancelog:
##
## 0.1.0 Initial release
## 0.1.1 Install file change
##
#################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#################################################################
#
#-----[ OPEN ]------------------------------------------
#
/includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
WHERE u.user_id = s.session_user_id
AND s.session_time >= ".( time() - 300 ) . "
$user_forum_sql
#
#-----[ REPLACE WITH ]------------------------------------------
#
WHERE (u.user_id = s.session_user_id
AND s.session_time >= ".( time() - 300 ) . "
$user_forum_sql) OR u.username = '".$board_config['iai_username']."'
#
#-----[ OPEN ]------------------------------------------
#
/mods/prillian/im_send.php
#
#-----[ FIND ]------------------------------------------
#
if( $save_sent_im )
{
save_a_copy(PRIVMSGS_SAVED_OUT_MAIL, $to_userdata['user_id'], $msg_time, $html_on, $bbcode_on, $smilies_on, $attach_sig, $bbcode_uid, $instant_message, $instant_subject);
}
#
#-----[ AFTER, ADD ]------------------------------------------
# (replace mods/iai/ with your path to the iai mod)
if($to_userdata['username']==$board_config['iai_username'])
{
$iai_root_path = "mods/iai/";
include($iai_root_path.'includes/iai_functions.'.$phpEx);
//Init IAI vars
$iai_mode = 'reply';
$iai_post_id = '';
$iai_id = $board_config['iai_userid'];
$iai_subject = '';
$iai_username = $board_config['iai_username'];
$iai_topic_type = POST_NORMAL;

//Get IAI reply (first tell who you are)
$numselects = 0;
$iai_reply_to_name = $userdata['username'];
$iai_reply_to = 'My name is ' . $userdata['username'] . '. ';
// Note: I'm using the user_id as the unique id if the user is logged in, here
$myuniqueid = ($userdata['session_logged_in']) ? $user_id : session_id();
$iai_reply = @reply($iai_reply_to,$myuniqueid);
$iai_message = $iai_reply->response;
$iai_reply_to = str_replace("is " . $iai_username, "are you", $instant_message);
$iai_reply_to = str_replace( $iai_username, "you", $instant_message);
$iai_reply = @reply($iai_reply_to,$myuniqueid);
$iai_message = $iai_reply->response;

// prepare IAI message(IAI may have used html, smilies etc...)
//$bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';
$iai_message = str_replace("'", "''", $iai_message);
// This is to fix up some of the bad formatting which comes out of the AI
$iai_message = str_replace(".", ". ", $iai_message);
$iai_message = str_replace("!", "! ", $iai_message);
$iai_message = str_replace("?", "? ", $iai_message);

$sql_info = "INSERT INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig)
VALUES (" . IM_NEW_MAIL . ", '" . "Re:" . str_replace("\'", "''", $instant_subject) . "', " . $to_userdata['user_id'] . ", " . $userdata['user_id'] . ", $msg_time, '$user_ip', 1, 1, 1, 1)";

if ( !($result = $db->sql_query($sql_info, BEGIN_TRANSACTION)) )
{
$msg = 'Could not insert instant message sent info.' . $lang['Close_window_link'];
message_die(GENERAL_ERROR, $msg, "", __LINE__, __FILE__, $sql_info);
}

$im_msg_sent_id = $db->sql_nextid();

$sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)
VALUES ($im_msg_sent_id, '" . $bbcode_uid . "', '" . str_replace("\'", "''", $iai_message) . "')";

if ( !$db->sql_query($sql, END_TRANSACTION) )
{
$msg = 'Could not insert instant message sent text.' . $lang['Close_window_link'];
message_die(GENERAL_ERROR, $msg, "", __LINE__, __FILE__, $sql);
}
}
#
#-----[ FIND ]------------------------------------------
#
$sql = "UPDATE " . IM_PREFS_TABLE . "
SET new_ims = new_ims + 1
WHERE user_id = " . $to_userdata['user_id'];
if ( !$status = $db->sql_query($sql) )
{
$msg = 'Could not update instant message new status for user' . $lang['Close_window_link'];
message_die(GENERAL_ERROR, '', '', __LINE__, __FILE__, $sql);
}

$sql = "UPDATE " . IM_PREFS_TABLE . "
SET total_sent = total_sent + 1
WHERE user_id = " . $im_userdata['user_id'];
if ( !$status = $db->sql_query($sql) )
{
$msg = 'Could not update total sent instant message for user' . $lang['Close_window_link'];
message_die(GENERAL_ERROR, '', '', __LINE__, __FILE__, $sql);
}
#
#-----[ AFTER ADD ]------------------------------------------
#
if($to_userdata['username']==$board_config['iai_username'])
{
$sql = "UPDATE " . IM_PREFS_TABLE . "
SET new_ims = new_ims + 1
WHERE user_id = " . $userdata['user_id'];
if ( !$status = $db->sql_query($sql) )
{
$msg = 'Could not update instant message new status for user' . $lang['Close_window_link'];
message_die(GENERAL_ERROR, '', '', __LINE__, __FILE__, $sql);
}

$sql = "UPDATE " . IM_PREFS_TABLE . "
SET total_sent = total_sent + 1
WHERE user_id = " . $userdata['user_id'];
if ( !$status = $db->sql_query($sql) )
{
$msg = 'Could not update total sent instant message for user' . $lang['Close_window_link'];
message_die(GENERAL_ERROR, '', '', __LINE__, __FILE__, $sql);
}
}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM


plz tell me what you think about it.

Grtz,
WyriHaximus
Last edited by Wyr!H@x!mu$ on Thu May 08, 2003 10:53 am, edited 2 times in total.
Antony
Registered User
Posts: 529
Joined: Wed Feb 12, 2003 9:06 am

Post by Antony »

HOw about adding it to Shoutbox, by Neils?
I've Been Banned!
Locked

Return to “[2.0.x] MODs in Development”