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: Cron module  (Read 9774 times)

0 Members and 1 Guest are viewing this topic.

Offline Jiheld

  • BeBot User
  • **
  • Posts: 53
  • Karma: +0/-0
Cron module
« on: December 07, 2008, 02:50:04 pm »
Hi,
I used the Cron module to send a msg in the guildchat every 20 mins.
But the text is in Yellow.
Is there a way to make this another color?

Quote
<?php
/*
* cron.php - Module template.
* Cron module - <module description>
* <Copyright notice for your module>
*
* BeBot - An Anarchy Online & Age of Conan Chat Automaton
* Copyright (C) 2004 Jonas Jax
* Copyright (C) 2005-2007 Thomas Juberg Stensås, ShadowRealm Creations and the BeBot development team.
*
* Developed by:
* - Alreadythere (RK2)
* - Blondengy (RK1)
* - Blueeagl3 (RK1)
* - Glarawyn (RK1)
* - Khalem (RK1)
* - Naturalistic (RK1)
* - Temar (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; version 2 of the License only.
*
*  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: 2008-11-30 23:09:06 +0100 (Sun, 30 Nov 2008) $
* Revision: $Id: _ExampleModule.php 1833 2008-11-30 22:09:06Z alreadythere $
*/

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

$thisClass = new cron($bot);

/*
The Class itself...
*/
class cron extends BaseActiveModule
{

   function __construct (&$bot)
   {
      //Initialize the base module
      parent::__construct(&$bot, get_class($this));


      $this->register_event('cron', '20min');

   
   }


   /*
   Unified message handler
   $source: The originating player
   $msg: The actual message, including command prefix and all
   $type: The channel the message arrived from. This can be either "tell", "pgmsg" or "gc"
   */
   function command_handler($source, $msg, $origin)
   {
      //ALWAYS reset the error handler before parsing the commands to prevent stale errors from giving false reports
      $this->error->reset();
      
      //The default is to split the command to com, sub and args. If you want to split it some other way change the pattern for it
      //parse_com() returns an array where the pattern is the keys and the values are split out from $msg
      $com = $this->parse_com($msg, array('com', 'sub', 'args'));
      
      $command = $vars[0];

      switch($com['com'])
      {
         case 'command1':
            return($this -> somefunction($name, $com));
            break;
         case 'command2':
            return($this -> someotherfunction($name, $com));
         default:
            // Just a safety net to allow you to catch errors where a module has registered  a command, but fails to actually do anything about it
            $this -> error -> set("Broken plugin, recieved unhandled command: $command");
            return($this->error->message());
      }
   }
   
   /*
   This gets called on cron  if you previously registered the event 'cron, interval'
   $interval is the string name for the time delay between two cron jobs.
   */
   function cron($interval)
   {
$this -> bot -> send_gc( "New Raid, Join for the Epix!!! Sign up on the raid calendar on our site!!! Dont sit there!!! SIGN!!!");
   }
   
   
}
?>

playing AoC btw.

Thnx.

Jih.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Cron module
« Reply #1 on: December 07, 2008, 03:08:57 pm »
Simply add a color tag around the output.

Like ##forestgreen##Output##end##, will give Output colored in forest green. Check !color for a list of all existing color tags.

Offline Jiheld

  • BeBot User
  • **
  • Posts: 53
  • Karma: +0/-0
Re: Cron module
« Reply #2 on: December 07, 2008, 06:11:13 pm »
cool, got it.

Can you ad highlights with this also?


Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Cron module
« Reply #3 on: December 07, 2008, 06:16:36 pm »
Sure, you can put as many tags inside as you want.

At least as long as you close the last one before starting the new one, AO got a limit for encapsulating font tags. Though around 5 definitly work.

Offline Jiheld

  • BeBot User
  • **
  • Posts: 53
  • Karma: +0/-0
Re: Cron module
« Reply #4 on: December 07, 2008, 06:47:26 pm »
cool,

Hows the line going to look like?
got this now

Quote
$this -> bot -> send_gc( "##highlight## ##purple## New Raid, Join for the Epix!!! Sign up on the raid calendar on our site!!! Dont sit there!!! SIGN!!!##end##");

But the highlight isnt working, did i mis something?

thnx alot

Jih.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Cron module
« Reply #5 on: December 07, 2008, 07:45:03 pm »
Ah. Highlight is just a color like purple, FC doesn't support any other formatting ingame.

You can just mix as many colors as you want in the output.

Offline Jiheld

  • BeBot User
  • **
  • Posts: 53
  • Karma: +0/-0
