[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
mr.luc
Registered User
Posts: 213
Joined: Mon Feb 24, 2003 4:09 pm
Contact:

Post by mr.luc »

I just found a way to show the bot in viewonline.php

(maybe i missed a previous post.. but upto now it only showed on index or the forums)

this method also calculates a realistic online time (bot is always there)
i use 184 minutes before the users session time. you could also use a random timeframe... but then it would change every time the page is reloaded

mt_rand is used to show the page the bot is on... this one changes every time the page is reloading.

you can also specify 2 forums it is surfing on ... (more could be added)

I'd like your opinion and suggestions!!! (and corrections)
demo on http://www.sunmod.net/forum/viewonline.php
(guess what.. wild betty is the bot)
do a page reload to follow her steps...


ok.. here it is:

in viewonline.php find

Code: Select all

$registered_users = 0;
replace with:

Code: Select all

if ( $board_config['iai_active_all'] == 1 ) 
{ 
	$registered_users = 1;
}
else
{
	$registered_users = 0;
}
then find:

Code: Select all

if ( $guest_users == 0 )
{
	$template->assign_vars(array(
		'L_NO_GUESTS_BROWSING' => $lang['No_users_browsing'])
	);
}
below add:

Code: Select all

if ( $board_config['iai_active_all'] == 1 )
{
 /********************************************************** 
config part which forums should the bot be browsing. choose 2! 
**********************************************************/ 
   $bot_forum_1 =1; 
   $bot_forum_2 =2; 
//   use this one if you want random time 
//   $sub_mins = mt_rand(100, 300); 

// use this one if you want a steady time
   $sub_mins = 184; // in minutes compared to the user looking at the page. 


/********************************************************** 
Configuration END 
**********************************************************/ 
	
	// now mt_rand so the page will change every reload.. 

	mt_srand((double)microtime()*1000000);
	$bot_loc = mt_rand(1, 11);
	
			switch( $bot_loc )
			{
				case 1:
					$bot_location = $lang['Forum_index'];
					$bot_location_url = "index.$phpEx";
					break;
				case 2:
					$bot_location = $lang['Posting_message'];
					$bot_location_url = "index.$phpEx";
					break;
				case 3:
					$bot_location = $lang['Logging_on'];
					$bot_location_url = "index.$phpEx";
					break;
				case 4:
					$bot_location = $lang['Searching_forums'];
					$bot_location_url = "search.$phpEx";
					break;
				case 5:
					$bot_location = $lang['Viewing_profile'];
					$bot_location_url = "index.$phpEx";
					break;
				case 6:
					$bot_location = $lang['Viewing_online'];
					$bot_location_url = "viewonline.$phpEx";
					break;
				case 7:
					$bot_location = $lang['Viewing_member_list'];
					$bot_location_url = "memberlist.$phpEx";
					break;
				case 8:
					$bot_location = $lang['Viewing_priv_msgs'];
					$bot_location_url = "privmsg.$phpEx";
					break;
				case 9:
					$bot_location = $lang['Viewing_FAQ'];
					$bot_location_url = "faq.$phpEx";
					break;

				case 10:
					$bot_location_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $bot_forum_1);
					$bot_location = $forum_data[$bot_forum_1];
					break;
				case 11:
					$bot_location_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $bot_forum_2);
					$bot_location = $forum_data[$bot_forum_2];
					break;
				default:
					$bot_location = $lang['Forum_index'];
					$bot_location_url = "index.$phpEx";

			}


	$bot_session_time = time() - ($sub_mins * 60); 
	$bot_time = create_date($board_config['default_dateformat'], $bot_session_time, $board_config['board_timezone']);
	  $show_bot = '<tr><td width="35%" class="row2">&<span class="genmed2"><a class="genmed2" href="' . append_sid('profile.' . $phpEx . '?mode=viewprofile&' . POST_USERS_URL . '=' . $board_config['iai_userid']) . '">' . $board_config['iai_username'] . '</a></span>&</td><td width="25%" align="center" nowrap="nowrap" class="row2">&<span class="genmed">'.$bot_time.'</span>&</td><td width="40%" class="row2">&<span class="genmed"><a href="'.$bot_location_url.'" class="genmed2">'.$bot_location.'</a></span>&</td> </tr>';

	$template->assign_vars(array(
		'SHOW_BOT' => $show_bot	)
	);
}

