This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Problem with phpbb2egg

Support & discussion of released scripts, and announcements of new releases.
Locked
User avatar
jsilvestre
Voice
Posts: 20
Joined: Sat Mar 05, 2005 6:02 am
Location: Lisbon, Portugal

Problem with phpbb2egg

Post by jsilvestre »

I use phpbb2egg tcl but when have a new post or any action in forum bot show an error in partyline and the script don´t work.
The error is: Tcl error: no value given for parameter "idx" to "phpbb2eggaccept"
phpbb2egg.tcl
# found on egghelp.org a posting by ShavdApe about a phpbb2egg script
# to post live into a channel when a post on a board is made
# add the line source/phpbb2egg.tcl into your .conf and rehash the bot

# you can change the port here, but pls think about to change it to
# the same port on functions_phpbb2egg.php:
listen 6551 script phpbb2eggaccept

proc phpbb2eggaccept {idx} {
control $idx phpbb2eggincoming
}

proc phpbb2eggincoming {idx args} {

putlog "$args"
set line [join $args]
if {[join $args] != "" } {
set chan [lindex $line 0]
set line [lrange $line 1 end]
set line [join $line]
set line [split $line ";"]
foreach line $line { putserv "PRIVMSG $chan :$line" }
putlog "$line"
}
killdcc $idx
}
putlog "phpbb2egg.tcl Loaded..."

functions_phpbb2egg.php
<?php
// version 1.0.1 beta[development]

$channel = "#fiodental";
$ids = "1 2 3 4 5"; // forums to display posts from
$botip = "207.44.155.125"; // your bot's ip
$botport = "6551"; // a nice port
$boardurl = "www.fiodental.net/forum";

function send2egg($mode, $forumid, $topic_id, $user_id, $subject, $message, $poll_title, $channel, $ids, $botip, $botport, $boardurl )
{
global $userdata;

$nick = $userdata[$user_id];

//strip BBCode off
$message = preg_replace("#\[(.*?)]#si", "", $message);

// shorten longer postings to 300 signs
$text = wordwrap($message, 300, "\0") . ' ...';


//here we ask for several cases and do some formating stuff with tcl readable colors.
if ( $poll_title != '' )
{
$text2 = "\00300,02 New poll! \00301,99 on our board:<br>";
}
else if ( $mode = 'newtopic' )
{
$text2 = "\00300,02 New topic! \00301,99 on our board:<br>";
}
else
{
$text2 = "\00300,02 Fresh! \00301,99 from our board:<br>";
}

if ( $poll_title != '' )
{
$text2 .= "\00300,04 $nick \00302,99 asks: $poll_title <br>";
}

else if ( $subject != '' )
{
$text2 .= "\00300,04 $nick \00302,99 about the subject $subject :<br>";
$text2 .= " \00302,99 $message <br>";
}

else
{
$text2 .= "\00300,04 $nick".":";
$text2 .= " \00302,99 $message <br>";
}



$text2 .= " Link: \00312,99 $boardurl/viewtopic.php?t=$topic_id ";

$chan = checkid( $forumid, $channel, $ids );

phpbb2egg($chan, $text=$text2, $botip, $botport );

}



function phpbb2egg( $channel, $text, $botip, $botport)
{
if ( $channel == '' || $text == '') {
return;
}

$text = ereg_replace(";", ":", $text);
$text = ereg_replace("<br>", ";", $text);

$line = "$channel $text";

$socket = @fsockopen ($botip, $botport, $null, $null, 60);

if (!$socket)
{
echo " no connection made ";
}
if ($socket) {
@fputs($socket,"$line\n");

for($i=0;$i<400000;$i++)
{
$g=$i;
}
fclose($socket);
}
}


// a little tricky from unknown
function checkid($forumid, $channel, $ids )
{

$public[forumids] = " $ids ";
$public[chan] = " $channel ";

$forumids=explode(" ", $public[forumids]);

while ( list($n, $id) = each($forumids))
{

if ($forumid == $id)
{
return "$public[chan]";
}

}

return "";
}



?>
i wait for yours sugestions :)
Best Regards

José Eduardo Silvestre
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

next time use

Code: Select all

 tag when pasting code[/b]

remove that for($i=0;$i<400000;$i++) from your PHP script

use .set errorInfo from eggdrop's party line to obtain full error traceback
User avatar
jsilvestre
Voice
Posts: 20
Joined: Sat Mar 05, 2005 6:02 am
Location: Lisbon, Portugal

Post by jsilvestre »

.set errorInfo

Code: Select all

Currently: list element in braces followed by "ngel" instead of space
Currently:     while executing
Currently: "lindex $arg 5"
Currently:     (procedure "raw_352" line 3)
Currently:     invoked from within
Currently: "raw_352 $_raw1 $_raw2 $_raw3"
Best Regards

José Eduardo Silvestre
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

hmm, I believe "set line [join $args]" should " set line [split $args]"
btw. there are known issues with the var name "args", better use arg or something like this.
your error leads to this TCL FAQ entry:
http://forum.egghelp.org/viewtopic.php?t=2603
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
User avatar
AxS
Halfop
Posts: 46
Joined: Wed Apr 09, 2003 11:57 am

Post by AxS »

Is anyone able to write a working script or a modification of the one available to make it work? Really want this script running... so far i got the eggdrop saying lost telnet connection, eitherway - if you guys have it running and working - please point me in the right direction - if not, can someone clever enough, which i'm sure one of you here is, write a script... its something which I find very useful.

Many thanx
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

many people have been requesting this, noone delivered - so if you really want it that bad, pay someone to write it for you
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
User avatar
AxS
Halfop
Posts: 46
Joined: Wed Apr 09, 2003 11:57 am

Post by AxS »

Thanx, that helps alot!
Locked