collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 987
  • stats Total Posts: 18348
  • stats Total Topics: 2494
  • stats Total Categories: 7
  • stats Total Boards: 33
  • stats Most Online: 500

Author Topic: Ginfo Help  (Read 5559 times)

0 Members and 1 Guest are viewing this topic.

Offline buvian

  • BeBot Rookie
  • *
  • Posts: 4
  • Karma: +0/-0
Ginfo Help
« on: November 16, 2013, 04:49:33 pm »
Hello I'm trying to use the Ginfo that keirou posted at http://bebot.link/aoc-modules/guild-recruitment/msg13861/#msg13861
I'm having an issue on getting an error on line 19
Code: [Select]
$this -> bot -> core("colors") -> define_scheme("GI", "highlight", "yellow");
My bot server is throwing this error

Fatal error: Can't use method return value in write context in /home/disband/service48/modules/aoc/Ginfo.php on line 19
PHP Notice: Undefined variable: pw in /home/disband/service48/StartBot.php on line 100

Any help would be greatly appreciated.

Also here does this mean it will be posted in ooc or any other channel? I do not want the bot recruiting at all just was it as a information giver. I plan to use a script I'll post that will send a message to bot saying !ginfo.
Code: [Select]
$this -> help['command']['grecruit']="Displays a recruitment link in OOC (usable only with priveleges).";

Code: [Select]
<?php
/*
* GuildInfo
* This module helps people with guild recruitment.
*
*
*/
$GuildInfo = new GuildInfo($bot);

