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

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

Author Topic: Bio.php idea how to use it easier  (Read 4397 times)

0 Members and 1 Guest are viewing this topic.

Offline Keepitreal

  • BeBot Rookie
  • *
  • Posts: 1
  • Karma: +0/-0
Bio.php idea how to use it easier
« on: November 08, 2006, 05:06:20 pm »
Hy Guys,

i know my englisch will be awefull for you but i need your knowledge. :)

i try to merge the bio.php module in this way that i only have to drag and drop the Solid Bio Clump into the Chat/Tell and get a result without adding a !bio in front of the Item.

Is there any way?

Greetz Keepitreal

Offline Naturalistic

  • Contributor
  • *******
  • Posts: 221
  • Karma: +0/-0
Re: Bio.php idea how to use it easier
« Reply #1 on: November 08, 2006, 07:47:44 pm »
Yes and no for the "easy" part.

You need to recode almost all the module summed up. Read from the tells/pgroup, and if the "input" preg_matches the regex for the Bio... then continue and edit the function for determining the type of bio.

imo, it's just easier to use the one that works :P
220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: Bio.php idea how to use it easier
« Reply #2 on: November 09, 2006, 07:46:19 pm »
You would have to add commands and the functions that would go with them:

$commands["gmsg"][$guild_name][] = &$blah;
$commands["privgroup"][] = &$blah;

function gmsg($name, $group, $msg)
function privgroup($name, $msg)

Then you would have to write a regular expression to match it, which is already done in Bio.php so no big deal.

So you would have code that looks like:

Code: [Select]
function gmsg($name, $group, $msg)
{
    if (preg_match("/<a href=\"itemref:\/\/([0-9]+)\/([0-9]+)\/([0-9]+)\">Solid Clump of Kyr'Ozch Bio-Material<\/a>/i", $msg, $info))
    {
        $this -> bot -> send_gc($this -> make_bio($info[2], $info[3]));
    }
}

function privgroup($name, $msg)
{
    if (preg_match("/<a href=\"itemref:\/\/([0-9]+)\/([0-9]+)\/([0-9]+)\">Solid Clump of Kyr'Ozch Bio-Material<\/a>/i", $msg, $info))
    {
        $this -> bot -> send_gc($this -> make_bio($info[2], $info[3]));
    }
}

The downside of doing this is that your bot will not check every line of text sent to guild chat and the private group to see if it is a clump of bio material, instead of only checking lines that start with the command prefix.

Oh, and I have no idea if this will actually work. It's not like I tested it.

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


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


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

* Who's Online
  • Dot Guests: 302
  • 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