Back Reply to topic
Goto page 1, 2, 3  Next
kardson 
(started thread)
Topfight Chicken 
Topics: 6
Posts: 38
Playing:  AOC
Ingame:  kardson
Years registered: * * * * * * * * * * * * * * * * *
whois with playfield names Posted: Post 05:10 Tue - Jun 24, 2008

as of Version 0.6 of Ragebot. It does not support packet 20 requests. So unless the buddy goes from a afk state or logs off and on while in the buddy list. It might not see the zone change.

This should be corrected in 0.7 ? hopefully.
So for now, don't believe what ID this reports back to you.
It is valid code and should work as intended once packet 20s are accepted.

Code:

<?php
if (!function_exists('playfieldname')) {
/****** Translates a zoneid to its name
******* Thanks: kardsen, www.devotion-guild.com
******/
function playfieldname($playfieldnumber) {
   switch($playfieldnumber) {
     case 197480: return "Tarantia Noble District";
     case 205612: return "The Old Smugglers Route";
     case 205838: return "Villa Amiel";
     default: return "Unknown(".$playfieldnumber.")";
   }
 }
}
?>
Reply with quote




Last edited by kardson on 05:35 Wed - Jun 25, 2008; edited 6 times in total
Chaly 
Offizier · Webmaster 
Topics: 404
Posts: 2107
Location: Bad Honnef
Playing:  Guildwars2 (Drakkar See)
Ingame:  Chaly Flavour
Years registered: * * * * * * * * * * * * * * * * * * * * * *
Posted: Post 08:30 Tue - Jun 24, 2008

nice one. would be a nice tool for !whois or !online
currently there are only two ways to add a function to the bot: add an include or edit the defaultcode. second way is adding a 5000ms plugin "playfield" with a code like this so ppl can add and update your playfield plugin without editing the 'standard' code:
Code:
<?php
if (function_exists('playfieldname')) return;
/****** Translates a zoneid to its name
******* Thanks: kardsen, www.devotion-guild.com
******/
function playfieldname($playfieldnumber) {
   switch($playfieldnumber) {
       case 177437: return "Thunder River";
      case 182575: return "Poitain";
      case 185805: return "Tarantia Noble District";
      default: return "Unknown(".$playfieldnumber.")";
   }
}
?>

maybe i should really think about a plugin section "onload" to save some cpu-power..
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 03:54 Tue - Jun 24, 2008

On your recommendation I changed the addon as described above.
I removed teh function from the bot_functions.php fil.e

Now the bot crashes .

>[10:44:31] Connect
[10:44:31] Authenticate
[10:44:36] Login char
##[10:44:47] [Guild]Kardsen: test
PHP Fatal error: Cannot redeclare playfieldname() (previously declared in C:\AO
C BOTS\Ragebot\plugins\5000ms\playfield\index.php:6) in C:\AOC BOTS\Ragebot\plug
ins\5000ms\playfield\index.php on line 13
Reply with quote


Creator 
Blue-Ribbon Chicken 
Topics: 3
Posts: 16
Playing:  AOC-Omm
Ingame:  Creator
Years registered: * * * * * * * * * * * * * * * * *
Posted: Post 04:46 Tue - Jun 24, 2008

Looks like you've got the function in twice somewhere... Reply with quote


Chaly 
Offizier · Webmaster 
Topics: 404
Posts: 2107
Location: Bad Honnef
Playing:  Guildwars2 (Drakkar See)
Ingame:  Chaly Flavour
Years registered: * * * * * * * * * * * * * * * * * * * * * *
Posted: Post 04:48 Tue - Jun 24, 2008

sorry, there is a "bug" in php function_exists():
http://de2.php.net/manual/de/function.function-exists.php#73120


