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: Alien Playfield Module - Keep track of alien PF  (Read 12780 times)

0 Members and 1 Guest are viewing this topic.

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Alien Playfield Module - Keep track of alien PF
« Reply #30 on: November 21, 2005, 09:20:17 am »
My first question would be then is the time in the database actually being changed when you call the TimeStamp from the other site?

Best way to check I guess would be to query the settings table using whatever query tool you use after you set one then the other and compare the value recorded.

Edit: Or on second thought you could test from within the bot itself.
Change"
Code: [Select]
$this -> bot -> send_tell($name, "Time Stamp is set to $TimeStamp");
To:
Code: [Select]
$this -> bot -> send_tell($name, "Time Stamp is set to " . $this -> get_timer());

That will show you the UnixTime ingame from the database as $TimeStamp shows you what the bot got back from the Website(s).
<<< Hack's in Zend Studio

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

Offline Solerna

  • BeBot User
  • **
  • Posts: 21
  • Karma: +0/-0
Alien Playfield Module - Keep track of alien PF
« Reply #31 on: November 21, 2005, 03:48:39 pm »
Fater changing that I get:

Time Stamp is set to 0

Pussled me so I did some other similar changes.

I added a "   $this -> bot -> send_tell($name, $settime);"
Just before changing the DB result:

1132433115

So it seems he does take the date from the webpage and uses it atleast as far as making the $settime.

____________________________
        $this -> bot -> db -> query("UPDATE settings SET value = '".$settime."' WHERE setting = 'apf_timer'");
____
       $result = $this -> bot -> db -> select("SELECT * FROM settings WHERE setting = 'apf_timer'");

____________________________

First one is the setting of the timestamp in the Db, second one is retreiving it.

But is the second on correct? could check at since bot is curently being used (Kinda shitty setup atm)

$result = $this -> bot -> db -> select("SELECT value FROM settings WHERE setting = 'apf_timer'");

but shouldn't it be like this when retreiving the timestamp?

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Alien Playfield Module - Keep track of alien PF
« Reply #32 on: November 21, 2005, 07:19:38 pm »
The select method shouldn't matter really. I'm just so used to pulling an entire row and then looking at the pieces of that row.
But now that you bring it up I guess we really only need to pull the Value.

Just don't forget to remove the array qualifier off of $result. Or for comparision:
Code: [Select]
function get_timer() {
    $result = $this -> bot -> db -> select("SELECT value FROM settings WHERE setting = 'apf_timer'");
        return (int)$result;
    }
<<< Hack's in Zend Studio

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

Offline Solerna

  • BeBot User
  • **
  • Posts: 21
  • Karma: +0/-0
Alien Playfield Module - Keep track of alien PF
« Reply #33 on: November 22, 2005, 02:35:02 am »
Hmm nope that didn't do the trick. =/

Still get "Time Stamp is set to 0" and the timer doesn't change at all.

Starting to wonder if I'm crazy or something.
What pussles me even more is how this could be possible and yet the timer is running after I reboot the bot >.<

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Alien Playfield Module - Keep track of alien PF
« Reply #34 on: November 22, 2005, 05:58:49 am »
hmm, sounds like the field in the Database isn't really being updated. BTW I've since changed my playfield.php but havn't posted the changes.

Basically what I did was in the function time() I removed the $this -> stamp = $this -> get_timer(); and changed $time = $this -> stamp to $time = $this -> get_timer()

Also in the function Playfield (&$bot) I swaped out the $this -> stamp = $this -> get_timer(); with $time = $this -> get_timer()

More to eliminate an un-needed variable.
<<< Hack's in Zend Studio

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

Offline Solerna

  • BeBot User
  • **
  • Posts: 21
  • Karma: +0/-0
Alien Playfield Module - Keep track of alien PF
« Reply #35 on: November 22, 2005, 05:02:57 pm »
ok Gave up  on my copy of module. downloaded yours.

added

Code: [Select]
$this -> bot -> send_tell($name, "Time Stamp is set to " . $this -> get_timer());


And I still get :  Time Stamp is set to 0

After getting more confused I actually deleted the entire settings table and recreated it incase there had sneaked in some errors there. Still I get the same result.