class 
GuildInfo extends BaseActiveModule
{

   function 
__construct(&$bot)
   {
      
parent::__construct(&$botget_class($this));
      
      
$this -> register_command(&#39;all&#39;, &#39;ginfo&#39;, "ANONYMOUS");

      
$this -> bot -> core("colors") -> define_scheme("GI""highlight""yellow");
      
$this -> bot -> core("colors") -> define_scheme("GI""normal""white");
      
$this -> bot -> core("colors") -> define_scheme("GI""info""lightgreen");
      
$this -> bot -> core("colors") -> define_scheme("GI""red""red");
      
$this -> bot -> core("colors") -> define_scheme("GI""Silver""Silver");

      
$this -> help[&#39;description&#39;] = &#39;Helps with guild recruitment.&#39;;
      
$this -> help[&#39;command&#39;][&#39;ginfo&#39;]="Displays guild&#39;s info tab.";
      
$this -> help[&#39;command&#39;][&#39;ginfo members&#39;]="Displays a list of members in the guild.";
      
$this -> help[&#39;command&#39;][&#39;ginfo classes&#39;]="Displays a list of classes in the guild.";
      
$this -> help[&#39;command&#39;][&#39;grecruit&#39;]="Displays a recruitment link in OOC (usable only with priveleges).";
   
}

   function 
command_handler($name$msg$origin)
   {
      if (
preg_match(&#39;/^ginfo/i&#39;, $msg, $info)) {
         
$words trim(substr($msgstrlen(&#39;ginfo&#39;)));
         
if ($words == "members")
         {
            return 
$this -> memberslist();
         } else if(
$words == "classes") {
            return 
$this -> memberscount();
         } else {
            return 
$this -> info();
         }
      } else if(
preg_match(&#39;/^grecruit/i&#39;, $msg, $info)) {
         //return "Command under development";
         
$msg $this -> recruit();
         
$channel $this -> bot -> core("chat") -> lookup_group("Playfield");
         return 
"Currently under development: ".$channel;
      } else {
         
$this -> bot -> send_help($name);
      }
   }
   
   
/*
   Guilds Info
   */
   
function info()
   {
      
$txt.= "##GI_red##GUILD NAME HERE##end##\n\n";
  
$txt.= "##end##\n";      
      
      
$txt.= "##highlight##Leader:##end##\n\n";
 
$online $this -> officercheck("GUILD LEADER NAME");
 
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state[&#39;content&#39;] . $online[1];
  
$txt.= "##end##\n";
  
$txt.= "##end##\n";      
      
$txt.= "##highlight##Officers:##end##\n";
 
$online $this -> officercheck("OFFICER 1");
 
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state[&#39;content&#39;] . $online[1];
  
$txt.= "##end##\n";
     
$online $this -> officercheck("OFFICER 2");
 
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state[&#39;content&#39;] . $online[1];
  
$txt.= "##end##\n";
 
$online $this -> officercheck("OFFICER 3");
 
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state[&#39;content&#39;] . $online[1];
  
$txt.= "##end##\n";
 
$online $this -> officercheck("OFFICER 4");
 
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state[&#39;content&#39;] . $online[1];
  
$txt.= "##end##\n";
 
$online $this -> officercheck("OFFICER 5");
 
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state[&#39;content&#39;] . $online[1];
  
$txt.= "##end##\n";  
 
$online $this -> officercheck("OFFICER 6");
 
$online_state $online[0];
      
$txt.= "##GI_highlight##".$online_state[&#39;content&#39;] . $online[1];
  
$txt.= "##end##\n";  
  
$txt.= "##end##\n"
      
$txt.= "##GI_red##Website:##end## ##GI_info## WWW. YOUR WEBSITE HERE .COM##end##\n\n";
      
$txt.= "##GI_red##City:##end## ##Silver##WHAT YOUVE BUILT##end##\n\n";
      
$txt.= "##GI_red##Raids:##end## ##Silver##WHAT YOUVE KILLED##end##\n\n";
      
$txt.= "##GI_red##Recruitment:##end## ##Silver##SPECIAL REQUIREMENTS??.##end##\n\n";
  
$txt.= "##end##\n";
      
$txt.= "##highlight##Assassin:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Barbarian:##end## ##Red## [Closed]##end##\n";
      
$txt.= "##highlight##Bear Shaman:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Conqueror:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Dark Templer:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Demonologist:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Guardian:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Herald of Xotli:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Necromancer:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Priest of Mitra:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Ranger:##end## ##Red##[Closed]##end##\n";
      
$txt.= "##highlight##Tempest of Set:##end## ##Red##[Closed]##end##\n\n";
  
$txt.= "##end##\n";
      
      
$txt.= "##GI_red##Guild Info:##end##\n";
      
$txt.= "##Silver##";
      
$txt.= "GUILD INFO SECTION 1\n\n";
  
$txt.= "##end##\n";
  
$txt.= "##Silver##";
      
$txt.= "GUILD INFO SECTION 2\n\n";
  
$txt.= "##end##\n";
  
$txt.= "##Silver##";
      
$txt.= "GUILD INFO SECTION 3\n\n";
      
$txt.= "##end##";
      
      
      return 
$this -> bot -> core("tools") -> make_blob("WHAT YOU WANT THE BOT TO TELL THE PLAYER"$txt);
   }
   
/*
   Still working on this, for now just some random debugging stuff I was trying
   */
   
function recruit()
   {   
      
$blob "Guild Name is Recruiting!: &#39;";
      
$blob.= $this -> info();
      
$blob.= " Playfield ID: ";
      return 
$blob;
      
   }

 
/*
 Checks online list for presence of officer of $name
 Returns online status, and if online, name of current main/alt
 */
 
function officercheck($name)
 {
  
$online $this -> bot -> db -> select("SELECT t1.nickname FROM "
  
"#___online AS t1 LEFT JOIN #___whois AS t2 ON t1.nickname = t2.nickname WHERE status_gc=1");

  
$found FALSE;
  if (!empty(
$online))
  {
   foreach (
$online as $player)
   {
    if(isset(
$this -> listed[$channel][$player[0]]))
     Continue; 
    
    
$main $this -> bot -> core("alts") -> main($player[0]);

    if (
$name == $main)
    {
     
$online_state $this -> bot -> core("online") -> get_online_state($this -> bot -> core("chat") -> get_uname($player[0]));
     
$retstr " - " $this -> bot -> core("chat") -> get_uname($player[0]);
     
$found TRUE;
     break;
    }
    else if (
$name == $this -> bot -> core("chat") -> get_uname($player[0]))
    {
     
$online_state $this -> bot -> core("online") -> get_online_state($main);
     
$retstr " - " $main;
     
$found TRUE;
     break;
    }
   }
   if (
$found == FALSE)
   {
    
$online_state $this -> bot -> core("online") -> get_online_state($name);
    
$retstr " - " $name;
   }
  }
  return array(
$online_state$retstr);
 }
   
   
/*
   Need to revize so it just uses core
   */
   
function memberslist()
   {
      
$blob "";
      
$count 0;
      
$result $this -> bot -> db -> select("SELECT nickname, last_seen FROM #___users WHERE user_level = " MEMBER " ORDER BY nickname ASC");
      if (!empty(
$result))
      {
         
$inside "##blob_title##:::: <botname>&#39;s Member List ::::##end##\n\n";
         foreach (
$result as $val)
         {
            
$count++;
            
$inside .= "##blob_text##&#38;#8226; " $val[0];
            if (
$val[1] > 0)
            {
               
$inside .= ", last seen at " gmdate($this -> bot -> core("settings") -> get("Time""FormatString"), $val[1]);
            }
            else
            {
               
$inside .= ", never seen online";
            }
            
$inside .= "##end## ".$this -> bot -> core("tools") -> chatcmd("whois " $val[0], "[Whois]")."\n";
         }
         
$blob " :: " $this -> bot -> core("tools") -> make_blob("click to view"$inside);
      }
      return 
$count " Guild Members:" $blob;
   }
   
   
/*
   Need to revize so it just uses core
   */
   
function memberscount()
   {
      
$blob "";
      
$total 0;
      
      
$buddies count($this -> bot -> aoc -> buddies);
      
//Get a list of professions
      
$profession_list "&#39;".$this->bot->core(&#39;professions&#39;)->get_professions("&#39;, &#39;")."&#39;";
      
$counts $this -> bot -> db -> select("SELECT t2.class, COUNT(DISTINCT t1.nickname)
            FROM #___users AS t1 LEFT JOIN #___whois AS t2 ON t1.nickname = t2.nickname
             WHERE user_level = " 
MEMBER " AND t2.class IN ($profession_list) GROUP BY class");
            
      foreach (
$this -> bot->core(&#39;professions&#39;)->get_profession_array() as $prof)
         
$count[$prof] = 0;
      if (!(empty(
$counts)))
      {
         foreach (
$counts as $profcount)
         {
            
$count[$profcount[0]] += $profcount[1];
            
$total += $profcount[1];
         }
      }
      
      
$inside "##blob_title##:::: <botname>&#39;s Member Count ::::##end##\n";
      
$inside .= "\n##blob_text##Buddy List Count: ##blob_title##".$buddies."##end##\n";
      foreach (
$count as $key => $value)
         
$inside .= "\n&#38;#8226; ".$key." = ##blob_title##".$value."##end##";
      
$blob " :: " $this -> bot -> core("tools") -> make_blob("click to view"$inside);

      return 
$total " Guild Classes:" $blob;
   }
}
?>
« Last Edit: November 16, 2013, 04:52:32 pm by buvian »

Offline buvian

  • BeBot Rookie
  • *
  • Posts: 4
  • Karma: +0/-0
Re: Ginfo Help
« Reply #1 on: November 16, 2013, 08:20:30 pm »
If nobody can help me with that I might have a simpler solution. This module here works perfectly, but I don't want that type of Leader/Officer lookup. Basically you have to put information in for the Kaeus module while the Cro module uses a lookup function from the bot showing which character an officer or leader is on which is much cleaner imo. Any help with either would be greatly appreciated.

This is the module
Code: [Select]
<?php
/*
* GuildInfo, by Kaeus
* This module helps people with guild recruitment.
*
*
*/
$GuildInfo = new GuildInfo($bot);

class 
GuildInfo extends BaseActiveModule
{

   function 
__construct(&$bot)
   {
      
parent::__construct(&$botget_class($this));
      
      
$this -> register_command('all''ginfo'"ANONYMOUS");

      
$this -> bot -> core("colors") -> define_scheme("GI""highlight""yellow");
      
$this -> bot -> core("colors") -> define_scheme("GI""normal""white");
      
$this -> bot -> core("colors") -> define_scheme("GI""info""lightgreen");
      
$this -> bot -> core("colors") -> define_scheme("GI""red""red");
      
$this -> bot -> core("colors") -> define_scheme("GI""blue""blue");

      
$this -> help['description'] = 'Helps with guild recruitment.';
      
$this -> help['command']['ginfo']="Displays guild's info tab.";
      
$this -> help['command']['ginfo members']="Displays a list of members in the guild.";
      
$this -> help['command']['ginfo classes']="Displays a list of classes in the guild.";
      
$this -> help['command']['grecruit']="Displays a recruitment link in OOC (usable only with priveleges).";
   }

   function 
command_handler($name$msg$origin)
   {
      if (
preg_match('/^ginfo/i'$msg$info)) {
         
$words trim(substr($msgstrlen('ginfo')));
         if (
$words == "members")
         {
            return 
$this -> memberslist();
         } else if(
$words == "classes") {
            return 
$this -> memberscount();
         } else {
            return 
$this -> info();
         }
      } else if(
preg_match('/^grecruit/i'$msg$info)) {
         
//return "Command under development";
         
$msg $this -> recruit();
         
$channel $this -> bot -> core("chat") -> lookup_group("Playfield");
         return 
"Currently under development: ".$channel;
      } else {
         
$this -> bot -> send_help($name);
      }
   }
   
   
/*
   Guilds Info
   */
   
function info()
   {
      
$txt.= "##GI_info##E X A L T E D##end##\n <br></><br>";
      
$txt.= "----   ----   ----   ----   ----   ----   ----   ----   ----   ----\n";
        $txt.= "##GI_info##Guild Info:##end##\n <br></><br>";
      
$txt.= "##GI_info##";
      
$txt.= "##GI_highlight##The people who make up Exalted share several common values;##end##\n";
  $txt.= "##GI_highlight##They want to spend their time online in the company of friends.##end##\n";
  $txt.= "##GI_highlight##They want to have fun.##end##\n";
  $txt.= "##GI_highlight##They want to pit their skills against the environment and other players.##end##\n";
  $txt.= "##GI_highlight##They want to continually improve their skills and create effective solutions to the problems that they come across.##end##\n <br></><br>";

  $txt.= "##GI_highlight##Age of Conan is a game, not a lifestyle.##end##\n<br></><br>";

  $txt.= "##GI_highlight##This is the Way of Exalted.##end##\n <br></><br>";

  $txt.= "##GI_highlight##If you are a curious about Exalted, take a look around on our home page and our forums and if you like what you see, write an application! :) Requirements to join? \n

Yes, there are some. We want you to be friendly and open minded.<br> We want you to respect Aquilonias server rules.<br> We want you to act mature.<br> We do not allow 'leet' language.<br> We want you to be over level 40 and we want you to join Exalted with the goal of having fun and getting to know other people.<br> Alts are not allowed in other guilds, though there is no rule against standing guildless on alts should one wish so. We do of course encourage all our members to keep all their characters in the guild.<br> Other than that there aren't any requirements.\n

We look forward to seeing more members in the near future!##end## \n <br></><br>"
;
      
$txt.= "----   ----   ----   ----   ----   ----   ----   ----   ----   ----\n";
      
$txt.= "##GI_info##Guild Leader:##end##\n";
      
$online $this -> bot -> core("online") -> get_online_state('Wood');
      
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Wood Im interested in joining Exalted'>Wood</a> - Guild leader##end##\n";
      
$txt.= "##GI_info##Leaders Alts:##end##\n";
      
$online $this -> bot -> core("online") -> get_online_state('Vincenta');
      
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Vincenta Im interested in joining Exalted'>Vincenta</a> - Alt of Wood##end##\n";
      
$online $this -> bot -> core("online") -> get_online_state('Wolcom');
      
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Wolcom Im interested in joining Exalted'>Wolcom</a> - Alt of Wood##end##\n";
      
$online $this -> bot -> core("online") -> get_online_state('Woodz');
      
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Woodz Im interested in joining Exalted'>Woodz</a> - Alt of Wood##end##\n";
      
$txt.= "----   ----   ----   ----   ----   ----   ----   ----   ----   ----\n";
      
$txt.= "##GI_info##Officers:##end##\n";
  $online $this -> bot -> core("online") -> get_online_state('Xuthal');
      
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Xuthal Im interested in joining Exalted'>Xuthal</a> - Captain PvP##end##\n";
  $online $this -> bot -> core("online") -> get_online_state('Kaube');
      
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Kaube Im interested in joining Exalted'>Kaube</a> - PvE Captain##end##\n";
      
$online $this -> bot -> core("online") -> get_online_state('Morgothday');
      
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Morgothday Im interested in joining Exalted'>Morgothday</a> - Tokens Officer##end##\n";
      
$online $this -> bot -> core("online") -> get_online_state('Gato');
      
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Gato Im interested in joining Exalted'>Gato</a> - PvP sergeant##end##\n";
  $online $this -> bot -> core("online") -> get_online_state('Roghaan');
      
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Roghaan Im interested in joining Exalted'>Roghaan</a> - Support Officer##end##\n";
  $online $this -> bot -> core("online") -> get_online_state('Vipp');
      
$txt.= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell Vipp Im interested in joining Exalted'>Vipp</a> - Taxman##end##\n";
      
$txt.= "----   ----   ----   ----   ----   ----   ----   ----   ----   ----\n";
  $txt.= "##GI_info##Website:##end## ##GI_highlight##http://www.exalted-aoc.com##end##\n";
  $txt.= "----   ----   ----   ----   ----   ----   ----   ----   ----   ----\n";
  $txt.= "##GI_info##Guild City:##end## ##GI_highlight##Complete T3 city including all walls and towers!##end##\n";
  $txt.= "##GI_highlight##T3 Keep: Done##end##\n";
  $txt.= "##GI_highlight##T3 Trade Post: Done##end##\n";
  $txt.= "##GI_highlight##T3 Barracks: Done##end##\n";
  $txt.= "##GI_highlight##T3 Alchemist: Done##end##\n";
  $txt.= "##GI_highlight##T3 Weaponsmith: Done##end##\n";
  $txt.= "##GI_highlight##T3 Armoursmith: Done##end##\n";
  $txt.= "##GI_highlight##T3 Thieves Guild: Done##end##\n";
  $txt.= "##GI_highlight##T3 Library: Done##end##\n";
  $txt.= "##GI_highlight##T3 Architect's Workshop: Done##end##\n";
  $txt.= "##GI_highlight##T3 Temple: Done##end##\n";
  $txt.= "##GI_highlight##T3 Towers: Done##end##\n";
  $txt.= "##GI_highlight##T3 Walls: Done##end##\n";
  $txt.= "##GI_highlight##T3 Tavern: Done##end##\n";
      
$txt.= "----   ----   ----   ----   ----   ----   ----   ----   ----   ----\n";
  $txt.= "##GI_info##Taxes:##end## ##GI_highlight##Yes, 3 gold per month. Taxes are a necessary evil in order to keep the guild running. Some examples; We do a lot of sieges and blue catapults plus banners are expensive. We host events and donate prizes. We want the guild to have a steady economy in order to be prepared for future changes.##end##\n";
      
$txt.= "----   ----   ----   ----   ----   ----   ----   ----   ----   ----\n";
  $txt.= "##GI_info##PVP AND PVE##end##\n";
  $txt.= "##GI_highlight##PvP: We have a battle keep in the Cimmerian end and try to keep sieges alive on the server. This means that we won't hide our battle keeps vulnerability window on odd hours to avoid attacks. Odd hours might still occur as the game automaticly sometimes set the next vulnerability window to working hours. We will strive to change it back to prime time should it occur. Exalted holds a friendly approach to neutral guilds and do not attack unless provoked. It is still allowed to 'hone ones strenght' in fair one on one fights as long as it's done in a friendly manner.##end##\n";
  $txt.= "##GI_highlight##PvE: Three pve raids a week. The focus is naturally on T3 so T1 and T2 raids are for now off the schedule. T1 and T2 raids are allowed outside the guild, while T3 are done with guild only.\n##end##\n";
  $txt.= "##GI_highlight##T3 Brothers in Arms: Farm##end##\n";
  $txt.= "##GI_highlight##T3 Hathor-Ka: Farm##end##\n";
  $txt.= "##GI_highlight##T3 Arbanus: Farm##end##\n";
  $txt.= "##GI_highlight##T3 Master Gyas: Farm##end##\n";
  $txt.= "##GI_highlight##T3 Favoured of Louhi: Farm##end##\n";
  $txt.= "##GI_highlight##T3 Keeper of Artifacts: Farm##end##\n";
  $txt.= "##GI_highlight##T3 Thoth-Amon: Our current nail pve wise##end##\n";
  $txt.= "##GI_highlight##Loot: Loot is distributed by tokens(dkp) bids. One hidden bid per character to the token master.##end##\n";
  $txt.= "----   ----   ----   ----   ----   ----   ----   ----   ----   ----\n";  
 
  $txt.= "##GI_info##Politics:##end##\n";
  $txt.= "##GI_highlight##Allies: Clan Koragg, Dracones nigri##end##\n";
  $txt.= "##GI_highlight##Peace: Victrix Legion##end##\n";
  $txt.= "##GI_highlight##Kos: Sanguis Attexo, Band of the Gray Clover Reason, Blackthorne, Clan fearghal, Durandarte, Lost legacy, The black wolf, Veterans##end##\n";
      
$txt.= "----   ----   ----   ----   ----   ----   ----   ----   ----   ----\n";
      
$txt.= "##GI_info##Recruitment:##end## ##yellow## Recruitment is currently closed. Read more below. ##end##\n";
      
$txt.= "----   ----   ----   ----   ----   ----   ----   ----   ----   ----\n";
  $txt.= "##GI_info##The classes:##end##\n\n";
      
$txt.= "##GI_highlight##Assassin: [Closed]##end##\n";
      
$txt.= "##GI_highlight##Barbarian: [Closed]##end##\n";
      
$txt.= "##GI_highlight##Bear Shaman: [Closed]##end##\n";
      
$txt.= "##GI_highlight##Conqueror: [Closed]##end##\n";
      
$txt.= "##GI_highlight##Dark Templar: [Closed]##end##\n";
      
$txt.= "##GI_highlight##Demonologist: [Closed]##end##\n";
      
$txt.= "##GI_highlight##Guardian: [Closed]##end##\n";
      
$txt.= "##GI_highlight##Herald of Xotli: [Closed]##end##\n";
      
$txt.= "##GI_highlight##Necromancer: [Closed]##end##\n";
      
$txt.= "##GI_highlight##Priest of Mitra: [Closed]##end##\n";
      
$txt.= "##GI_highlight##Ranger: [Closed]##end##\n";
      
$txt.= "##GI_highlight##Tempest of set: [Closed]##end##\n <br></><br>";
  $txt.= "##GI_highlight##More information at http://www.exalted-aoc.com/forums##end##\n";
      
$txt.= "----   ----   ----   ----   ----   ----   ----   ----   ----   ----\n";
      
$txt.= "This post is a subject of change and even thought you might find your class closed, a good application goes a long way. It's all about the person behind the class, not first and foremost the pixels on his screen.\n";
      
$txt.= "##end##";
      
      
      return 
$this -> bot -> core("tools") -> make_blob("Exalted"$txt);
   }
   
/*
   Still working on this, for now just some random debugging stuff I was trying
   */
   
function recruit()
   {   
      
$blob "Exalted is Recruiting!: '";
      
$blob.= $this -> info();
      
$blob.= " Playfield ID: ";
      return 
$blob;
      
   }
   
   
/*
   Need to revize so it just uses core
   */
   
function memberslist()
   {
      
$blob "";
      
$count 0;
      
$result $this -> bot -> db -> select("SELECT nickname, last_seen FROM #___users WHERE user_level = " MEMBER " ORDER BY nickname ASC");
      if (!empty(
$result))
      {
         
$inside "##blob_title##:::: <botname>'s Member List ::::##end##\n\n";
         foreach (
$result as $val)
         {
            
$count++;
            
$inside .= "##blob_text##&#8226; " $val[0];
            if (
$val[1] > 0)
            {
               
$inside .= ", last seen at " gmdate($this -> bot -> core("settings") -> get("Time""FormatString"), $val[1]);
            }
            else
            {
               
$inside .= ", never seen online";
            }
            
$inside .= "##end## ".$this -> bot -> core("tools") -> chatcmd("whois " $val[0], "[Whois]")."\n";
         }
         
$blob " :: " $this -> bot -> core("tools") -> make_blob("click to view"$inside);
      }
      return 
$count " Guild Members:" $blob;
   }
   
   
/*
   Need to revize so it just uses core
   */
   
function memberscount()
   {
      
$blob "";
      
$total 0;
      
      
$buddies count($this -> bot -> aoc -> buddies);
      
//Get a list of professions
      
$profession_list "'".$this->bot->core('professions')->get_professions("', '")."'";
      
$counts $this -> bot -> db -> select("SELECT t2.class, COUNT(DISTINCT t1.nickname)
            FROM #___users AS t1 LEFT JOIN #___whois AS t2 ON t1.nickname = t2.nickname
             WHERE user_level = " 
MEMBER " AND t2.class IN ($profession_list) GROUP BY class");
            
      foreach (
$this -> bot->core('professions')->get_profession_array() as $prof)
         
$count[$prof] = 0;
      if (!(empty(
$counts)))
      {
         foreach (
$counts as $profcount)
         {
            
$count[$profcount[0]] += $profcount[1];
            
$total += $profcount[1];
         }
      }
      
      
$inside "##blob_title##:::: <botname>'s Member Count ::::##end##\n";
      
$inside .= "\n##blob_text##Buddy List Count: ##blob_title##".$buddies."##end##\n";
      foreach (
$count as $key => $value)
         
$inside .= "\n&#8226; ".$key." = ##blob_title##".$value."##end##";
      
$blob " :: " $this -> bot -> core("tools") -> make_blob("click to view"$inside);

      return 
$total " Guild Classes:" $blob;
   }
}
?>

This is the type of Leader/Officer lookup I want from Cro Guild Script

Code: [Select]
<?php
/*
* GuildInfo, by Kaeus
* This module helps people with guild recruitment.
*
* modifyed by Snyder for CRO guild on Crom server
*/
$GuildInfo = new GuildInfo($bot);

class 
GuildInfo extends BaseActiveModule {
    private 
$recruitment_file 'D:/www/bebot/recruitment.php';
    private 
$who_clicked = array();
    private 
$spam_time 15;// minutes that spam protection is active
/*
    constructor
*/
    
function __construct(&$bot) {
        
parent::__construct(&$botget_class($this));
        
        
$this->register_command('all''ginfo'"ANONYMOUS");
        
        
$this->bot->core("colors")->define_scheme("GI""highlight""yellow");
        
$this->bot->core("colors")->define_scheme("GI""normal""white");
        
$this->bot->core("colors")->define_scheme("GI""info""lightgreen");
        
$this->bot->core("colors")->define_scheme("GI""red""red");
        
$this->bot->core("colors")->define_scheme("GI""blue""blue");
/*
    define classes and colors for recruitment
*/
        
$this->classes = array(
            
'sin' =>        'Assasin',
            
'barb' =>        'Barbarian',
            
'bs' =>            'Bear Shaman',
            
'conq' =>        'Conqueror',
            
'dt' =>            'Dark Templar',
            
'demo' =>        'Demonologist',
            
'guard' =>        'Guardian',
            
'hox' =>        'Herald of Xotli',
            
'necro' =>        'Necromancer',
            
'pom' =>        'Priest of Mitra',
            
'rang' =>        'Ranger',
            
'tos' =>        'Tempest of Set',
        );
/*
    you can pute more/less levels of recruitment
*/
        
$this->colors = array(
            
'none' =>            '#FFCC00',
            
'low' =>            '#FF0000',
            
'medium' =>            '#FF6600',
            
'high' =>            '#009900',
            
'ultrahigh' =>        '#005900',
        );
        
// settings
        
$i 1;
        
$opt "";
        
// make options for settings
        
foreach ($this->colors as $k => $v) {$opt .= $k.";";unset($k$v);}
        
$opt eregi_replace(";$"""$opt);// remove last ; from options
        // make settings loop
        
foreach ($this->classes as $short => $long) {
            
$this->bot->core("settings")->create("GuildInfo"$short"none"$long." requirement"$optfalse$i);
            
$i++;
        }
        unset(
$opt$i);
        
// help
        
$this->help['description'] =                    'Helps with guild recruitment.';
        
$this->help['command']['ginfo'] =                'Displays guild\'s info tab.';
        
// officers
        
$this->officers = array(
            
// first is guild leader
            
'Airo',
            
// rest are officers
            
'Redangel',
            
'Snyder',
            
'Kovach',
            
'Biert',
            
'Matsocks',
            
'Molay',
            
'Xurlie',
        );

    }
/*

*/
    
function command_handler($name$msg$origin) {
        
// there is only one command
        
if (preg_match('/^ginfo/i'$msg$info)) {
            
// spam protection
            
if ($this->is_not_spam($name)) {
                return 
$this->info($name);
            }
        }
        else {
            
$this->bot->send_help($name);
        }
    }
   
/*
    guild info stuff
*/
    
function info($name)    {
        
// guild name
        
$txt "<font face='hyboriansmall' color='#FFFFFF'>CRO Guild</font>\n<font color=#000000>.<br></font>";
        
$txt .= "<font face='hyboriansmall' color='#FFFFFF'>http://www.cro-guild.com</font>\n<font color=#000000>.<br></font>";
        
// staff
        
$i 0;
        foreach (
$this->officers as $v) {
            
$online $this->find_officer($v);
            
$n $online[1];
            
$online $online[0];
            
// first one is guildleader
            
if (!$i) {$txt .= "##normal##Guild leader##end##\n";}
            
// rest are officers
            
else if ($i == 1) {$txt .= "##normal##Officers##end##\n";}
            
$txt .= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell ".$n." Hey ".$n.", i would like some more info'>".$n."</a> ( ".$v." )##end##";
            if (
$v == $name) {$txt .= " - <font color='yellow'>posted recruitment info</font>";}
            
$txt .= "\n";
            unset(
$v$online$n);
            
$i++;
        }
        
// recruitment text from local file
        // you can get one from your website if you really want...
        
$data file_exists($this->recruitment_file) ? file_get_contents($this->recruitment_file) : '';
        
$txt .= $data;
        
// loop to create requirement
        
foreach ($this->classes as $short => $long) {
            
$r $this->bot->core("settings")->get("GuildInfo"$short);// requirement for class
            
$txt .= "##normal##".$long.":##end## <font color='".$this->colors$r ]."'>[".$r."]</font>\n";
            unset(
$short$long$r);
        }
        unset(
$data);
        return 
$this->bot->core("tools")->make_blob("CRO Guild info"$txt);
    }
/*
    find officer
*/
    
public function find_officer($name) {
        
// query for officer, if hes not on any alts his main char will be shown ($name)
        
$query $this->bot->db->select("select o.nickname from #___online as o, #___alts as a where o.status_gc = '1' and ( (o.nickname = a.alt and a.main = '".$name."') or (o.nickname = a.main and a.alt = '".$name."') ) LIMIT 1");
        if (!empty(
$query)) {
            
// just in case go with foreach loop, but there should be only one item in array
            
foreach ($query as $user) {
                
$name $user[0];
                unset(
$user);
            }
        }
        unset(
$query);
        
// online status on character $name
        
$online $this->bot->core("online")->get_online_state($name);
        
// return data array (online/offline, character name)
        
return array($online$name);
    }
/*
    spam protection agains wankers that click dozen times on link
*/
    
public function is_not_spam($name) {
        
// if name is in array, check if he clicked in last $this->spam_time minutes
        
if (isset($this->who_clicked$name ])) {
            
// name is in array, check if time char last time clicked is greater than time() - $this->spam_time
            
if ( $this->who_clicked$name ] > ( time() - $this->spam_time 60 ) ) {
                return 
false;
            }
        }
        
$this->who_clicked$name ] = time();
        return 
true;
    }
}
?>
« Last Edit: November 17, 2013, 02:49:32 am by buvian »

Offline Getrix

  • Contributor
  • *******
  • Posts: 509
  • Karma: +0/-0
Re: Ginfo Help
« Reply #2 on: November 17, 2013, 12:57:26 pm »
It looks like your posted code are reformated at some point..

Quote
$this -> help[&#39;description&#39;] = &#39;Helps with guild recruitment.&#39;;

should be something like:

Quote
$this -> help["description"] = "Helps with guild recruitment.";

And there is other lines with same problem that special chars have been htmlspecialentities encoded (http://php.net/manual/en/function.htmlspecialchars.php)

Redownload the script from source and check every line if there is any & etc there..
Success is not final, failure is not fatal: it is the courage to continue that counts.
- Sorry, i dont have time to reply question on PM. Make a topic.

Offline buvian

  • BeBot Rookie
  • *
  • Posts: 4
  • Karma: +0/-0
Re: Ginfo Help
« Reply #3 on: November 17, 2013, 04:34:59 pm »
Thank You for the reply. The second reply has a script that is identical, but has not be reformatted and works great. I would like to change the Guild Leader and Officers look up though. I really like the one from the CRO Guild Module also in my reply. If anyone would be able to help with that i would be set.

Offline buvian

  • BeBot Rookie
  • *
  • Posts: 4
  • Karma: +0/-0
Re: Ginfo Help
« Reply #4 on: November 19, 2013, 01:51:13 am »
All worked out thanks folks   8)

 

* Recent Posts
Linked objects in chat by bitnykk
[November 02, 2022, 10:56:58 am]


0.7.x updates for AO by bitnykk
[September 01, 2022, 03:25:38 pm]


0.7.x updates for AoC by bitnykk
[September 01, 2022, 03:25:22 pm]


Website back up and quick status update by bitnykk
[July 30, 2021, 04:56:19 pm]


AO Bots - discord server by bitnykk
[January 31, 2021, 03:50:48 am]

* Who's Online
  • Dot Guests: 47
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2022, SimplePortal