Back Reply to topic
kardson 
(started thread)
Topfight Chicken 
Topics: 6
Posts: 38
Playing:  AOC
Ingame:  kardson
Years registered: * * * * * * * * * * * * * * * * *
Clean up debug output Posted: Post 04:14 Tue - Jul 01, 2008

Is there a way to make the bot reply with a PING instead of using a space ?


My ragebot log looks horrible because it is leaving a space every couple seconds instead of using the next line.

Example:
My Log looks like
Code:

            [10:56:53] Seen :: Loading history
[10:56:53] Seen :: loaded  01.07.2008 12:07:38
                                      [11:00:06] CB[20] :: [name lookup: 167808424 is
"Jenasin" (0)]
                                 [11:01:59] Saving guildmates
                  [11:01:59] Saving main characters
                                                   [11:07:05] Saving guildmates
[11:07:05] Saving main characters
        [11:07:48] CB[20] :: [name lookup: 167808424 is "Jenasin" (0)]
                                 [11:09:57] CB[20] :: [name lookup: 167864844 is "Roflestomp
" (0)]



I would like it to look like

Code:

[10:56:53] Seen :: Loading history
[10:56:53] Seen :: loaded  01.07.2008 12:07:38
[11:00:06] CB[20] :: [name lookup: 167808424 is "Jenasin" (0)]
[11:01:59] Saving guildmates
[11:01:59] Saving main characters
[11:07:05] Saving guildmates
[11:07:05] Saving main characters
[11:07:48] CB[20] :: [name lookup: 167808424 is "Jenasin" (0)]
[11:09:57] CB[20] :: [name lookup: 167864844 is "Roflestomp " (0)]

Reply with quote




Last edited by kardson on 04:36 Tue - Jul 01, 2008; edited 1 time in total
kardson 
(started thread)
Topfight Chicken 
Topics: 6
Posts: 38
Playing:  AOC
Ingame:  kardson
Years registered: * * * * * * * * * * * * * * * * *
Posted: Post 04:33 Tue - Jul 01, 2008

My guess is that the bot is doing pings to the chat server to keep itself connected. I am unable to find where this is at in the code though.

IF I Could find it. i would just add something like the following right after it.
say("PING!",1);

Giving something like this as the end result

Code:

[10:56:53] Seen :: Loading history
[10:56:53] Seen :: loaded  01.07.2008 12:07:38
[10:57:53] PING!
[10:58:53] PING!
[10:59:53] PING!
[11:00:06] CB[20] :: [name lookup: 167808424 is "Jenasin" (0)]
[11:01:59] Saving guildmates
[11:01:59] Saving main characters
[10:02:59] PING!
[10:03:59] PING!
[10:04:59] PING!
[10:05:59] PING!
[10:06:59] PING!
[11:07:05] Saving guildmates
[11:07:05] Saving main characters
[11:07:48] CB[20] :: [name lookup: 167808424 is "Jenasin" (0)]
[11:09:57] CB[20] :: [name lookup: 167864844 is "Roflestomp " (0)]
Reply with quote


Vrykolas 
Blue-Ribbon Chicken 
Topics: 0
Posts: 10
Playing:  Age of Conan
Ingame:  Vrykolas
Years registered: * * * * * * * * * * * * * * * * *
Posted: Post 04:45 Tue - Jul 01, 2008

It's a eol (end of line) issue between *nix and windows boxes -

for a windows box edit inc/bot_debug.php and replace the say function with:
Code:

function say($txt,$debug=false) {
   global $DEBUG;
   if (($debug&&$DEBUG)||(!$debug)) {
   
      if('WIN' == strtoupper(substr(PHP_OS,0,3)))
      {
         $txt = preg_replace('/(?:\r[^\n]|[^\r]\n)/", "\r\n", $txt);
         echo "[".date("h:i:s")."] $txt\r\n";
      }
      else if('MAC' == strtoupper(substr(PHP_OS,0,3)))
      {
         $txt = preg_replace('/(?:\r\n|\n)/", "\r", $txt);
         echo "[".date("h:i:s")."] $txt\r";
      }
      else
      {
         $txt = preg_replace('/(?:\r\n|\r)/", "\n", $txt);
         echo "[".date("h:i:s")."] $txt\n";
      }
   }
}


(I haven't tested this, but it should work... (even though it is a bit overkill))

Hope this helps
Reply with quote


kardson 
(started thread)
Topfight Chicken 
Topics: 6
Posts: 38
Playing:  AOC
Ingame:  kardson
Years registered: * * * * * * * * * * * * * * * * *
Posted: Post 05:59 Tue - Jul 01, 2008

Thanks Again Vrykolas
Minor correction to what you posted though

You started with a ' and ended with a "
Changed both to "

Code:

function say($txt,$debug=false) {
   global $DEBUG;
   if (($debug&&$DEBUG)||(!$debug)) {
   
      if('WIN' == strtoupper(substr(PHP_OS,0,3)))
      {
         $txt = preg_replace("/(?:\r[^\n]|[^\r]\n)/", "\r\n", $txt);
         echo "[".date("h:i:s")."] $txt\r\n";
      }
      else if('MAC' == strtoupper(substr(PHP_OS,0,3)))
      {
         $txt = preg_replace("/(?:\r\n|\n)/", "\r", $txt);
         echo "[".date("h:i:s")."] $txt\r";
      }
      else
      {
         $txt = preg_replace("/(?:\r\n|\r)/", "\n", $txt);
         echo "[".date("h:i:s")."] $txt\n";
      }
   }
}


Though the problem isn't with the debug going to the next line after typing something. The problem is that while the bot is idle and not doing anything it continue to space over every 5 seconds. So when the bot goes to print the next debug.. it appears over to the right alittle or alot. depending on how much time has past.

What I've done to correct his is added a \n to the front of the default say function.
Turning it into

Code:

function say($txt,$debug=false) {
   global $DEBUG;
   if (($debug&&$DEBUG)||(!$debug))
      echo "\n[".date("h:i:s")."] $txt\n";
}


This works good, now I just have a space between each line. Which honestly helps with reading it all lachen

Thanks for pointing out where the say function was at lachen
Reply with quote


Chaly 
Offizier · Webmaster 
Topics: 404
Posts: 2107
Location: Bad Honnef
Playing:  Guildwars2 (Drakkar See)
Ingame:  Chaly Flavour
Years registered: * * * * * * * * * * * * * * * * * * * * * *
Posted: Post 03:45 Wed - Jul 02, 2008

nice one.. i'll borrow your advancement if you don't bother about it? Reply with quote



_________________

Chalys Gimpnesstheory (2003) Die Theorie der expotentiellen Bullshits den Gimps bei gleichbleibendem Anteil produzieren.
kardson 
(started thread)
Topfight Chicken 
Topics: 6
Posts: 38
Playing:  AOC
Ingame:  kardson
Years registered: * * * * * * * * * * * * * * * * *
Posted: Post 06:34 Wed - Jul 02, 2008

As always,

Feel free to us whatever I tinker out.
Most of what I find is by luck/mistake
It's all for the greater good lachen
Reply with quote


Chaly 
Offizier · Webmaster 
Topics: 404
Posts: 2107
Location: Bad Honnef
Playing:  Guildwars2 (Drakkar See)
Ingame:  Chaly Flavour
Years registered: * * * * * * * * * * * * * * * * * * * * * *
Posted: Post 10:51 Wed - Jul 02, 2008

augen rollen thx, will be added to 0.7.2.
btw: i don't know if i'll fix the statuschange for /petition'ing ppl with this or the next release... on de-asura our guildmates change their status from 1 to 0 and back to 1 (online-offline-online) if they receive a tell from the petition-bot. the time between the statuschange is 100ms, but i have to save every change first, so i can check if the new status is set for at least let's say 2 seconds.. kopf gegen wand
Reply with quote



_________________

Chalys Gimpnesstheory (2003) Die Theorie der expotentiellen Bullshits den Gimps bei gleichbleibendem Anteil produzieren.
Back Reply to topic