BeBot - An Anarchy Online and Age Of Conan chat automaton
Archive => Anarchy Online Archive => 0.4.x Custom/Unofficial Modules => Topic started by: Glarawyn on July 27, 2007, 09:04:55 pm
-
Module Name:
Return of the Quotes module, by Sabkor and Glarawyn!
Current Module Version:
2.0.1
Module Type:
Custom Module (Not Core)
Module Description:
We all say stupid things, and everyone wants to immortalize them.
Download:
Quotes 2.0.1 (http://zibby.isa-geek.net/BeBot_0.4/Quotes/Quotes_2.0.1.zip)
Changes from v2.0.0 to v2.0.1:
Changes from v1.5.0 to v2.0.0:
- Updated for BeBot 0.4
- Force use of MyISAM for Quotes table. (For search index)
- Quotes table can is shared between bots.
- Using Settings module instead of internal settings.
- Change addslashes() to mysql_real_escape_string()
-
Importing your Quotes from BeBot 0.2 to BeBot 0.4
- 1: Backup your existing quotes table:
# mysqldump --add-drop-table <olddatabase> --tables quotes -u <username> -p > quotes.sql
- 2: If you will be using the same database, drop your existing quotes table.
# mysql -u <user> -p <olddatabase>
mysql> DROP TABLE quotes;
- 3: Start your bot with the quotes module loaded.
- 4: Restore your quotes!
# mysql -u <user> -p <newdatabase> < quotes.sql
- 5: (Optional) Update the botname for your restored quotes.
# mysql -u <user> -p <olddatabase>
mysql> UPDATE quotes SET botname = 'Botname' WHERE botname = 'Import';
That's it, you're done.
-
line 363...
$inside = "Quotes Matching ".$searchterm.": \n\n";);
should be
$inside = "Quotes Matching ".$searchterm.": \n\n";
?
-
[29-Jul-2007 20:48:58] PHP Parse error: syntax error, unexpected ')' in C:\Bebot\custom\modules\Quotes.php on line 363
Makes me a sad panda :(
EDIT: Didn't read Dracutza's line properly. Good show old bean ;) Now works beautifully
-
While I don't know what the properly function mod is supposed to do, making my edit appears to break the search function if there are 2+ quotes with the same search phrase.
For example, !search Tziganca, when there is just one quote with Tziganca, works as intended.
/tell bot !search Tziganca
bot: Blah blah Tziganca
However, when there are two quotes with Tziganca, the bot give a blank reply
/tell bot !search Tziganca
bot:
So while that edit does enable the mof to run, I don't know if it's the proper edit to make it work.
-
I haven't been able to reproduce the issue Dracutza is reporting. Updated version without the typo posted.
-
works pretty nice, thanks
-
Hey, just noticed an issue that surfaced... I've deleted a few quotes from my database because they were kinda lame... But I noticed that the hole where the quote was remains empty.
This seems to screw the counting process. We have over 40 quotes, yet, it seems only recognize numbers 1-4 when searching for a quote ID. (#5 was one of the ones deleted).
Also, I'll add a quote, and it says its #41. However, when I do !quotes 41, it shows a completely different quote.
Any thoughts? :)
-
Bump
Also, any new quotes that are added all appear as being #41.
-
This is because the quote numbering relies on mysql's "auto increment" feature and it simply works that way. Fixing your "issue" would require working around default features of mysql, which imo, would be somewhat of a waste.
-
I think what he means is that since 41 is missing, all new quotes list themselves as 41.
So you have:
37
38
39
41
41
41
41
(That's just what I'm guessing he means, since I haven't played with it myself.)
-
41 is missing because someone deleted it, and since it uses auto increment, there wont be a 41 again.
-
So, what can I do? Do I need to go into the database and reorder them?
-
How are you getting the numbers. The ID-field is set as auto-increment in the database table so it must be an error with the way you get the IDs.
-
Having looked at the file linked in the first post I've got a suspicion that function add_quote() might be the cause of alement.
This _might_ be fixed by
function add_quote($strquote, $name)
{ // Start function add_quote()
$strquote = mysql_real_escape_string($strquote);
$name = mysql_real_escape_string($name);
$sql = "INSERT INTO #___quotes (quote, contributor, botname) ";
$sql .= "VALUES ('".$strquote."','".$name."','".$this -> bot -> botname."')";
$this -> bot -> db -> query($sql);
/*
$sql = "SELECT id FROM #___quotes ORDER BY id DESC";
$num = $this -> bot -> db -> select($sql);
*/
$num = mysql_insert_id($this -> bot -> CONN);
$strmsg = "Thank you, your quote has been added as id #" . $num;
return $strmsg;
} // End function add_quote()
Do note that I don't use this module myself and with the limited debug information this is to be concidere guesswork.
-
Hmm, that DOES seem to be a rather silly way of handling that. :)
-
The send_quote way of getting a random quote is horrible. Try this for a function send_quote instead:
function send_quote($qnum)
{ // Start function send_quote()
$strquote = "";
if($qnum == -1)
{
// Get a random quote
$sql = "SELECT * FROM #___quotes ORDER BY RAND() LIMIT 1";
$result = $this -> bot -> db -> select($sql, MYSQL_ASSOC);
if(!empty($result))
{
$strquote = "#" . $result[0]['id'] . " - " . $result[0]['quote'] . " [Contributed by: " . $result[0]['contributor'] . "]";
}
else
{
$strquote = "No quotes exist. Add some!";
}
}
else
{
//Get the quote with the given $qnum
$sql = "SELECT * FROM #___quotes WHERE id=".$qnum;
$result = $this -> bot -> db -> select($sql, MYSQL_ASSOC);
if (!empty($result))
{
$strquote = "#" . $result[0]['id'] . " - " . $result[0]['quote'] . " [Contributed by: " . $result[0]['contributor'] . "]";
}
else
{
$strquote = "Quote with id of " . $qnum . " not found.";
}
}
return $strquote;
} // End function send_quote()
Again I don't use this module so this code hasn't been tested.
-
using temar's 0.4 -> 0.5 support/conversion file, i can get quotes to load, and display but on !quote add test, a new quote is not submitted and an old one is displayed.
On dropping the table, and letting the mod create a new one... !quote add test gets me:
Fatal error: Cannot use string offset as an array in P:\bots\custom\modules\Quotes.php on line 274
last line is 274
// Get the ID of the highest quote.
$sql = "SELECT id FROM #___quotes ORDER BY id DESC LIMIT 1";
$result = $this -> bot -> db -> select($sql);
$num = intval($result[0][0]);
-
the table is empty and there is no check
because its empty it isnt an array but the line is treating it as if it was
-
ok but what about
bot: !quote add TEST TEST
bot: quote #33 blah blah
attempting to add a quote results in just another quote being displayed and nothing is submitted. as if the bot and the mod don't get past the whitespace after !quote.
-
applied blueeagle's suggestions
bot [2008-03-29 16:08:56] [TELL] [INC] Dracutza: !quote add test!
bot [2008-03-29 16:08:56] [TELL] [OUT] -> Dracutza: No quotes exist. Add some!
-
This module is currently quite broken.
I have got a module for 0.5.x but it's not backwards compatible and unfortunately I do not see myself having time to backport it anytime soon. :(
-
This module is currently quite broken.
I have got a module for 0.5.x but it's not backwards compatible and unfortunately I do not see myself having time to backport it anytime soon. :(
the one i have works just fine in 4... it's a 0.5 version I am looking for.
-
the one i have works just fine in 4... it's a 0.5 version I am looking for.
Oh. I juste assumed you wanted a 0.4-module since you're in the 0.4 module section of the forum..
The following does run on my bot, however I haven't tested it on a non-svn setup so it might not work out of the box.
-
did u try running the 0.4 version on your 0.5 bot useing this module too
http://bebot.link/0-5-x-customunofficial-modules/0-4_support-for-latest-0-5/
-
did u try running the 0.4 version on your 0.5 bot useing this module too
http://bebot.link/0-5-x-customunofficial-modules/0-4_support-for-latest-0-5/
yes. it displays old ones, but will not accept additions
-
The following does run on my bot, however I haven't tested it on a non-svn setup so it might not work out of the box.
doesn't for me.
it kills aorc when clicking the quote management interface
bot [2008-03-30 15:55:57] [TELL] [INC] Dracutza: quote add TEST TEST
bot [2008-03-30 15:55:57] [TELL] [OUT] -> Dracutza: Your quote has been added to the database
bot [2008-03-30 15:55:57] [TELL] [OUT] -> Dracutza: [link]Quote management interface[/link]
bot [2008-03-30 15:56:11] [PGRP] [MSG] [bot] Dracutza: !quote
bot [2008-03-30 15:56:11] [PGRP] [MSG] [bot] bot: Where were you
when Dracutza told me: ''?
funny... one version displays but does not accept, the other version accepts but does not display :P
-
funny... one version displays but does not accept, the other version accepts but does not display :P
actually blueeagles 0.5 version does not really accept new ones either. In viewing the DB, it creates a record, and records the owner, but the quote is left blank.
-
any chance of getting Glara's Quote 100% 0.5 compatible?
-
As a rule, I don't update my custom modules until we hit the release candidate stage of development.
If you want to pay me off in Supple bots or Combined Sharpshooter's armor or other in game loot that would be of interest I would be willing to shift game time to coding time. :)