Brenbot Code Questions [message #438876] |
Thu, 04 November 2010 14:11 |
|
Gen_Blacky
Messages: 3250 Registered: September 2006
Karma: 1
|
General (3 Stars) |
|
|
Danpual would this be a bad way to constantly update players credits or could this lag the fds. Call the pinfo timer when bot starts. Then everyone's credits are consistently updated every 30 seconds. Would it be better to get it from ssgm log instead of the console.
modules::pinfotimer();
#id,playername,score,team,ping,ip;port,kbps,0,0,0,credits,0
if ( $line =~ /(\d+),(.+),\d+,(\d+),\d+,.+;\d+,\d+,\d+,\d+,\d+,(\d+),.+/ )
{
my $id = $1;
my $name = $2;
my $team = $3;
my $credits = $4;
my ( $result, %player ) = plugin::getPlayerData( $id );
if ( $result == 1 )
{
# update credits
playerData::setKeyValue ( $id, "credits", $credits );
}
}
sub pinfotimer
{
POE::Session->create
(
inline_states =>
{
_start => sub
{
RenRemCMD( "pinfo" );
$_[HEAP]->{next_alarm_time} = int( time() ) + 30;
$_[KERNEL]->alarm( tick => $_[HEAP]->{next_alarm_time} );
},
tick => sub
{
RenRemCMD( "pinfo" );
$_[HEAP]->{next_alarm_time} = int( time() ) + 30;
$_[KERNEL]->alarm( restart => $_[HEAP]->{next_alarm_time} );
},
restart => sub
{
RenRemCMD( "pinfo" );
$_[HEAP]->{next_alarm_time} = int( time() ) + 30;
$_[KERNEL]->alarm( tick => $_[HEAP]->{next_alarm_time} );
},
}
);
}
[Updated on: Thu, 02 December 2010 13:02] Report message to a moderator
|
|
|
Re: Update pinfo [message #438879 is a reply to message #438876] |
Thu, 04 November 2010 15:46 |
|
danpaul88
Messages: 5795 Registered: June 2004 Location: England
Karma: 0
|
General (5 Stars) |
|
|
Gen_Blacky wrote on Thu, 04 November 2010 21:11 |
sub pinfotimer
{
POE::Session->create
(
inline_states =>
{
_start => sub
{
RenRemCMD( "pinfo" );
$_[HEAP]->{next_alarm_time} = int( time() ) + 30;
$_[KERNEL]->alarm( tick => $_[HEAP]->{next_alarm_time} );
},
tick => sub
{
RenRemCMD( "pinfo" );
$_[HEAP]->{next_alarm_time} = int( time() ) + 30;
$_[KERNEL]->alarm( restart => $_[HEAP]->{next_alarm_time} );
},
restart => sub
{
RenRemCMD( "pinfo" );
$_[HEAP]->{next_alarm_time} = int( time() ) + 30;
$_[KERNEL]->alarm( tick => $_[HEAP]->{next_alarm_time} );
},
}
);
}
|
You can simplify this bit to
sub pinfotimer
{
POE::Session->create
(
inline_states =>
{
_start => sub
{
$_[KERNEL]->yield('tick');
},
tick => sub
{
RenRemCMD( "pinfo" );
$_[HEAP]->{next_alarm_time} = int( time() ) + 30;
$_[KERNEL]->alarm( tick => $_[HEAP]->{next_alarm_time} );
}
}
);
}
To reduce code duplication. Also, unless you really need to store the alarm time on the heap, you can reduce
$_[HEAP]->{next_alarm_time} = int( time() ) + 30;
$_[KERNEL]->alarm( tick => $_[HEAP]->{next_alarm_time} );
To
$_[KERNEL]->alarm( tick => int( time() ) + 30 );
As for lagging the FDS, highly unlikely, but since BRenBot calls gameinfo and playerinfo every 20 seconds I don't see the point of calling yet another function for effectively the same thing?
|
|
|
|
|
Re: Update pinfo [message #438914 is a reply to message #438898] |
Fri, 05 November 2010 10:55 |
|
Gen_Blacky
Messages: 3250 Registered: September 2006
Karma: 1
|
General (3 Stars) |
|
|
danpaul88 wrote on Fri, 05 November 2010 09:19 | BRenBot calls the gameinfo and playerinfo commands every 20 seconds so that it has an up to date record of the game status (map, scores etc) and player information.
Every version of BRenBot since 0.1 has done this, if it didn't then BRenBot wouldn't work at all as it would have no clue what was happening in the game.
|
yea i understand that brenbot would have no idea unless you did that. You didn't understand my second question i see you update player_info all the time but not pinfo. player_info and pinfo have different outputs pinfo provides more details. Does brenbot 1.52 ever update pinfo because i could not find it.
>player_info 1
Id Name Score Side Ping Address Kbits/s Time
1 genblacky 0 NOD 66 192.168.1.1;55936 19 000.14.38
Total current bandwidth usage for players is 19 kilobits per second
>pinfo
>Start PInfo output
1,genblacky,0,0,50,192.168.1.1;55936,20,1,0,0,4409,-1.000000
End PInfo output
[Updated on: Fri, 05 November 2010 11:08] Report message to a moderator
|
|
|
|
Re: Update pinfo [message #440642 is a reply to message #438916] |
Thu, 02 December 2010 12:51 |
|
Gen_Blacky
Messages: 3250 Registered: September 2006
Karma: 1
|
General (3 Stars) |
|
|
im making a plugin that get peoples serial hashes from renlog
sub serial
{
my ( $session, $heap, $args ) = @_[ SESSION, HEAP, ARG0 ];
my $kernel = $_[KERNEL];
my $line = $args->{line};
my $name;
my $serial;
my $ip;
my $port;
my $verification;
if ($line =~ m/^Serial\shash\sresponse\sfrom\s(.+)\s\-\>\s(.+)\./)
{
$name = $1;
$serial = $2;
}
if ($line =~ m/^\[JOIN\]\s(.+)\s(.+)\s(.+)/)
{
$name = $1;
$ip = $2;
$serial = $3;
}
if ($line =~ m/^\[Serial\]\s(.+)\s(.+)/)
{
$name = $1;
$serial = $2;
}
if ( $line =~ /\(Game\)\s(.+)/ )
{
my $text = $1;
if ($text =~ m/Serial\sof\sclient\s\'(.+)\'\sis\s(.+)\./)
{
$name = $1;
$serial = $2;
brIRC::ircmsg ( "in serial 1 $name $serial", "A" );
}
if ($text =~ m/Client\s\'(.+)\'\s\((.+)\:(.+)\)\sconnected\./)
{
$name = $1;
$ip = $2;
$port = $3;
}
}
if ($line =~ m/(\d+)\s\|\s(.+)\s\|\s(.+)\s\|\s(.+)/)
{
$id = $1;
$name = $2;
$serial = $3;
$verification = $4;
brIRC::ircmsg ( "09[Serial] $name Verification $verification with serial $serial", "A" );
}
brIRC::ircmsg ( "serial $name $serial", "A" );
serialupdate( $name, $serial );
}
What is the appropriate way to use the renlog hook in the .xml file. What i have currently works but is their an easy way when using the hook.
<renlog_regex_hooks>
<hook event="serial" regex="^\[Serial\]|^\[Join\]|^Serial\shash\s|^\(Game\)\s(.+)\sSerial|^\(Game\)\s(.+)\sClient|^\(Game\)\s(.+)\sClient|^(\d+)\s\|\s(.+)\s\|\s(.+)\s\|\s(.+)" />
</renlog_regex_hooks>
[Updated on: Thu, 02 December 2010 12:52] Report message to a moderator
|
|
|
|
|
|
Re: Brenbot Code Questions [message #440712 is a reply to message #438876] |
Fri, 03 December 2010 12:08 |
|
Gen_Blacky
Messages: 3250 Registered: September 2006
Karma: 1
|
General (3 Stars) |
|
|
yes i could only have one source but if i ever released the plugin. People could have different server setups and it would still work. That was the whole point off adding multiple renlog lines. Like I use my ssgm plugin to get the serial but i know many people still use adads ssgm plugin. Having serials helps with security and helps identify spoofers even tho they can change their serial in 2 secs. If this serial doesn't match this name they are most likely not the right person.
Gen_Blacky wrote on Thu, 02 December 2010 13:51 |
What is the appropriate way to use the renlog hook in the .xml file. What i have currently works but is their an easy way when using the hook.
<renlog_regex_hooks>
<hook event="serial" regex="^\[Serial\]|^\[Join\]|^Serial\shash\s|^\(Game\)\s(.+)\sSerial|^\(Game\)\s(.+)\sClient|^\(Game\)\s(.+)\sClient|^(\d+)\s\|\s(.+)\s\|\s(.+)\s\|\s(.+)" />
</renlog_regex_hooks>
|
When using multiple renlog lines in 1 event
[Updated on: Fri, 03 December 2010 12:35] Report message to a moderator
|
|
|
|
|
|
Re: Brenbot Code Questions [message #440754 is a reply to message #440753] |
Sat, 04 December 2010 08:27 |
|
Hex
Messages: 858 Registered: March 2004
Karma: 0
|
Colonel |
|
|
Doing anything with serial hashes is a complete waste of time, the player can change it at will, stop wasting your time
goztow wrote on Tue, 11 May 2010 08:00 | If we had to ban all who ever cheated or ever created a cheat (obj3cts and such) then I don't think there would be many members left here (sad fact).
|
reborn wrote on Fri, 29 January 2010 23:37 | std is for pro's.
|
|
|
|