in viewonline_body.tpl

find:

Code: Select all

<!-- BEGIN reg_user_row -->
replace with:

Code: Select all

   {SHOW_BOT}
  <!-- BEGIN reg_user_row -->
now users will really think he/she is alive ;)
Last edited by mr.luc on Fri Apr 18, 2003 4:03 am, edited 2 times in total.
mr.luc
Registered User
Posts: 213
Joined: Mon Feb 24, 2003 4:09 pm
Contact:

Post by mr.luc »

a little bug repair:

in the private message part i have experienced that sometimes the bot answers very nicely and sometimes it doesn't take into consideration the questions...

so i added a print statement so see what it was answering to..

and i discovered 2 things:
1. at the moment where the bot considers the private message, it has just been added to the dbase and has slashes in it. A question with lots of ' (quotes) in it will not be answered to correctly.

to repair this open privmsg.php and find:

Code: Select all

$iai_root_path = $phpbb_root_path . "mods/iai/";
above add:

Code: Select all

			$privmsg_subject = stripslashes($privmsg_subject);
			$privmsg_message = stripslashes($privmsg_message);
it can be done safely because the 2 strings are only used to generate an answer. they are not used in any database operation anymore.

2. If there is no "Re:" in the subject, it should also take the subject into consideration.
but usually there is no delimiter. so it will answer to:
subject: "what's your name"
text: "hello there"

$iai_reply_to = "what's your name hello there"

this will generate a response to hello there only (depending on the subject line)

by adding a delimiter "." you can have it answer to both.

find in privmsg.php :

Code: Select all

$iai_reply_to = ( ( !preg_match('/^Re:/',  $privmsg_subject) ) ? $privmsg_subject . " " : "" ) . $privmsg_message;
replace with:

Code: Select all

$iai_reply_to = ( ( !preg_match('/^Re:/',  $privmsg_subject) ) ? $privmsg_subject . ". " : "" ) . $privmsg_message;
(only added a period ". " to the space between subject and message.)

thats all....
Epox
Registered User
Posts: 37
Joined: Sat Jan 12, 2002 7:42 am

Post by Epox »

My bot is a hit: http://www.teen-moods.net/forums/viewtopic.php?t=363

72 Pages in 3 days!

But... if you look at tyhe last few pages of the thread u will notice that our pal is having a problem keeping a member's location correct. I know he was programed to keep saying Atlanta but still.... :?

Anyway, I've oinly been able to find a few AIML packs, like 3 or 4... are there any packs that help recognise commonly mis-spelled words?

If not where is a good place to learn how to program AIML files?
I think I like this..
Antony
Registered User
Posts: 529
Joined: Wed Feb 12, 2003 9:06 am

Post by Antony »

beardeddone wrote:
Antony wrote: Antony, I am using this mod of yours and it works great using IE6, but doesn't show any text replies by bot when using Netscape v7.

Any fixes for this?
Sorry about the dealy.

I havn't tested this under any brower except for IE and Mozilla.

But it is using all the same code as the original bot page, I just added the phpBB templating around it.

You may want to try changing the colours ad checking you have javascript enabled but apart from that I don't know.
It works for me.
I've Been Banned!
mr.luc
Registered User
Posts: 213
Joined: Mon Feb 24, 2003 4:09 pm
Contact:

Post by mr.luc »

Epox wrote: 72 Pages in 3 days!

if i were you i would disable the add_to_search_index function...
imagine how big your dbase will get after 1 year! and if a user searches for anything he will allways get bot answers...
Epox wrote: But... if you look at tyhe last few pages of the thread u will notice that our pal is having a problem keeping a member's location correct. I know he was programed to keep saying Atlanta but still.... :?

