PDA

View Full Version : Syncing up a script with a neopets clock



Xanice
04-20-2023, 06:49 PM
Hey all!

So I have made a ton of progress on some of my more fun endeavors and actually completed the original program i was working on! I've now moved on to testing my knowledge by trying to make a script perform timed events. In example, if you know that a shop will refresh at a specific time (say 3:00 PM Neo time), what would be some ways I could get the time from any neopets page and keep my script on the same schedule?

If you have some ideas and would like details, please pm me! I prefer to keep my projects more private for the time being!

Thanks!

Bat
04-20-2023, 07:13 PM
The Neopets clock is set to Pacific time, so offsetting your local time by that timezone will get you close to the current time on the webpage. You can also retrieve the current time by loading a webpage with the Neopets clock on it, but the delay between the server completing the request and you receiving the full response may be enough to mess up the timing in such a way that you may be off by a few seconds. That's not important for full day refresh cycles, but something particularly finicky like the petpet care portion of the Altador plot would be impacted by the misalignment.

Xanice
04-20-2023, 07:19 PM
The Neopets clock is set to Pacific time, so offsetting your local time by that timezone will get you close to the current time on the webpage. You can also retrieve the current time by loading a webpage with the Neopets clock on it, but the delay between the server completing the request and you receiving the full response may be enough to mess up the timing in such a way that you may be off by a few seconds. That's not important for full day refresh cycles, but something particularly finicky like the petpet care portion of the Altador plot would be impacted by the misalignment.


Hey Bat, thanks again for the help as always! I will test it out using an alignment with pacific time. I was just worried that if the server lags or delays it would potentially mess up the clock synchronization, but to be fair - the method of attempting to scrape it off the page is probably both harder and more likely to be off by a few seconds (which is the same worry i had for aligning it with an external clock).

I really appreciate the help! Right now my prototype of that tool we discussed is functional despite the fact im still running it from a notebook! I'd love to get some feedback from you some time after I get through with busy work week and the core functionality of this new project.

Hope you have a great night and cheers!

Bat
04-20-2023, 07:27 PM
Hey Bat, thanks again for the help as always! I will test it out using an alignment with pacific time. I was just worried that if the server lags or delays it would potentially mess up the clock synchronization, but to be fair - the method of attempting to scrape it off the page is probably both harder and more likely to be off by a few seconds (which is the same worry i had for aligning it with an external clock).

I really appreciate the help! Right now my prototype of that tool we discussed is functional despite the fact im still running it from a notebook! I'd love to get some feedback from you some time after I get through with busy work week and the core functionality of this project.

Hope you have a great night and cheers!

Bad timing is unavoidable on Neopets in its current state, so all you can do is either approximate or compensate. If you can generally assume that the time on the local computer is accurate, then you'd add the variables ((nh * 3600000) + (nm * 60000) + (ns * 1000)) (and make sure to watch out for military versus standard time on nh!) from the Neopets page response together, then subtract the result from the computer's current time in milliseconds since midnight. From that you'd get an offset that you can add to future local wait timers in order to better align yourself with the Neopets clock.

Hit me up whenever you'd like!