this works:
Code:
<?php
if (!function_exists('playfieldname')) {
      function playfieldname($playfieldnumber) {
         switch($playfieldnumber) {
             case 177437: return "Thunder River";
            case 182575: return "Poitain";
            case 185805: return "Tarantia Noble District";
            default: return "Unknown(".$playfieldnumber.")";
          }
      }
}
?>


this doesn't
Code:
<?php
if (function_exists('playfieldname')) return;
function playfieldname($playfieldnumber) {
   switch($playfieldnumber) {
       case 177437: return "Thunder River";
      case 182575: return "Poitain";
      case 185805: return "Tarantia Noble District";
      default: return "Unknown(".$playfieldnumber.")";
   }
}
?>
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 05:51 Tue - Jun 24, 2008

Thanks, should have realized that by looking at your code. Reply with quote


Guest 
 
Topics: 6
 
 
 
Posted: Post 05:56 Tue - Jun 24, 2008

what do this ???? Reply with quote


kardson 
(started thread)
Topfight Chicken 
Topics: 6
Posts: 38
Playing:  AOC
Ingame:  kardson
Years registered: * * * * * * * * * * * * * * * * *
Posted: Post 06:07 Tue - Jun 24, 2008

It displays what Zone/area a character is in, if they are online

example
default !whois
::Kardsen :: Level 60 Assassin :: Online

My addition
::Kardsen :: Level 60 Assassin :: Online in Thunder River
Reply with quote


Guest 
 
Topics: 6
 
 
 
Posted: Post 06:22 Tue - Jun 24, 2008

oh how cool is this!

i try to get that also in my bot
but i am not sure how you add it.

<confuised>
Reply with quote


kardson 
(started thread)
Topfight Chicken 
Topics: 6
Posts: 38
Playing:  AOC
Ingame:  kardson
Years registered: * * * * * * * * * * * * * * * * *
Posted: Post 07:38 Tue - Jun 24, 2008

Do this.

Create Folder called "playfield" in
ragebot/plugins/5000ms/

Create a File named index.php in the playfield folder

input the following into that file

Code:

<?php
if (!function_exists('playfieldname')) {
/****** Translates a zoneid to its name
******* Thanks: kardsen, www.devotion-guild.com
******/
function playfieldname($playfieldnumber) {
   switch($playfieldnumber) {
      case 177437: return "Thunder River";
     case 180091: return "Conall's Valley";
      case 182575: return "Poitain";
      case 185805: return "Tarantia Noble District";
      default: return "Unknown(".$playfieldnumber.")";
   }
 }
}
?>


Now. Open ragebot/plugins/guild/whois/index.php
change
Code:

<?php
global $WhoIs;
if (!is_array($WhoIs)) {
   $WhoIs=array();
}

if ($pluginwords[1]=="!whois") {
   #second parameter?
   if ($pluginwords[2]) {
      if(preg_match('#^[a-z]+$#i',$pluginwords[2]) ) {
         global $guildmates;
         $whois=strtoupper(substr($pluginwords[2],0,1)).strtolower(substr($pluginwords[2],1));
         if (!$guildmates[$whois]) {
            global $BuddyList,$AOC;
            #remember the sender who did !whois for tell-replies..
            $WhoIs[$whois]=$sender;
            if (!$AOC->buddy_exists($whois)) {
               $AOC->buddy_add($whois);
               say("Doing a whois on $whois ($cid)",1);
               #i don't want to spamm two lines so this line is off:
               #$msg="Looking up $whois";
            } else {
               $cid=$AOC->lookup_user($whois);
               say("Found a non-guildmate-entry: $whois (removed)",1);
               $msg=$BuddyList[$cid]["name"].
                 " :: Level ".
                 $BuddyList[$cid]["level"]." ".
                 classname($BuddyList[$cid]["class"]).
                 " ::";
               if ($BuddyList[$cid]["status"]==0) $msg.=" is offline";
               if ($BuddyList[$cid]["status"]==1) $msg.=" is online";
               if ($BuddyList[$cid]["status"]==3) $msg.=" is online (AFK)";
               $AOC->buddy_remove($whois);
            }
         } else {
            $msg="$whois is in your guild, right in front of you";
         }
      } else {
         $msg="$sender :: ".$pluginwords[2]." is not a valid charactername!";
      }
   } else {
      $msg="Please use '!whois (name of the character)'.";
   }
   if ($msg) {
      #comment this line to suppress guild-output
      send_guild_channel_message(colortext(":: $msg ::"));
      #uncomment this line to send a tell
      #send_private_tell($sender,colortext(":: $msg ::"));
   }
}