the problem is the atlanta stuff is hard coded in the aiml files and will override the bots location you specify in cp.

i am trying to fix this with str_replaces but i don't know where yet.... if you have any ideas...
Epox wrote: If not where is a good place to learn how to program AIML files?


try http://www.pandorabots.com/pandora/pics ... orial.html
mr.luc
Registered User
Posts: 213
Joined: Mon Feb 24, 2003 4:09 pm
Contact:

Post by mr.luc »

just found one more "todo":

last online in profile.. bot just posted and was last online 2 months ago :cry:
User avatar
Evil Fish
Registered User
Posts: 111
Joined: Fri Mar 07, 2003 1:02 am
Contact:

Post by Evil Fish »

Epox wrote: My bot is a hit: http://www.teen-moods.net/forums/viewtopic.php?t=363

72 Pages in 3 days!

But... if you look at tyhe last few pages of the thread u will notice that our pal is having a problem keeping a member's location correct. I know he was programed to keep saying Atlanta but still.... :?

Anyway, I've oinly been able to find a few AIML packs, like 3 or 4... are there any packs that help recognise commonly mis-spelled words?

If not where is a good place to learn how to program AIML files?


dude, i read a bunch of those posts, your bot is fucking hillarious. I'm gonna install one on my board.
parad0x
Registered User
Posts: 93
Joined: Fri Apr 18, 2003 12:41 am
Contact:

AIML Sharing

Post by parad0x »

I've just made an AIML file and I thought I would share in the hopes of starting a sharing trend :D It is almost 18,000 lines and contains every possible file extension (well, all that I could come up with). When the letters of the extension could mean something else as well, I included it in her response. I also checked (to the best of my ability) to make sure that nothing conflicted with her basic AI.

Here is the basic format of the file:

Code: Select all

<category>
<pattern>DEFINE MPX</pattern>
<template>
Foxpro Compiler Menu or MS Project Export File
</template>
</category>
So, to see this in action, all you do is type "define mpx" or whatever file extension you want to know about (without the quotes).

Another example follows:

Code: Select all

<category>
<pattern>DEFINE DOG</pattern>
<template>
A dog is a domesticated mammal descended from the wolf or a Laughing Dog Screen Saver file
</template>
</category>
Hope this can be of use to someone, if not ... disreguard :) And please, if you have a custom AIML file, feel free to share. Thanks for a great mod guys, keep up the good work. Here is a link to the file: http://www.crucialpc.com/media/ext.zip

If you would like to test before you install this, it is loaded on the forum in my sig.
zemaj
Registered User
Posts: 267
Joined: Thu Mar 07, 2002 3:58 am
Location: Australia
Contact:

Post by zemaj »

Awesome. I'll add that to the standard AIML files if you want. Nice work!

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

Post by parad0x »

@zemaj
Yes please, feel free to include it. As time permits, I'll try to put out a few more. Once again, thanks for the great mod.

@everyone
I'll make no promises but, if anyone has any ideas for an AIML file, let me know and I'll see what I can do.
Jesse_tyler
Registered User
Posts: 103
Joined: Wed Apr 02, 2003 9:00 pm
Location: Idaho
Contact:

Post by Jesse_tyler »

When i try to upload some aiml files it keeps timing out :evil:
parad0x
Registered User
Posts: 93
Joined: Fri Apr 18, 2003 12:41 am
Contact:

Post by parad0x »

Some people are having problems with larger files. I think some of this is caused by PHP being in safe mode. You might want to try to break the larger files into multiple files. If you do this, be sure to include the required tags on each document.

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1"?>
<aiml version="1.0">

Put your data here

</aiml>
User avatar
Suede
Registered User
Posts: 342
Joined: Sat Dec 14, 2002 7:40 pm

Post by Suede »

beardeddone wrote:
Antony wrote:

Code: Select all

<?php 
define('IN_PHPBB',true); 


$phpbb_root_path = "./"; // set path to phpBB files 
include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.'.$phpEx); 
// 
// Start session management 
// 
$userdata = session_pagestart($user_ip, PAGE_LOGIN); // initiate session 
init_userprefs($userdata); // load user prefs 
// 
// End session management 
// 
$page_title = 'AI Chat'; 

