Back Reply to topic
Guest 
 
 
 
 
Posted: Post 12:21 Mon - Jun 23, 2008

This is my new project , a KOS list. it works pritty ok now.. I made it out of your
!whois if u might notice lachen

This bot is the first time ever i try PhP so debugging isnt my good part..

Do you see the error , as of why i have to type !kos <name> , 2 times, before the function activates?? the bot see it, as the !kos <names! comes up in the Console window....

here is the code.
Code:
<?php
global $KoS;
global $myguild;
global $guildmates;
global $BuddyList,$AOC;

if (!is_array($KoS)) {
   $KoS=array();
}

if ($pluginwords[1]=="!kos") {
   #second parameter?
   if ($pluginwords[2]) {
      if(preg_match('#^[a-z]+$#i',$pluginwords[2]) ) {
         
         $whois=strtoupper(substr($pluginwords[2],0,1)).strtolower(substr($pluginwords[2],1));
         if (!$guildmates[$whois]) {
            

            #remember the sender who did !whois for tell-replies..
            $KoS[$whois]=$sender;

            if (!$AOC->buddy_exists($whois)) {
               $AOC->buddy_add($whois);
               say("Doing a whois on $whois ($cid)",1);
                              
            } 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"]).
                 " :: \n";
               $AOC->buddy_remove($whois);
            }
         } else {
            send_public_channel_message($myguild, colortext("$whois is in your guild!! cant add to KOS list"));
            return;
         }
      } else {
         send_public_channel_message($myguild, colortext("$whois is not a valid charactername!"));
         return;
      }
   } else {
      $fname = "KosList.txt";
      $fhandle = fopen($fname,"r");
      $content = fread($fhandle, filesize($fname));
      fclose($fhandle);
      $msg1 = makelink(":: KOS list::",$content);
      send_public_channel_message($myguild,$msg1);
   }
   if ($msg) {
      
      $fname = "KosList.txt";
      $fhandle = fopen($fname,"a");
      fwrite($fhandle,$msg);
      fclose($fhandle);
      send_public_channel_message($myguild,colortext(":: $whois Added to KOS list!:: "));
   }
}


?>

?>
Reply with quote


Chaly 
Offizier · Webmaster 
Topics: 404
Posts: 2107
Location: Bad Honnef
Playing:  Guildwars2 (Drakkar See)
Ingame:  Chaly Flavour
Years registered: * * * * * * * * * * * * * * * * * * * * * *
Posted: Post 06:56 Mon - Jun 23, 2008

Anonymous wrote:

Do you see the error , as of why i have to type !kos <name> , 2 times, before the function activates?? the bot see it, as the !kos <names! comes up in the Console window....
Code:
<a lot of did-my-user-everything-right ifs>

            if (!$AOC->buddy_exists($whois)) {
               $AOC->buddy_add($whois);
               say("Doing a whois on $whois ($cid)",1);
                              
            } 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"]).
                 " :: \n";
               $AOC->buddy_remove($whois);
            }
<a lot of teach-my-user-else>

Hi, kos-list is a nice idea.
$whois is the person for the kos list. The first part of the IF checks if $whois is on the bot's character ingame buddylist and adds $whois if needed. If $whois wasn't on the bot's buddylist, the script has finished. The second part of the IF gets some details for $whois, builds a $msg and finally removes $whois from the bot's ingame buddylist.

If I get it right, you want to do the following:
1. starting the bot: the bot loads a KoS list (should be in a little file or a database)
2. a guildmate writes "!kos badguy", the bot adds the badguy to its KoS list
3. a guildmate just writes "!kos" the bot generates a list with everyone on the list.
4. nice2have: everyone on the kos - list is on the bot's buddylist. when someone loggs in, the bot sends a message to the guildchannel

Maybe you want to take a look at the plugins:
1. works. i suggest moving the loading part to the top: if someone uses !kos check if variable $KoS is initialized. if not load the file.
2. works, but the bot will receive the details from the server later - let's say in a second. when !kos adds a new buddy i would save that !kos was called in a global variable. the next time my plugins\buddy\kos\index.php - function triggers i would check if the buddy is on the kos-list and someone is waiting for an info
3. works
4. buddy/guildbuddies => prints a message everytime someone that is on the buddylist AND on the guildmatelist logs on/off

an idea: if you want to save/load only if the koslist-script is

ps:
The original !whois plugin has 2 parts: guild/whois temporary adds someone to the 'real' buddylist, buddy/whois prints the details to the guildchannel and removes the temporary buddy
Reply with quote



_________________

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


Last edited by Chaly on 07:11 Mon - Jun 23, 2008; edited 3 times in total
kardson 
Topfight Chicken 
Topics: 6
Posts: 38
Playing:  AOC
Ingame:  kardson
Years registered: * * * * * * * * * * * * * * * * *
Posted: Post 03:25 Fri - Jun 27, 2008

Gast's KOS list w/ modifications

Changed a couple things in Gast's KOS list.
1. Made the KOS list create in the KOS folder. Rather than the main folder of the Ragebot. (keep everything organized nice )
2. Changed some of the variables to proper.
CHANGED all
Code:

