BeBot - An Anarchy Online and Age Of Conan chat automaton

Development => Coding and development discussion => Topic started by: Harry on August 12, 2007, 10:50:09 pm

Title: Whats wrong?
Post by: Harry on August 12, 2007, 10:50:09 pm
I recently started using PHP, so I know that I'm noob  :-\
I already used similar module, so I simply copied file and changed everything to armorshop. But when I do !armorshop , I get: "Broken plugin, recieved unhandled command: armorshop". Whats wrong in code?  ???
Code: [Select]
<?php

$thisClass 
= new armorshop($bot);

$commands["tell"]["armorshop"] = &$thisClass;

class 
armorshop
{
var $bot;
var $help;

function armorshop (&$bot)
{
$this -> bot = &$bot;

$this -> bot -> accesscontrol -> create ('tell', 'armorshop', 'GUEST');

}

     
     
function handler($source, $msg, $type)
{
$return = false;

$vars = explode(' ', strtolower($msg));
if (!empty($this -> bot -> commpre))
{
$vars[0] = substr($vars[0], 1);
}

$command = $vars[0];

switch($command)
{
case 'armorshop':
$this -> bot -> send_output($source, $this -> arm_blob(), $type);
break;
default:
$this -> bot -> send_output($source, "Broken plugin, recieved unhandled command: $command", $type);
}
      
      }
      
      
function tell($source, $msg)
{
$this -> handler ($source, $msg, 1);
}

      function 
arm_blob()
{
$inside = "##blob_title##my text##end##\n\n";
return $this -> bot -> make_blob("Armor Shop", $inside);
      }
      
}          
?>
Title: Re: Whats wrong?
Post by: Parfet on August 13, 2007, 04:01:50 pm
change $thisClass to read $armorshop and &$thisClass to read &$armorshop, should work as intended
SimplePortal 2.3.7 © 2008-2026, SimplePortal