collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18366
  • stats Total Topics: 2501
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Suggestion for Bot->cut_size  (Read 3644 times)

0 Members and 1 Guest are viewing this topic.

Offline DocJones

  • BeBot Rookie
  • *
  • Posts: 15
  • Karma: +0/-0
Suggestion for Bot->cut_size
« 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
« Last Edit: August 24, 2007, 04:52:07 pm by DocJones »

Offline DocJones

  • BeBot Rookie
  • *
  • Posts: 15
  • Karma: +0/-0
Re: Suggestion for Bot->cut_size
« Reply #1 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.

Offline Ebag333

  • Contributor
  • *******
  • Posts: 134
  • Karma: +0/-0
Re: Suggestion for Bot->cut_size
« Reply #2 on: September 05, 2007, 06:55:32 am »
Please post it. :)

Offline DocJones

  • BeBot Rookie
  • *
  • Posts: 15
  • Karma: +0/-0
Re: Suggestion for Bot->cut_size
« Reply #3 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.

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]

* Who's Online
  • Dot Guests: 196
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal