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: Glarawyn's Alien Playfield Spawn Time Guesstimator for BeBot  (Read 10640 times)

0 Members and 1 Guest are viewing this topic.

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Glarawyn's Alien Playfield Spawn Time Guesstimator for BeBot
« on: November 29, 2005, 07:47:15 am »
I've rolled up version 0.9.8 (AKA Release Candidate #2)

Features:
- Accurately guesses the next APF Gates.
- Caches the timestamp data so the bot doesn't hit up my website every time someone does !apf.
- Automatically refreshes cached data after four hours.
- Automatically alerts private group and guild chat when there is 6h, 5h, 4h, 3h, 2h, 1h, 45m, 30m, 15m, 10m, 5m, and 1m left to gate opening.
- RP friendly output! (Hey, some people like it that way)
- Fully configurable (/tell yourbot !help !apf and /tell yourbot !apf set)
- Much easier installation


Download:
Glarawyn's Alien Playfield Spawn Time Guesstimator for BeBot, 0.9.8 (AKA Release Candidate #2)

Installation:
Step 1:
Unzip to your BeBot directory.

Step 2:
Restart your bot.

Step 3:
Enjoy!

Quick Summary of commands:

!apf - Displays Time to next APF
!apf set - Displays Configuration Menu
!apf set web - Forces update from web source.
!apf set now - Sets timestamp to now (Next apf in 7 hours, 12 minutes)
!apf set (+|-) <HH:MM:SS> - Adds or Removes HH:MM:SS from the timer.
!apf set (gatetime|uptime) <YYYY-MM-DD HH:MM:SS> - Manually set the seed time.
!apf set <setting> <value> - set <setting> to <value>

Valid Settings:
apfalertorg - (0|1) Disable/Enable Auto Alerts to Org Channel
apfalertpgroup - (0|1) Disable/Enable Auto Alerts to Guest Channel

*NOTE: Disabling apfalertorg and apfalertpgroup will turn off all alerts for that channel reguardles of what the other alert settings are.

apfalert60sec - (0|1) Disable/Enable 60 seconds remaining alert
apfalert10min - (0|1) Disable/Enable 10 minutes remaining alert
apfalert15min - (0|1) Disable/Enable 15 minutes remaining alert
apfalert30min - (0|1) Disable/Enable 30 minutes remaining alert
apfalert45min - (0|1) Disable/Enable 45 minutes remaining alert
apfalert1hour - (0|1) Disable/Enable 1 hour remaining alert
apfalert2hour - (0|1) Disable/Enable 2 hours remaining alert
apfalert3hour - (0|1) Disable/Enable 3 hours remaining alert
apfalert4hour - (0|1) Disable/Enable 4 hours remaining alert
apfalert5hour - (0|1) Disable/Enable 5 hours remaining alert
apfalert6hour - (0|1) Disable/Enable 6 hours remaining alert