send_public_channel_message(

to
Code:

send_guild_channel_message(


added Time Stamp
changed
Code:

$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"]).
                 " :: \n";
               $AOC->buddy_remove($whois);

to
Code:

} 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"]).
                 " :: ".date("m.d.Y")." \n";
               $AOC->buddy_remove($whois);



Complete file here
Code:

<?php
##### Gast's KOS list#####
##### Timestamp added by kardsen#######
global $KoS;
global $myguild;
global $guildmates;
global $BuddyList,$AOC;

if (!is_array($KoS)) {
   $KoS=array();
}

if ($pluginwords[1]=="!kos") {
   #second parameter?
   if ($pluginwords[2]) {
      if(preg_match('#^[a-z]+$#i',$pluginwords[2]) ) {
         
         $whois=strtoupper(substr($pluginwords[2],0,1)).strtolower(substr($pluginwords[2],1));
         if (!$guildmates[$whois]) {
           

            #remember the sender who did !whois for tell-replies..
            $KoS[$whois]=$sender;

            if (!$AOC->buddy_exists($whois)) {
               $AOC->buddy_add($whois);
               say("Doing a whois on $whois ($cid)",1);
                             
            } 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"]).
                 " :: ".date("m.d.Y")." \n";
               $AOC->buddy_remove($whois);
            }
         } else {
            send_guild_channel_message( colortext("$whois is in your guild!! cant add to KOS list"));
            return;
         }
      } else {
         send_guild_channel_message(colortext("$whois is not a valid charactername!"));
         return;
      }
   } else {
      $fname = "plugins/guild/kos/KosList.txt";
      $fhandle = fopen($fname,"r");
      $content = fread($fhandle, filesize($fname));
      fclose($fhandle);
      $msg1 = makelink(":: KOS list::",$content);
      send_guild_channel_message($msg1);
   }
   if ($msg) {
     $fp = fopen("plugins/guild/kos/KosList.txt", "r");
     $content = fread($fp, filesize("plugins/guild/kos/KosList.txt"));
     fclose($fp);
     $newmsg = $msg . $content;
      $fp = fopen("plugins/guild/kos/KosList.txt", "w+");
      fwrite($fp, $newmsg);
      fclose($fp);
      send_guild_channel_message(colortext(":: $whois Added to KOS list!::"));

   }
}
?>



Several Problems
1. The way the code stands right now. You can add the same person more than once.
2. There is no way to delete someone on the list without manually editing the file.
3. The Bot doesn't recognize the !kos BADGUY command sometimes. No errors as to why.
Reply with quote


Guest 
 
Topics: 6
 
 
 
Posted: Post 04:31 Fri - Jun 27, 2008

3. The Bot doesn't recognize the !kos BADGUY command sometimes. No errors as to why.



I think its a problem of the whois command,
because when i used !whois name
sometimes i have to write this 2-3 times that he recognize the command
Reply with quote


Guest 
 
Topics: 6
 
 
 
Posted: Post 04:33 Fri - Jun 27, 2008

Idee: can we do a access list?

so only the char "Leader1" "leader2"

are alloud to add !kos names.

the other guild members can only use the command !kos
for the list
Reply with quote


Guest 
 
Topics: 6
 
 
 
Posted: Post 04:22 Sat - Jun 28, 2008

hey charly maybe put the memo function and the kos function also in your bot

0.7 ?
Reply with quote


Chaly 
Offizier · Webmaster 
Topics: 404
Posts: 2107
Location: Bad Honnef
Playing:  Guildwars2 (Drakkar See)
Ingame:  Chaly Flavour
Years registered: * * * * * * * * * * * * * * * * * * * * * *
Posted: Post 01:13 Tue - Jul 15, 2008

you may have noticed that i've added a basickos to 0.8 that doesn't work with the bot's buddylist. my particular attention should was given to the chat- "ui" and the saving/loading engine. i think the basickos must be extended by adding kos-buddys to the bot's buddylist, watching playfield-changes and let people subscribe to the kos-acitivity:
- is a kos - target in a guildmate's zone? => tell him if he subscribed
- does a kos - target logon? => tell all subscribers
- does a kos - target logoff? => tell all subscribers
Reply with quote



_________________

Chalys Gimpnesstheory (2003) Die Theorie der expotentiellen Bullshits den Gimps bei gleichbleibendem Anteil produzieren.
Dawormie 
Blue-Ribbon Chicken 
Topics: 2
Posts: 8
Playing:  Age of Conan
Ingame:  Daworm
Years registered: * * * * * * * * * * * * * * * * *
Posted: Post 03:04 Sun - Jul 27, 2008

I would like to see the "kos" plugin work with adding guild names. IE:

Three Word Guilds
Big Bad Gankers


atm, it takes the first word, and in once case... it took the middle word. O.O


What I do as a work-around is "Three_word_guilds" or "Big_bad_gankers".

Makes the KoS output look weird, but it does the job.
Reply with quote


Back Reply to topic