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: !RTIMER COMMAND (Was: Setting Multiple Messages In Cron)  (Read 4449 times)

0 Members and 1 Guest are viewing this topic.

Offline seknetari

  • BeBot User
  • **
  • Posts: 43
  • Karma: +0/-0
!RTIMER COMMAND (Was: Setting Multiple Messages In Cron)
« on: September 02, 2011, 04:35:40 pm »
How do I get Cron to display multiple messages at different intervals? Here is my current code. How can I change the code to have it do this?

Code: [Select]
<?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(&$botget_class($this));


$this->register_event('cron''60min');


}


/*
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"Looking for guild mini-pvp events or setting up dungeon parties? Join our forums: http://freecompanions.guildlaunch.com/");
}


}
?>

Thanks for any help!
-Sek
« Last Edit: September 24, 2011, 03:23:55 pm by seknetari »

Offline Shelly

  • BeBot Apprentice
  • ***
  • Posts: 192
  • Karma: +0/-0
Re: Setting Multiple Messages In Cron
« Reply #1 on: September 03, 2011, 11:05:06 pm »
This may sound silly, but why not just use the !rtimer? Or is that not available in AoC?

 ::::: HELP ON RTIMER :::::

Setting and removing of timers..

 !rtimer [class] <dur>[mshd] <repeat>[mshd] title - Adds a repeating timer for <dur> minutes (m), seconds (s), hours (h) or days (d). If no time unit is added it's <dur> seconds. <rep> is the time between repetitions of the timer, the same rules as for <dur> apply. [class] is an optional parameter defining which timer class to use.
 !rtimer [class] <dur>[:##[:##[:##]]] <repeat>[:##[:##[:##]]] title - Adds a timer using the format days:hours:minutes:seconds, with the lowest time unit always being seconds (so 1:20 means 1min 20secs, 1:03:05 means 1hour 3mins 5secs). On every : there have to follow exactly two numbers. You don't have to enter all numbers. <rep> is the time between repetitions of the timer, the same rules as for <dur> apply. [class] is an optional parameter defining which timer class to use.

Offline seknetari

  • BeBot User
  • **
  • Posts: 43
  • Karma: +0/-0
Re: Setting Multiple Messages In Cron
« Reply #2 on: September 06, 2011, 02:45:36 am »
Thanks, I'll try using this. Although the last time I tried !rtimer, I couldn't delete the message. and it got really annoying.
Thanks again for the reply!

Offline Kyr

  • BeBot Apprentice
  • ***
  • Posts: 177
  • Karma: +0/-0
Re: Setting Multiple Messages In Cron
« Reply #3 on: September 06, 2011, 11:13:02 pm »
I have played around with !rtimer.  I was never able to get it to do what I wanted.

Offline seknetari

  • BeBot User
  • **
  • Posts: 43
  • Karma: +0/-0
Re: Setting Multiple Messages In Cron
« Reply #4 on: September 07, 2011, 04:19:52 am »
Can you give me an example of how the command would look please?

Where does the message go? Is that the [class]?

Offline Oolwe

  • BeBot User
  • **
  • Posts: 47
  • Karma: +0/-0

Offline seknetari

  • BeBot User
  • **
  • Posts: 43
  • Karma: +0/-0
Re: Setting Multiple Messages In Cron
« Reply #6 on: September 11, 2011, 09:44:39 pm »
I appreciate the attempts to help, but the link really didn't help me out. I have a message being broadcast fine. I would like to know exactly how to add multiple messages to Cron.

I would actually prefer to use !timer (or is it !rtimer?) to display messages, such as upcoming guild activities in our guild chat channel. I have looked all around the forums and I cannot find a thread on how to use !timer. I have gone over the help info and I am still left confused. Is !timer even meant to run messages? What is [class] for in the !timer command? I haven't been able to find out what classes are possible to use, let alone what they do. I even went through the AO forums with no success. :(

It boils down to this, aside from Cron, is there a way for Bebot to have the same message displayed in guild chat every 90 minutes? If so, how is it done? Please give me an example of the command line too.

Thank you again for trying to help me.
« Last Edit: September 11, 2011, 09:46:20 pm by seknetari »

Offline Shelly

  • BeBot Apprentice
  • ***
  • Posts: 192
  • Karma: +0/-0
Re: Setting Multiple Messages In Cron
« Reply #7 on: September 24, 2011, 06:06:43 am »
Try this:

/tell <yourbot> !rtimer 90m repeat 90m "This is an announcement that will happen every 90 minutes until canceled."

Offline seknetari

  • BeBot User
  • **
  • Posts: 43
  • Karma: +0/-0
Re: Setting Multiple Messages In Cron
« Reply #8 on: September 24, 2011, 02:14:31 pm »
I'll try it out.

Offline seknetari

  • BeBot User
  • **
  • Posts: 43
  • Karma: +0/-0
Re: Setting Multiple Messages In Cron
« Reply #9 on: September 24, 2011, 02:43:45 pm »
The format of your command was a little off. I put this in and Bebot accepted it:

"!rtimer repeat 20m 5m This is a test announcement that will happen every 5 minutes until canceled."

I put everything between the quotes, as is, as a command. Bebot spit back:

"[Guild] [MyBot]: Timer This is a test announcement that will happen every 5 minutes until canceled. with 00:20:00 runtime started! The timer has a repeat interval of 00:05:00"

I thought it would work. No, it didn't. The announcement was never made. Now I am trying:
"!rtimer repeat 5m 5m This is a second test announcement that will happen every 5 minutes until canceled."

I will update soon.

Offline seknetari

  • BeBot User
  • **
  • Posts: 43
  • Karma: +0/-0
Re: !RTIMER COMMAND (Was: Setting Multiple Messages In Cron)
« Reply #10 on: September 24, 2011, 03:23:22 pm »
Failed.

I then tried...
"!rtimer guild 5m 5m This is a third test announcement that will happen every 5 minutes until canceled."

This also failed.

The command is accepted, but it never shows up in guild chat. None of the commands have shown up in guild chat. I have ended up deleting the messages using !timer. So everything SEEMS to be working correctly, except that I haven't gotten the TITLE (message) to show up in guild chat.

How do I get my messages to show up in guild chat using !rtimer?


Offline Shelly

  • BeBot Apprentice
  • ***
  • Posts: 192
  • Karma: +0/-0
Re: !RTIMER COMMAND (Was: Setting Multiple Messages In Cron)
« Reply #11 on: September 24, 2011, 07:28:53 pm »
Did you do "!rtimer 2m 2m This is a test of the repeating timer." In your org chat? Seems it takes the originating channel and uses that.

Or try:
!rtimer Global 2m 2m This is a test of the global repeating timer.

This one should work from a tell or any channel.

You may also want to look at your "/tell <yourbot> !settings Timer"

Notes on Timer Settings:
Code: [Select]
DefaultClass:  Standard
  Description: Which is the name of the default class to use for timers if no other is specified?
/tell <yourbot> !set Timer DefaultClass <new value>
* There is also a LowSpam setting that produces less output.

DeleteRank:  ADMIN
  Description: Minimal access level to remove timer of other players.
  Change to: [ ANONYMOUS | GUEST | MEMBER | LEADER | ADMIN | SUPERADMIN | OWNER ]

Global:  Off
  Description: Are all timers global? Notices for global timers are sent both to guild chat and private group. Global timers are listed in every timer listing too.
  Change to: [ On | Off ]

GuestChannel:  origin
  Description: Should an timer started in guestchannel or org-chat show up in both those channels or just in the channel of origin?
  Change to: [ both | origin ]

MinRepeatInterval:  30
  Description: What's the minimal repeat interval for repeating timers (in seconds)? This is used to prevent annoying spam.
  Change to: [ 5 | 10 | 15 | 20 | 25 | 30 | 45 | 60 ]

RecoveryCheckInterval:  10
  Description: How many minutes should pass between each check to recover after a database failures?
  Change to: [ 5 | 10 | 15 | 30 | 45 | 60 ]

Relay:  Off
  Description: Should new timer be relayed to all relay bots using the established relay network (See module/Relay.php for more informations about relaying)?
  Change to: [ On | Off ]

« Last Edit: September 24, 2011, 08:22:02 pm by Shelly »

Offline seknetari

  • BeBot User
  • **
  • Posts: 43
  • Karma: +0/-0
Re: !RTIMER COMMAND (Was: Setting Multiple Messages In Cron)
« Reply #12 on: September 25, 2011, 06:00:34 am »
I tried all of that, and nothing. I turned everything on in settings and still no difference. Bebot accepts the message. It is logged in under !timers. The problem is that it doesn't display in guild chat channel. It doesn't display anywhere. I may just start the bot off from the start again??

Offline Shelly

  • BeBot Apprentice
  • ***
  • Posts: 192
  • Karma: +0/-0
Re: !RTIMER COMMAND (Was: Setting Multiple Messages In Cron)
« Reply #13 on: September 25, 2011, 10:24:25 pm »
That sounds like it might be wise. Though I don't have AoC bots, the code is the same for org/guild channel. And it works in my bots.

Make sure your Bot "character" is a member of your org/guild would be my only other suggestion and recheck your settings in your "<bothome>/conf/Bot.conf" file.

Offline seknetari

  • BeBot User
  • **
  • Posts: 43
  • Karma: +0/-0
Re: !RTIMER COMMAND (Was: Setting Multiple Messages In Cron)
« Reply #14 on: September 26, 2011, 11:59:04 am »
The bot works fine except for the rtimer command. I'm getting an old dell computer that I may run as a linux server for bebot. I would like for it to run so that the bot would start itself when the computer starts. This way if there is a power outage, it will come back online automatically. I'm hoping that can be done. Thanks for trying to help Shelly.

 

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