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: assist macro generator for 0.3.5+  (Read 3589 times)

0 Members and 1 Guest are viewing this topic.

Offline Parfet

  • BeBot User
  • **
  • Posts: 33
  • Karma: +0/-0
assist macro generator for 0.3.5+
« on: July 11, 2007, 04:36:44 am »
Assist plugin for BeBot 0.3.5+

returns a generic assist macro if you don't give it a name

Assist.php:
Code: [Select]
<?php
/*
* Assist module for Bebot 0.3.5+ created by Parfet of Rimor
*
* BeBot - An Anarchy Online Chat Automaton
* Copyright (C) 2004 Jonas Jax
* Copyright (C) 2005 Thomas J. Stens� and ShadowRealm Creations
*
* Developed by:
* - Blondengy (RK1)
* - Khalem (RK1)
*
* See Credits file for all aknowledgements.
*
*  This program is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
*  USA
*
* File last changed at $LastChangedDate: 2007-06-12 15:09:11 +0200 (Tue, 12 Jun 2007) $
* Revision: $Id: _ExampleModule.php 619 2007-06-12 13:09:11Z alreadythere $
*/

/*
Add a "_" at the beginning of the file (_Assist.php) if you do not want it to be loaded.
*/

$assist = new assist($bot);

$commands["tell"]["assist"] = &$assist;
$commands["pgmsg"]["assist"] = &$assist;
$commands["gc"]["assist"] = &$assist;

/*
The Class itself...
*/
class Assist
{
var $bot;
var $help;


/*
Constructor:
Hands over a referance to the "Bot" class.
Defines access control for the commands
Creates settings for the module
Defines help for the commands
*/
function Assist (&$bot)
{
$this -> bot = &$bot;

$this -> bot -> accesscontrol -> create ('tell''assist''ANONYMOUS');
$this -> bot -> accesscontrol -> create ('gc''assist''ANONYMOUS');
$this -> bot -> accesscontrol -> create ('pgmsg''assist''ANONYMOUS');

$this -> help['description'] = 'Assist module for BeBot 0.3.5+';
$this -> help['command']['assist']="Provides a generic '/assist' macro.";
$this -> help['command']['assist name'] = "Provides an '/assist name' macro.";
}

/*
This gets called on a tell with the command
*/
function tell($name$msg)
{
$this -> bot -> send_tell($name$this -> assist_blob($msg));
}

/*
This gets called on a msg in the privgroup with the command
*/
function pgmsg($name$msg)
{
$this -> bot -> send_pgroup($this -> assist_blob($msg));
}

/*
This gets called on a msg in the guildchat with the command
*/
function gc($name$msg)
{
$this -> bot -> send_gc($this -> assist_blob($msg));
}

/*
This creates the /assist blob
*/
function assist_blob($msg)
{
$msg rtrim($msg);
if (preg_match("/^" $this -> bot -> commpre "assist ([a-zA-Z0-9]{4,25})$/i"$msg$info)) {
$name ucfirst(strtolower($info[1]));
$inside "<center>##White##:##Red##:##White##:";
$inside .= " <a href='chatcmd:///macro $name /assist $name'>Assisting $name</a>.";
$inside .= " :##Red##:##White##:##End##</center>";
return $this -> bot -> make_blob("Click"$inside) . " to assist ##Highlight##$name##End##.";
} else {
$inside "<center>##White##:##Red##:##White##:";
$inside .= " <a href='chatcmd:///macro Assist /assist'>Assist Macro</a>.";
$inside .= " :##Red##:##White##:##End##</center>";
return $this -> bot -> make_blob("Click"$inside) . " to make a generic assist macro.";
}
}
}
?>


suggestions welcome

 

* 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: 465
  • 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