BeBot - An Anarchy Online and Age Of Conan chat automaton
Development => Coding and development discussion => Topic started by: Diablo on September 06, 2007, 08:12:17 am
-
Im trying to convert aigen module to work with bebot it give link back but only displays array maybe someone can help see where problem is thanks.
$aigen = new Aigen($bot);
$commands["tell"]["aigen"] = &$aigen;
$commands["pgmsg"]["aigen"] = &$aigen;
$commands["gc"]["aigen"] = &$aigen;
/*
The Class itself...
*/
class Aigen
{
var $bot;
/*
Constructor:
Hands over a referance to the "Bot" class.
*/
function Aigen (&$bot)
{
$this -> bot = &$bot;
$this -> bot -> accesscontrol -> create('all', 'aigen', 'GUEST');
$this -> help['description'] = "Gives information on general drops";
$this -> help['command']['aigen <expression>'] = "Shows the result of the general <expression>";
}
/*
This gets called on a tell with the command
*/
function tell($name, $msg)
{
if (preg_match("/^" . $this -> bot -> commpre . "aigen (Ankari|Ilari|Rimah|Jaax|Xoch|Cha)/i", $msg, $info))
$this -> bot -> send_tell($name, $this -> make_aigen($info[2]));
else
$this -> bot -> send_help($name);
}
/*
This gets called on a msg in the privgroup with the command
*/
function pgmsg($name, $msg)
{
if (preg_match("/^" . $this -> bot -> commpre . "aigen (Ankari|Ilari|Rimah|Jaax|Xoch|Cha)/i", $msg, $info))
$this -> bot -> send_pgroup($this -> make_aigen($info[2]));
}
/*
This gets called on a msg in the guildchat with the command
*/
function gc($name, $msg)
{
if (preg_match("/^" . $this -> bot -> commpre . "aigen (Ankari|Ilari|Rimah|Jaax|Xoch|Cha)/i", $msg, $info))
$this -> bot -> send_gc($this -> make_aigen($info[2]));
}
/*
This calculates the implant quality level
*/
function make_aigen($gen)
{
$ai[Ankari] = "<red>Low Evade/Dodge,low AR, casting Viral/Virral nukes.<blue> \nBoss of this type drops:\n\n<img src=rdb://100337></img>\n<a href='itemref://247145/247145/300'>Arithmetic Lead Viralbots</a>.\n<orange>(Nanoskill / Tradeskill)<blue>\n<img src=rdb://255705></img>\n<a href='itemref://247684/247684/300'>Kyr'Ozch Bio-Material - Type 1</a></br><br><img src=rdb://255705></img>\n<a href='itemref://247685/247685/300'>Kyr'Ozch Bio-Material - Type 2</a>";
$ai[Ilari]="<red>Low Evade/Dodge.<blue>\nBoss of this type drops:\n\n<img src=rdb://100337></img>\n<a href='itemref://247146/247146/300'>Spiritual Lead Viralbots</a>.<orange>\n(Nanocost / Nanopool / Max Nano)<blue>\n<img src=rdb://255705></img>\n<a href='itemref://247681/247681/300'>Kyr'Ozch Bio-Material - Type 992</a>\n<img src=rdb://255705></img>\n<a href='itemref://247679/247679/300'>Kyr'Ozch Bio-Material - Type 880</a>";
$ai[Rimah]="<red>Low Evade/Dodge.<blue>\nBoss of this type drops:\n\n<img src=rdb://100337></img>\n<a href='itemref://247143/247143/300'>Observant Lead Viralbots</a>.<orange>\n(Init / Evades)<blue>\n<img src=rdb://255705></img>\n<a href='itemref://247675/247675/300'>Kyr'Ozch Bio-Material - Type 112</a>\n<img src=rdb://255705></img>\n<a href='itemref://247678/247678/300'>Kyr'Ozch Bio-Material - Type 240</a>";
$ai[Jaax]="<red>High Evade, Low Dodge.<blue>\nBoss of this type drops:\n\n<img src=rdb://100337></img>\n<a href='itemref://247139/247139/300'>Strong Lead Viralbots</a>.<orange>\n(Melee / Spec Melee / Add All Def / Add Damage)\n<blue><img src=rdb://255705></img>\n<a href='itemref://247694/247694/300'>Kyr'Ozch Bio-Material - Type 3</a>\n<img src=rdb://255705></img>\n<a href='itemref://247688/247688/300'>Kyr'Ozch Bio-Material - Type 4</a>";
$ai[Xoch]="<red>High Evade/Dodge, casting Ilari Biorejuvenation heals.<blue>\nBoss of this type drops:\n\n<img src=rdb://100337></img>\n<a href='itemref://247137/247137/300'>Enduring Lead Viralbots</a>.<orange>\n(Max Health / Body Dev)<blue></br><br><img src=rdb://255705></img>\n<a href='itemref://247690/247690/300'>Kyr'Ozch Bio-Material - Type 5</a>\n<img src=rdb://255705></img>\n<a href='itemref://247692/247692/300'>Kyr'Ozch Bio-Material - Type 12</a>";
$ai[Cha]="<red>High Evade/NR, Low Dodge.<blue>\nBoss of this type drops:\n\n<img src=rdb://100337></img>\n<a href='itemref://247141/247141/300'>Supple Lead Viralbots</a>.<orange>\n(Ranged / Spec Ranged / Add All Off)\n<img src=rdb://255705></img>\n<a href='itemref://247696/247696/300'>Kyr'Ozch Bio-Material - Type 13</a>\n<img src=rdb://255705></img>\n<a href='itemref://247674/247674/300'>Kyr'Ozch Bio-Material - Type 76</a>";
return "General :: " . $this -> bot -> make_blob("click to view", $ai);
}
}
?>
-
return "General :: " . $this -> bot -> make_blob("click to view", $ai);
should be
return "General :: " . $this -> bot -> make_blob("click to view", $ai[$gen]);
-
Ok changed that now just blank info window. Doesnt seem to be reading the info. Should the general names be in "s or anything?
-
Added "s around gen names and now they read correctly. Now just gotta get them to read upper and lower case. Thxs
$ai["ankari"]
-
strtolower($gen) is your friend, just leave the index names in all lower case then.
-
add at beginning of function make_aigen
$gen = ucfirst(strtolower($gen));
will change to same format as u have
-
Cool thxs
-
is there a completed version of this mod posted somewhere?
~boogy
-
http://bebot.link/0-2-x-customunofficial-modules/general-drop-module/msg3451/#msg3451 (http://bebot.link/0-2-x-customunofficial-modules/general-drop-module/msg3451/#msg3451)
-
Tried to get module....but JJ site timed out
I am running 0.4.3 of the bot, has JJ's been modified to work with that version of the bot?
~boogy
-
thanks anyway for the link, but I finally got this working. the strtolower function did not seem to work, so I just did things the old fashioned way
~boogy
-
i posted 1 yesterday
http://bebot.link/0-5-x-customunofficial-modules/aiboss-or-aigen/ (http://bebot.link/0-5-x-customunofficial-modules/aiboss-or-aigen/)
-
My bad.....was just trying to help
~boogy
-
just fyi for the svn version you need to change line 153 to the following and then I beleive it will work with out crashing the bot.. I have not tested it yet though
return "AI drops :: " . ($this -> bot -> core("tools") -> make_blob("click to view", $list));