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

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18363
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: callers  (Read 1590 times)

0 Members and 1 Guest are viewing this topic.

Offline Feanaro

  • BeBot Rookie
  • *
  • Posts: 2
  • Karma: +0/-0
callers
« on: May 10, 2006, 03:12:14 pm »
I need callers and caller commands working in guild chat, not only in pgroup, can you help me?
$cd /pub
$more beer

Offline Malosar

  • BeBot Expert
  • ****
  • Posts: 259
  • Karma: +0/-0
    • http://www.lowerdimension.com
Re: callers
« Reply #1 on: May 10, 2006, 06:25:56 pm »
The old version or my db version? Also it was made originally as pgroup only because those kind of raid functions should really be kept out of guild chat.

Here's a converted db version which "should" work, haven't tried it yet.

Code: [Select]
<?
  /*
   * Callers.php - Designate and list "Callers" for raids and events.
   *
   * BeBot - An Anarchy Online Chat Automaton
   * Copyright (C) 2004 Jonas Jax
   *
   * Developed by Blondengy (RK1)
   * Special thanks goes out to Khalem (RK1) for his support.
   *
   * File last changed at $LastChangedDate: 2004-12-29 01:41:32 +0100 (Wed, 29 Dec 2004) $
   * Revision: $Id: Callers.php 8 2004-12-29 00:41:32Z blondengy $
   *
   * MySQL Version modifed by Malosar: 12/10/2006
   * GC Function added at request by Malosar: 05/10/2006
   */

  $db -> query("CREATE TABLE IF NOT EXISTS callers
              (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
              name VARCHAR(30))");

 
  $callers = new Callers($bot);


  $commands["pgmsg"]["caller"] = &$callers;
  $commands["pgmsg"]["callers"] = &$callers;
  $commands["gc"]["caller"] = &$callers;
  $commands["gc"]["callers"] = &$callers;




  /*
    The Class itself...
  */
  class Callers
  {
    var $bot;
    var $callers;
   
   

    /*
      Constructor:
        Hands over a referance to the "Bot" class.
    */
    function Callers (&$bot)
    {
      $this -> bot = &$bot;
      $this -> callers = array();
    }
   
   
   
    /*
      This gets called on a msg in the privgroup with the command
    */
    function pgmsg($name, $msg)
    {
      if ($this -> bot -> is_member($name))
      {
        if (preg_match("/^" . $this -> bot -> commpre . "callers/i", $msg))
          $this -> bot -> send_pgroup($this -> show_callers());
        else if (preg_match("/^" . $this -> bot -> commpre . "caller add (.+)/i", $msg, $info))
          $this -> bot -> send_pgroup($this -> caller_add($info[1]));
        else if (preg_match("/^" . $this -> bot -> commpre . "caller del (.+)/i", $msg, $info))
          $this -> bot -> send_pgroup($this -> caller_del($info[1]));
      }
      else
        $this -> bot -> send_pgroup("You must be a member to use this command.");
    }
   
    /*
      This gets called on a msg in the guildchannel with the command
    */
    function gc($name, $msg)
    {
      if ($this -> bot -> is_member($name))
      {
        if (preg_match("/^" . $this -> bot -> commpre . "callers/i", $msg))
          $this -> bot -> send_gc($this -> show_callers());
        else if (preg_match("/^" . $this -> bot -> commpre . "caller add (.+)/i", $msg, $info))
          $this -> bot -> send_gc($this -> caller_add($info[1]));
        else if (preg_match("/^" . $this -> bot -> commpre . "caller del (.+)/i", $msg, $info))
          $this -> bot -> send_gc($this -> caller_del($info[1]));
      }
      else
        $this -> bot -> send_gc("You must be a member to use this command.");
    }



    /*
      Add a caller
    */
    function caller_add($name)
    {
    $name = ucfirst(strtolower($name));

    if ($this -> bot -> aoc -> get_uid($name))
      {
$this -> bot -> db -> query("INSERT INTO callers (name) VALUES ('". $name ."')");
        $ret = "<font color=#ffff00>" . $name . "</font> has been added to caller list. " . $this -> show_callers();
      }
      else
        $ret = "Player <font color=#ffff00>" . $name . "</font> does not exist.";
return $ret;
    }



    /*
      Remove a caller
    */
    function caller_del($name)
    {
    $name = ucfirst(strtolower($name));

if ($this -> bot -> aoc -> get_uid($name) != -1)
      {
        if ($this -> bot -> db -> select("SELECT id, name FROM callers ORDER BY name"))
        {
  $this -> bot -> db -> query("DELETE FROM callers WHERE name = '" . $msg . "'");
          $ret = "<font color=#ffff00>" . $name . "</font> has been removed from caller list. " . $this -> show_callers();
        }
        else
          $ret = "<font color=#ffff00>" . $name . "</font> is not on list of callers. " . $this -> show_callers();
      }
      else
        $ret = "Player <font color=#ffff00>" . $name . "</font> does not exist.";
return $ret;
    }
   
   
   
    /*
      Return the list of callers
    */
    function show_callers()
    {
      $call = $this -> bot -> db -> select("SELECT id, name FROM callers ORDER BY name");
      if (empty($call))
        return "No callers on list.";
      else
      {
        $list = "<font color=CCInfoHeadline>::: List of callers :::</font>\n\n";
        foreach ($call as $player)
          $list .= " - <a href='chatcmd:///macro ".$player[1]." /assist ".$player[1]."'>".$player[1]."</a>\n";
        return $this -> bot -> make_blob("List of Callers", $list);
      }
    }
  }
?>
« Last Edit: May 10, 2006, 06:28:06 pm by Malosar »
Eternalist
General of The Syndicate

Offline Jarras

  • BeBot Rookie
  • *
  • Posts: 12
  • Karma: +0/-0
Re: callers
« Reply #2 on: May 10, 2006, 06:29:09 pm »
To make a quick caller macro if I am raiding within another bot, i use this one. Just type !assist <name> and I get the macro, works in tells, private groups, and org chat.

 

* Recent Posts
[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm]


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 502
  • 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-2024, SimplePortal