I'm starting to get curious here, is this actually working for u?

Offline Solerna

  • BeBot User
  • **
  • Posts: 21
  • Karma: +0/-0
Alien Playfield Module - Keep track of alien PF
« Reply #36 on: November 22, 2005, 05:46:27 pm »
Hehe I'm going to fill this thread solo. Ok I found a way to actually get the timestamp not result in showing as 0

Code: [Select]

    function get_timer() {
        $result = $this -> bot -> get_setting("apf_timer");
        return (int)$result;
    }


Resulting in "Time Stamp is set to 1132433115"

Since we are using a setting this function does the trick and I don't have to worry about it.

This seems to fix all the issues I had =)
Or atleast I hope so. Now all I got to do is to fix my alt site and set the timestamp there.

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Alien Playfield Module - Keep track of alien PF
« Reply #37 on: November 23, 2005, 10:08:18 pm »
Yes it works for me. I'm curious however, were exactly is this get_setting() function defined? I've never seen it before and I can't find it.
<<< Hack's in Zend Studio

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

Offline Solerna

  • BeBot User
  • **
  • Posts: 21
  • Karma: +0/-0
Alien Playfield Module - Keep track of alien PF
« Reply #38 on: November 23, 2005, 11:31:36 pm »
Function is defined in bot. php


Code: [Select]

/*
        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 "";
        }

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Alien Playfield Module - Keep track of alien PF
« Reply #39 on: November 24, 2005, 09:39:47 pm »
Hmm, was that a custom Bot.php. The vanilla ones don't have that function. Added it to my copy of bot.php anyway for future use. :)

Updated my copy of Playfield.php to use the above function after placing the function in my copy of Bot.php (Placed just above the is_member() function.) Works fine and dandy.
<<< Hack's in Zend Studio

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

Offline Wanuarmi

  • Contributor
  • *******
  • Posts: 121
  • Karma: +0/-0
Alien Playfield Module - Keep track of alien PF
« Reply #40 on: November 24, 2005, 11:09:30 pm »
xen you should make a new topic and keep the first post updated :p

Offline Solerna

  • BeBot User
  • **
  • Posts: 21
  • Karma: +0/-0
Alien Playfield Module - Keep track of alien PF
« Reply #41 on: November 25, 2005, 06:57:21 am »
hmm no now when u say it I think I added that with some module. Got to check that, aught to have documented it somwere.

Yes, I asked for help with a banfunction and someone posted that. His example used this function

http://bebot.fieses.net/viewtopic.php?t=192

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Alien Playfield Module - Keep track of alien PF
« Reply #42 on: November 27, 2005, 09:18:36 pm »
I used my vacation time wisely, and ported over the module I'd written for VashBotPHP over to BeBot, and started adding functionality.

What I've done:
- Timestamp info is cached to the database, and automatically recached from my website every 4 hours. The apf.timestamp file is the 3rd most popular file on my website thanks to various bots. Thankfully it's not a large file. ;)

- Timestamp can be forced to refresh by an admin using the !setapf command.

To Do:
- Finish automatic hourly/countdown alerts in guild chat and private group.

Future versions:

- Allow disabling of web updates and setting the timestamp information from tells.

- Add a configuration setting for disabing/enabling automatic guild chat and private group alerts.

- Other stuff TBD. ;)


I'm travelling for business for the next two weeks, so I should actually have some free time to work on this as meals and cleaning and stuff are taken care of.

Offline Wanuarmi

  • Contributor
  • *******
  • Posts: 121
  • Karma: +0/-0
Alien Playfield Module - Keep track of alien PF
« Reply #43 on: December 01, 2005, 10:20:29 pm »
on all server resets after getting the new timestamp I need to edit the code and add/subtract hours for it to be right for some reason...

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Alien Playfield Module - Keep track of alien PF
« Reply #44 on: December 02, 2005, 01:26:18 am »
What OS you running your Bot on Wanuarmi?

Mine stays pretty much accurate after AO server restarts and a new Timestamp is posted. Usually 3 mins faster than what Glarawyn has posted.
<<< Hack's in Zend Studio

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

 

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