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: Question about calling commands from another Module  (Read 2316 times)

0 Members and 1 Guest are viewing this topic.

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Question about calling commands from another Module
« on: October 17, 2005, 06:40:43 pm »
Basically what I need to know is, is it possible to call another command from inside module thats defined in another Module.

Reason I ask is I'm using the AFK.php that Crazied came up with that works great. However I can't seem to get the info to appear in the online list when someone calls !online.

What I have so far in Online.php inside the Function online_list() is:
Code: [Select]
if (isset($this -> bot -> commands["gc"]["afk"] -> afk[$player[0]]))
                  {
                     $online_list .= "<font color=#FF0000>(AFK)</font>\n";
                  }

Not even sure is that is correct. It doesn't toss any errors but it doesn't print out if they are AFK either.

Anyone have any ideas?
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Question about calling commands from another Module
« Reply #1 on: October 18, 2005, 12:43:21 am »
You can, you just have to make sure the other module really gets loaded, or the bot will crash with an error ("Illegal function call" or something like that).

It works for functions, not sure what the rule for variables in objects is in PHP.
You could try adding a function that returns your wanted value, instead of trying to access the variable directly. Not sure if it will help with your problem though.

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Question about calling commands from another Module
« Reply #2 on: October 18, 2005, 04:23:32 am »
The simplest way is to do something like this:
$this -> bot -> commands["tell"]["online"] -> tell($name, "online");

That will pretend that a tell came from $name requesting the online module with the parameter online
BeBot Founder and Fixer Kingpin

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Question about calling commands from another Module
« Reply #3 on: October 19, 2005, 06:32:41 am »
NM, I found the problem. I was using the wrong channel in the command:
Online now reports those list as AFK with the Bot using Crazied's AFK.php :D

Code: [Select]
if ($this -> bot -> commands["tell"]["afk"] -> afk[$player[0]])
                  {
                     $online_list .= "<font color=#FF0000>(AFK)</font>\n";
                  }


Also didn't need to use isset()
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

 

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