Re: Cron module
« Reply #6 on: December 07, 2008, 08:06:35 pm »
ahh oke, thanx alot for your help :D


Offline khayman

  • BeBot User
  • **
  • Posts: 21
  • Karma: +0/-0
Re: Cron module
« Reply #7 on: December 08, 2008, 06:30:26 pm »
Actually FC supports some more formating using <font face=facename>BeBot</font>
Where the supported facenames are:
NORMAL,NORMAL_ITALIC,NORMAL_BOLD,SMALL,LARGE,LARGE_BOLD,HUGE,CHAT,HEADLINE,LARGE_SC,
3D_TEXT,3D_TEXT_BOLD,SCALED,3D_TEXT_SMALL,3D_TEXT_ARIAL,3D_TEXT_HYB,HYBORIANSMALL,
HYBORIANLARGE,FLYING_NUMBERS,FLYING_NUMBERS_ITALICS,FLYING_NUMBERS_SHIELDED,
FLYING_NUMBERS_SHIELDED_ITALICS,COMBAT_FEEDBACK

i.e. <font face=HYBORIANSMALL>BeBot</font>

« Last Edit: December 11, 2008, 06:42:04 am by khayman »

Offline Blueeagle

  • Omnipotent
  • BeBot Hero
  • ******
  • Posts: 323
  • Karma: +0/-0
Re: Cron module
« Reply #8 on: December 11, 2008, 10:02:40 pm »
Actually FC supports some more formating using <font face=facename>BeBot</font>
...
i.e. <font face=HYBORIANSMALL>BeBot</font>
There are differences in AoCML and AOML. Since the BeBot project supports both I think it unwise to use anything but the common ground.
Ofcourse it would be possible to make a translation table where those AoCML font entities actually meant something in both ML sets.
The only problem that can't be solved by adding another wrapper is having too many wrappers.

Offline Temar

  • Contributor
  • *******
  • Posts: 1140
  • Karma: +0/-0
    • AoFiles
Re: Cron module
« Reply #9 on: December 11, 2008, 10:36:17 pm »
yer we use tags so when the tag gets change , what it gets changed to can depend on the game

Offline xdave78

  • BeBot User
  • **
  • Posts: 26
  • Karma: +0/-0
Re: Cron module
« Reply #10 on: February 14, 2009, 07:03:24 pm »
Code: [Select]
  function cron($interval)
   {
$this -> bot -> send_gc("Events der Woche - <a href='chatcmd:///!script events'>Klick!</a>");
   }
   

..why does the Link NOT WORK? Its shown bun no klick allowed???

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Cron module
« Reply #11 on: February 14, 2009, 07:22:23 pm »
Because it's no chat command I guess.

Code: [Select]
function cron($interval)
   {
$this -> bot -> send_gc("Events der Woche - <a href='chatcmd:///tell <botname> <pre>script events'>Klick!</a>");
   }
Replace /tell <botname> with the command for whichever channel you want to use.

Offline xdave78

  • BeBot User
  • **
  • Posts: 26
  • Karma: +0/-0
Re: Cron module
« Reply #12 on: February 14, 2009, 07:47:41 pm »
It is a command ..and it works when I call it manually in the Guidchat with !script events.
When I call it by Cron it has also the rightformat (underlines and Orange) its just not clickable...
I dont want to TELL I want the Cron to post the output in GC.
(Its a ScriptModue command)
« Last Edit: February 14, 2009, 07:54:39 pm by xdave78 »

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Cron module
« Reply #13 on: February 14, 2009, 08:58:14 pm »
!script events might be a working bot command, but it's no legal format inside a chat command.

Try removing one of the three / inside, or put <a href='chatcmd:///gu <pre>script events'> inside, I think that should work.

Of course, you could check out the tools function chatcmd. 14_Tools.php is in the main/ folder.

Offline xdave78

  • BeBot User
  • **
  • Posts: 26
  • Karma: +0/-0
Re: Cron module
« Reply #14 on: February 14, 2009, 10:28:33 pm »
Didnt work  :-\  :'( I dont get it...
I tried everything possible with my small knowledge about coding .

When I let the bot ONLY write out the simple command "!events" (when I write it into chat it makes the right response) in the Guildchat its also not working...I think it doesnt listen to itself.

I dont think its got to do with the chatcmd:/// because in another tool where I also call one of these scripts out of a window it works.

Sorry for my english..I´m from Germany ;) and that thing would really really be a useful function for my guildmates.
« Last Edit: February 14, 2009, 10:46:50 pm by xdave78 »

 

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