BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => BeBot 0.4 support => Topic started by: DocJones on August 24, 2007, 11:16:41 am

Title: Suggestion for Bot->cut_size
Post by: DocJones on August 24, 2007, 11:16:41 am
Hi!

in bebot 0.4 the code for cut_size is this:
Code: [Select]
       
<..snippy..>
foreach($content as $line)
{
if ((strlen($result[$page]) + strlen($line) + 12) < $this -> maxsize)
$result[$page] .= $line . "\n";
else
{
$page++;
$result[$page] .= $line . "\n";
}
}
<..snippy..>

i suggest adding something like this:
Code: [Select]
<..snippy..>
foreach($content as $line)
{
if ((strlen($result[$page]) + strlen($line) + 12) > $this -> maxsize)  or (strpos($line,"\pb")>0 {
$page++;
$result[$page] .= $line . "\n";
} else {
$result[$page] .= $line . "\n";
}
}
<..snippy..>
Sorry, my php is not yet that skilled...
That way, we can force "pagebreaks".  I am programming a shop module and my shop list is constantly screwed up by pagebreaks.

just my 2ct, but it would be awasome, if something like this will come up.

regards
Title: Re: Suggestion for Bot->cut_size
Post by: DocJones on September 04, 2007, 04:13:58 pm
I finally set it up myself... was harder than expected, need to modify some function's in bot.php.

If anyone is interessted, let me know.
Title: Re: Suggestion for Bot->cut_size
Post by: Ebag333 on September 05, 2007, 06:55:32 am
Please post it. :)
Title: Re: Suggestion for Bot->cut_size
Post by: DocJones on September 05, 2007, 09:56:38 am
Okies ;)

here we go:
Main changes are in function cut_size.
Pagebreak sign is "@". "pages" will be added to output until size of output > max_size of a blob. then a break occurs.
If a single "page" is greater than max_size, it will be splitted after the newline character "\n" just as before.

I need to modify  send_tell, send_pgroup and send_gc as well, to filter out left over "@" signs - but i am unsure atm if these changes are still neccesary.

I am not that skilled php crack, so comments/suggesstions for improvement are more than welcome.
SimplePortal 2.3.7 © 2008-2024, SimplePortal