Web Update Settings:
apfwebupdate - (0|1) Disables/Enables Automatic Web Updates
apftimeurl - <URL> Sets the URL for Automatic Web Updates
apfcachetime - <seconds> How many seconds to keep Web data cached (Default 4 hours, I don't reccomend changing this.)

Other settings that can be set manually, but you probally shouldn't set them manually:
apftimestamp - <UNIX Time Stamp> Sets the Unix Time Stamp. (You probally don't want to do this manually! Use the gatetime|uptime option for easy input)
apftimeinc - <seconds> Number of seconds between Gate Openings. (You probally don't want to change this!)
apfstampage - <seconds> When the timestamp was written to the database.  (You probally don't want to change this!)
« Last Edit: January 11, 2006, 08:59:23 pm by Glarawyn »

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Glarawyn's Alien Playfield Spawn Time Guesstimator for BeBot
« Reply #1 on: November 29, 2005, 12:31:36 pm »
Thanks... but umm this should be in the "Custom/Unofficial Modules" forum. :D
<<< Hack's in Zend Studio

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

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Glarawyn's Alien Playfield Spawn Time Guesstimator for BeBot
« Reply #2 on: November 29, 2005, 01:27:27 pm »
Oh btw, if you don't mind a little Tip with this one.
Couple of us found while playing with my Modified version of Playfield.php by Craized, adding the following function in Bebot's Bot.php helped with timing.
Code: [Select]
   /*
     Bot.php function --- Returns a selected setting:
   */
   function get_setting($set)
    {
    $res = $this -> db -> select("SELECT * FROM settings"
                     . " WHERE setting = '" . $set . "'");
    if (!empty($res))
return $res[0][1];
    else
return "";
    }
This would make your Function GetDBStamp() Look like this:
Code: [Select]
function GetDBStamp()
    {
        // FIXME: I was having some issues getting the timing right. changed result to result0, result1, and result2 for debugging.
        $result0 = $this -> bot -> get_setting("apfstamptype");
        $info[0] = $result0[0][0];
        $result1 = $this -> bot -> get_setting("apftimestamp");
        $info[1] = $result1[0][0];
        $result2 = $this -> bot -> get_setting("apfstampage");
        $info[2] = $result2[0][0];
        return $info;
    }

You can find my modified copy of Playfield.php Here
Uses your timestamp btw... just not as fancy as yours. :p
<<< 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
Glarawyn's Alien Playfield Spawn Time Guesstimator for BeBot
« Reply #3 on: November 29, 2005, 01:44:14 pm »
The get_setting function returns a string, no array - so it should be:
Code: [Select]
function GetDBStamp()
    {
        // FIXME: I was having some issues getting the timing right. changed result to result0, result1, and result2 for debugging.
        $info[0] = $this -> bot -> get_setting("apfstamptype");
        $info[1] = $this -> bot -> get_setting("apftimestamp");
        $info[2] = $this -> bot -> get_setting("apfstampage");
        return $info;
    }

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Glarawyn's Alien Playfield Spawn Time Guesstimator for BeBot
« Reply #4 on: November 29, 2005, 01:46:24 pm »
*Smacks forehead*
I pulled a Khalem... coding while half asleep. heheh

But umm ya. What Alreadythere said.  :P

Oh and that 3rd Info should be Info[2] Alreadythere (I'm not the only one coding half asleep I see.)
<<< 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
Glarawyn's Alien Playfield Spawn Time Guesstimator for BeBot
« Reply #5 on: November 29, 2005, 02:08:15 pm »
Quote from: "Xenixa"
Oh and that 3rd Info should be Info[2] Alreadythere (I'm not the only one coding half asleep I see.)

Hehe, not coding half asleep, just doing C/P with all it's dangers :)
Corrected.

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Glarawyn's Alien Playfield Spawn Time Guesstimator for BeBot
« Reply #6 on: November 29, 2005, 02:57:50 pm »
Ok, I'm Officially Bored:
Did your Help Files (place in the \bebot\help folder of course)
I cheated though. I had already created these for playfield.php :P

apf.txt
Code: [Select]
<font color=CCInfoHeader>Usage: <pre>apf</font>
<font color=CCInfoText>Displays the time left to next APF gate opening.

See <a href='chatcmd:///tell <botname> <pre>help <pre>setapf'><pre>help <pre>setapf</a> for related info.
setapf.txt
Code: [Select]
<font color=CCInfoHeader>Usage: <pre>setapf</font>
<font color=CCInfoText>Forces the time stamp data to be downloaded and recached. (Admin only command)
<<< Hack's in Zend Studio

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

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Glarawyn's Alien Playfield Spawn Time Guesstimator for BeBot
« Reply #7 on: November 29, 2005, 06:13:22 pm »
Quote from: "Xenixa"
Thanks... but umm this should be in the "Custom/Unofficial Modules" forum. :D


It should be...late night coding and clicked the wrong place... :)

Maybe we can poke Khalem into moving the thread.

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Glarawyn's Alien Playfield Spawn Time Guesstimator for BeBot
« Reply #8 on: November 30, 2005, 07:29:08 pm »
Quote from: "Xenixa"
Oh btw, if you don't mind a little Tip with this one.
Couple of us found while playing with my Modified version of Playfield.php by Craized, adding the following function in Bebot's Bot.php helped with timing.
You can find my modified copy of Playfield.php Here
Uses your timestamp btw... just not as fancy as yours. :p



I don't mind tips at all. :D

Personally, I don't think adding a function to Bot.php is a good idea. The idea behind the modules is to add functionality to the bot without changing the bot code. If get_setting/save_setting type functions get added in later versions I'll definitely make use of them. Until then, I'll do it the "hard" way.

Thanks for the help files! More time for coding!

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Glarawyn's Alien Playfield Spawn Time Guesstimator for BeBot
« Reply #9 on: November 30, 2005, 09:08:26 pm »
Is there any way we could have a +/- UTC setting to automatically add or deduct time based on your timezone (perhaps a global setting in the .conf file for the bot)?

For my bot, time is always 2 hours out...

Cheers,

-jj-

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Glarawyn's Alien Playfield Spawn Time Guesstimator for BeBot
« Reply #10 on: December 01, 2005, 12:17:04 am »
Quote from: "jj666"

For my bot, time is always 2 hours out...


It should be timezone independent. Could you give me some details about your computer? OS, PHP version, etc...

Also, which server do you play on? I only play on RK1 so the timestamp data on my website is always calibrated to RK1.

Thanks.

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Glarawyn's Alien Playfield Spawn Time Guesstimator for BeBot
« Reply #11 on: December 01, 2005, 08:29:06 am »
well damn me it works fine this morning when I checked! =)

will keep my eye on it this week - FYI, I play on RK1 also.

To [apfbot]: !time
[Apfbot]: Gates open in aproximately 4 hours and 19 minutes!
To [jjbot]: !apf
[Jjbot]: Unicorn Gatekeeper will open the Outzone gates in 4 hours, 17 minutes, and 21 seconds.

-jj-

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Glarawyn's Alien Playfield Spawn Time Guesstimator for BeBot
« Reply #12 on: December 02, 2005, 01:56:59 pm »
Glarawyn, does your Webserver were you show the APF gates times running behind a Squid server? Reason I ask is my bot is always exactly 3 mins faster than what that page reports. My server is always sync'd every 12hr to an Atomic clock.

If it's not running behind a SQID have you checked the servers clock?
<<< Hack's in Zend Studio

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

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Glarawyn's Alien Playfield Spawn Time Guesstimator for BeBot
« Reply #13 on: December 05, 2005, 06:40:26 pm »
My computer is synced to a time server as well. I checked it today and it had drifted 3 minutes, so I set it to update every 12 hours instead. There is no proxy server involved.

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Glarawyn's Alien Playfield Spawn Time Guesstimator for BeBot
« Reply #14 on: December 06, 2005, 05:57:10 pm »
I forgot something important last night, so I added:

Code: [Select]
$this -> bot -> send_pgroup("Don't forget to get authorization form the Unicorn Security Administrator!");

To the 15, 10, 5, and 60 second warnings.

I also rolled up Xenixa's help files, the SQL, and a README into a nice easy to install zip file.

 

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