?>


to this
Code:

<?php
global $WhoIs;
if (!is_array($WhoIs)) {
   $WhoIs=array();
}

if ($pluginwords[1]=="!whois") {
   #second parameter?
   if ($pluginwords[2]) {
      if(preg_match('#^[a-z]+$#i',$pluginwords[2]) ) {
         global $guildmates;
         $whois=strtoupper(substr($pluginwords[2],0,1)).strtolower(substr($pluginwords[2],1));
         if (!$guildmates[$whois]) {
            global $BuddyList,$AOC;
            #remember the sender who did !whois for tell-replies..
            $WhoIs[$whois]=$sender;
            if (!$AOC->buddy_exists($whois)) {
               $AOC->buddy_add($whois);
               say("Doing a whois on $whois ($cid)",1);
               #i don't want to spamm two lines so this line is off:
               #$msg="Looking up $whois";
            } else {
               $cid=$AOC->lookup_user($whois);
               say("Found a non-guildmate-entry: $whois (removed)",1);
               $msg=$BuddyList[$cid]["name"].
                 " :: Level ".
                 $BuddyList[$cid]["level"]." ".
                 classname($BuddyList[$cid]["class"]).
                 " ::";
               if ($BuddyList[$cid]["status"]==0) $msg.=" is offline";
               if ($BuddyList[$cid]["status"]==1) $msg.=" is online in ".playfieldname($BuddyList[$cid]["playfield"]);
               if ($BuddyList[$cid]["status"]==3) $msg.=" is online (AFK) in ".playfieldname($BuddyList[$cid]["playfield"]);
               $AOC->buddy_remove($whois);
            }
         } else {
            $msg="$whois is in your guild, right in front of you";
         }
      } else {
         $msg="$sender :: ".$pluginwords[2]." is not a valid charactername!";
      }
   } else {
      $msg="Please use '!whois (name of the character)'.";
   }
   if ($msg) {
      #comment this line to suppress guild-output
      send_guild_channel_message(colortext(":: $msg ::"));
      #uncomment this line to send a tell
      #send_private_tell($sender,colortext(":: $msg ::"));
   }
}

?>


restart bot.
Reply with quote


Chaly 
Offizier · Webmaster 
Topics: 404
Posts: 2107
Location: Bad Honnef
Playing:  Guildwars2 (Drakkar See)
Ingame:  Chaly Flavour
Years registered: * * * * * * * * * * * * * * * * * * * * * *
Posted: Post 08:46 Tue - Jun 24, 2008

as !whois is a plugin released with the bot i would suggest that i add your latest version of the playfield plugin to the bot's standard with the 0.7 and above.
otherwise ppl have to check their modfications in the standard-code (!whois) every time they want to download the newest release of the bot.
modification of the standard-code should be update-compatible lachen
btw: you have pm strichauge
Reply with quote



_________________

Chalys Gimpnesstheory (2003) Die Theorie der expotentiellen Bullshits den Gimps bei gleichbleibendem Anteil produzieren.
Guest 
 
Topics: 404
 
 
 
Posted: Post 09:05 Tue - Jun 24, 2008

Hmmm,
It doesnt work for me.

I do exactly what you told me, but he only answer:

Player LVL is online

but not in witch playerfield
Reply with quote


Goto page 1, 2, 3  Next
Back Reply to topic