if($userdata['session_logged_in']) 
{ // user is logged in 
include($phpbb_root_path . 'includes/page_header.'.$phpEx); 
echo "<table width=\"100%\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\" class=\"forumline\"><tr><th class=\"catHead\" height=\"25\"><b>AI Chat</b></th></tr><tr><td class=\"row1\" align=\"center\"><span class=\"gentblmed\"> 
"; 
?> 
<style type="text/css"> 
.mytextBox { width: 160px; } 
.mysub { width: 32px; } 
</style> 

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<script language="javascript" src="mods/iai/jsrs/jsrsClient.js"></script> 
<script language="JavaScript"> 
<!-- 

mycount=0; 

function saySomething(){ 

   mycount++; 

   myinput=document.forms['phpval']['ui'].value; 

   document.forms['phpval']['ui'].value=''; 

   document.all('ChatPane').innerHTML += '<span id="a' + mycount + '"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#FFFFFF">You: </font></b><font color="FFFFFF">' + myinput + '</font></font><BR></span>'; 
   document.all('a' + mycount).scrollIntoView(true); 

   jsrsExecute("mods/iai/jsrs/jsrs.php", myCallback, "replyjs", Array(myinput)); 
    
} 

function myCallback( returnstring ){ 

   mycount++; 

   document.all('ChatPane').innerHTML += '<span id="a' + mycount + '"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#FFFFFF">Trent: </font></b><font color="#FFFFFF">' + returnstring + '</font></font><BR></span>'; 
   document.all('a' + mycount).scrollIntoView(true); 

} 

// --> 
</script> 
</head> 

<body bgcolor="#2E425A" text="#000000" leftmargin="8" topmargin="3" marginwidth="3" marginheight="3" border="1"> 
<form name="phpval" onsubmit="saySomething();return false;"> 
<center> 
<br /> 
<div id="ChatPane" style="position:relative; width:402px; height:226px; z-index:1; overflow: auto; left: 0px; top: 0px; background-color: #2E425A; layer-background-color: #FFFFFF; border: 1px none #000000; padding: 3px"></div>
<br /> 
<div style="position:relative; width:201px; z-index:1; left: 0px; top: 0px; background-color: #2E425A; layer-background-color: #000043; border: 1px none #000043; padding: 2px"><input type="text" name="ui" class="mytextBox" value="Hello!"><input type="image" src="./../mods/iai/jsrs/talk.gif" align="top" border="0"></div></form> 
</center> 
<?php 
echo "</span></td></tr></table><br /> "; 
} 
else 
{ // not logged in 
header('Location: ' . append_sid($phpbb_root_path.'login.'.$phpEx.'?redirect='.$PHP_SELF, true)); 
} 

include($phpbb_root_path . 'includes/page_tail.'.$phpEx); 
?> 
I made this drop it in your root directory, and only logged in users may chat with the bot, edit the code to your forum theme.


Antony, I am using this mod of yours and it works great using IE6, but doesn't show any text replies by bot when using Netscape v7.

Any fixes for this?


might want to remove the </td></tr></table> from

Code: Select all

echo "</span></td></tr></table><br /> 
- Netscape is a stickler for tables and is very unforgiving if you have either too may closing tags or not enough... that might be it :)
Jesse_tyler
Registered User
Posts: 103
Joined: Wed Apr 02, 2003 9:00 pm
Location: Idaho
Contact:

Post by Jesse_tyler »

parad0x wrote: Some people are having problems with larger files. I think some of this is caused by PHP being in safe mode. You might want to try to break the larger files into multiple files. If you do this, be sure to include the required tags on each document.

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1"?>
<aiml version="1.0">

Put your data here

</aiml>


Is there anywhere where they already have all of them seperated into smaller files?
parad0x
Registered User
Posts: 93
Joined: Fri Apr 18, 2003 12:41 am
Contact:

Post by parad0x »

Not that I am aware of.
Locked

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