NATION

PASSWORD

SerinApprox | mIRC Update Approximation Script

Bug reports, general help, ideas for improvements, and questions about how things are meant to work.
User avatar
Hobbesistan
Minister
 
Posts: 2448
Founded: Jul 01, 2013
Ex-Nation

SerinApprox | mIRC Update Approximation Script

Postby Hobbesistan » Thu Feb 20, 2014 5:35 pm

SerinApprox 1.2

What is it?

SerinApprox is a system used by Serina - the IRC bot I set up for Lazarus, The East Pacific, and the Lazerene Liberation Army. The system uses NationStates++ API to take Timestamps and calculate them into a useable estimation of updatetime.

How does it work?


Serina uses NationStates++(as previously mentioned), which calculates updatetime based on things like issues answered, delegate switches, ect. This will be far more accurate on more active regions then systems like FriarTuck, who guesstimate based off of the NationStates data dumps, NS++ (And Serina as a result) use hard calculated data. This is going to be far more accurate on more active regions (Serina has been 2-3 minutes more accurate then FT on several situations - which obviously is life and death during a update) but will suffer on more inactive regions because no data has been collected.


Do I need NS++ to make it work?

No - It reads data directly from the NS++ website.


Who to credit?


I would be lieing if i took full credit for the project, I suuuuck with sockets and the like, I'd infact argue most of the credit goes to the scripting help channel in EsperNet, the guys there are exceptionally awesome.

How to use it?

Plug it into the 'Remote' tab of the mIRC script editor, then .approx (region) and if the bot is set up right, it will spit out the region, guesstimated approximation, and even by how much this estimation may be off.

IMPORTANT: Change #YOURCHANNEL in the .approx command to what channel you want it to work in!

<sidenote> You'll need to use underscores (_) for regions that are multiple words (ex: The_East_Pacific instead of The East Pacific), this is really easilly fixable but I am lazy.</sidenote>

Where do I get it?

Here(1.2) (7/29/2015)
Here(1.0) (6/28/2014)
Here(0.97) (4/08/2014)
Here(0.96) (2/20/2014)

Should I expect updates/support?


I'm generally lurking on #hobbeshost on espernet, Please don't TG me for support over this; I get enough telegrams as is.

Cormac: Does it report back to me/the LLA?

Sadly(kidding), no. The code is published and anyone can look it over assured its not reporting back to the hobbeshost spying center.
Last edited by Hobbesistan on Wed Jul 29, 2015 5:24 pm, edited 10 times in total.
Hobbes
ra, ra rasputin

(Ret.) Maintainer of the Nationstates FAQ and Deletiger (Ret.) of The East Pacific
russia's greatest

Hobbes is always winning, like Charlie Sheen. - Jurisdictions
love machine

Stop right there (hobbes), your rational thought and intellect will destroy the internet. - Sovreignry
it was a shame how

Giraffes think Hobbes regret a lot. A lot of giraffes do. - Rachel
he carried on.

User avatar
Shadow Afforess
Ambassador
 
Posts: 1270
Founded: Nov 06, 2013
Ex-Nation

Postby Shadow Afforess » Thu Feb 20, 2014 7:46 pm

Looks great Hobbes. I wish more of the bots used across NationStates were available too.
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move.

User avatar
Cerian Quilor
Senator
 
Posts: 3841
Founded: Mar 30, 2012
Iron Fist Socialists

Postby Cerian Quilor » Fri Feb 21, 2014 9:05 am

I'm glad they're not.
Never underestimate the power of cynicism, pessimism and negativity to prevent terrible things from happening. Only idealists try to build the future on a mountain of bodies.

The Thing to Remember About NationStates is that it is an almost entirely social game - fundamentally, you have no power beyond your own ability to convince people to go along with your ideas. In that sense, even the most dictatorial region is fundamentally democratic.

User avatar
Tano
Ambassador
 
Posts: 1441
Founded: Dec 20, 2012
Ex-Nation

Postby Tano » Fri Feb 21, 2014 4:25 pm

Cerian Quilor wrote:I'm glad they're not.

Because...?
Tano Holland
Govindia: Do you consider me a friend, or just an acquaintance or what?
hobbes: I don't particularly consider anyone a true 'friend'
hobbes: at least,not on NS
Govindia: why is that?
hobbes: because
hobbes: everyone here is a jackass
hobbes: myself included

Pixie: *heart sploosh*
Tano: if your heart is splooshing you should contact a doctor
Tano: hearts are supposed to thump not sploosh
Pixie: No this is normal
Pixie: intense emotion causes me to hemorrage internally
Pixie: my life is like a really depressing comedic episode of The X-Files

Khron: we need an achievment of rem's face just for Tano
Pixie: haha
Pixie: "be Tano"

Brunhilde: My quotes should be in more signatures.

Also known as Takane or Terisclu

User avatar
Shadow Afforess
Ambassador
 
Posts: 1270
Founded: Nov 06, 2013
Ex-Nation

Postby Shadow Afforess » Fri Feb 21, 2014 4:37 pm

Cerian Quilor wrote:I'm glad they're not.


I really don't want to send Hobbes thread off the rails, but basically, you're wrong. The secretive culture around so many groups in NationStates is the source of much of the stagnation in the game. I've been apart, am apart of many other communities and the ability to share ideas, technology is what helps them grow and expand. In my experience, much of the culture of long-term players of NationStates is incredibly negative, and actively rejects new ideas and changes. Anyone clearly not "in-the-know" is slammed hard. A clear example of this is the recent R/D Guide that was posted in Gameplay. None of the experienced players offered to help co-write or improve the guide. Most were dismissive or intentionally made negative remarks. That is just a microcosm of what happens all over in NationStates.

I'm not trying to lay blame or say Cerian or others are at fault here. I am just glad Hobbes has made a step towards reversing the stifling culture in NS.
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move.

User avatar
Hobbesistan
Minister
 
Posts: 2448
Founded: Jul 01, 2013
Ex-Nation

Postby Hobbesistan » Tue Mar 04, 2014 9:15 pm

Having been bugged over TG for help on this, I ask that anyone seeking support goes on #hobbeshost (esper) instead of spamming my TG inbox.

I also will be releasing a version of this that calculates minor update within the next few days.
Hobbes
ra, ra rasputin

(Ret.) Maintainer of the Nationstates FAQ and Deletiger (Ret.) of The East Pacific
russia's greatest

Hobbes is always winning, like Charlie Sheen. - Jurisdictions
love machine

Stop right there (hobbes), your rational thought and intellect will destroy the internet. - Sovreignry
it was a shame how

Giraffes think Hobbes regret a lot. A lot of giraffes do. - Rachel
he carried on.

User avatar
Hobbesistan
Minister
 
Posts: 2448
Founded: Jul 01, 2013
Ex-Nation

Postby Hobbesistan » Tue Apr 08, 2014 5:15 pm

0.97
Now with .minor update approximation!

http://pastebin.com/aq4gf6L7


Same install, set #YOURREGION on both .approx and .minor to your appropriate channel.
Hobbes
ra, ra rasputin

(Ret.) Maintainer of the Nationstates FAQ and Deletiger (Ret.) of The East Pacific
russia's greatest

Hobbes is always winning, like Charlie Sheen. - Jurisdictions
love machine

Stop right there (hobbes), your rational thought and intellect will destroy the internet. - Sovreignry
it was a shame how

Giraffes think Hobbes regret a lot. A lot of giraffes do. - Rachel
he carried on.

User avatar
Hobbesistan
Minister
 
Posts: 2448
Founded: Jul 01, 2013
Ex-Nation

Postby Hobbesistan » Mon Jun 23, 2014 8:18 pm

Newest NS++ backend update just jacked up SerinApprox, i'll have a fix up soon™
Hobbes
ra, ra rasputin

(Ret.) Maintainer of the Nationstates FAQ and Deletiger (Ret.) of The East Pacific
russia's greatest

Hobbes is always winning, like Charlie Sheen. - Jurisdictions
love machine

Stop right there (hobbes), your rational thought and intellect will destroy the internet. - Sovreignry
it was a shame how

Giraffes think Hobbes regret a lot. A lot of giraffes do. - Rachel
he carried on.

User avatar
Mallorea and Riva
Game Moderator
 
Posts: 9986
Founded: Sep 29, 2010
Benevolent Dictatorship

Postby Mallorea and Riva » Mon Jun 23, 2014 9:18 pm

Out of curiosity just how accurate is this?
Ideological Bulwark #253
Retired Major of The Black Hawks
Retired Charter Nation: Political Affairs in Antarctic Oasis
Retired Colonel of DEN Central Command, now defunct
Former Delegate of The South Pacific, winner of TSP's "Best Dali" Award
Retired Secretary of Defense of Stargate
Terror of The Joint Systems Alliance
Mall Isaraider, son of Tram and Spartz, Brother of Tal and apparently Sev the treacherous bastard.
Frattastan quote of the month: Mall is following those weird beef-only diets now.

User avatar
Misley
Diplomat
 
Posts: 609
Founded: Jan 05, 2009
Ex-Nation

Postby Misley » Mon Jun 23, 2014 9:30 pm

Mallorea and Riva wrote:Out of curiosity just how accurate is this?


As accurate as NS++ is, which makes it useful to check roughly when a region updates but not accurate enough to time jumps from.
EGO·VERO·CUSTOSFRATRIS·MEI·SUM
Socialist People's Provinces of Misley

   
Editor of the Red & Black
Fleet Admiral of The Red Fleet
Custodian of The Internationale

User avatar
Hobbesistan
Minister
 
Posts: 2448
Founded: Jul 01, 2013
Ex-Nation

Postby Hobbesistan » Tue Jun 24, 2014 8:44 am

Mallorea and Riva wrote:Out of curiosity just how accurate is this?


It uses NS++ backend, this script will give you the rough time a region updates as well as the variance in seconds that the calculation may be off.

I've tested it with most XML scripts and found that for more active regions (because it relies on actual activity) this script is almost always right, but if its a super-inactive region, because no data has been collected, the result will be skewed.

It's not quite working right now due to a update in NS++ backend, i'll have a patch out soonish.
Last edited by Hobbesistan on Tue Jun 24, 2014 8:45 am, edited 2 times in total.
Hobbes
ra, ra rasputin

(Ret.) Maintainer of the Nationstates FAQ and Deletiger (Ret.) of The East Pacific
russia's greatest

Hobbes is always winning, like Charlie Sheen. - Jurisdictions
love machine

Stop right there (hobbes), your rational thought and intellect will destroy the internet. - Sovreignry
it was a shame how

Giraffes think Hobbes regret a lot. A lot of giraffes do. - Rachel
he carried on.

User avatar
Mallorea and Riva
Game Moderator
 
Posts: 9986
Founded: Sep 29, 2010
Benevolent Dictatorship

Postby Mallorea and Riva » Tue Jun 24, 2014 9:36 am

Hobbesistan wrote:
Mallorea and Riva wrote:Out of curiosity just how accurate is this?


It uses NS++ backend, this script will give you the rough time a region updates as well as the variance in seconds that the calculation may be off.

I've tested it with most XML scripts and found that for more active regions (because it relies on actual activity) this script is almost always right, but if its a super-inactive region, because no data has been collected, the result will be skewed.

It's not quite working right now due to a update in NS++ backend, i'll have a patch out soonish.

Right but how wide is the variance window on the calculations?
Ideological Bulwark #253
Retired Major of The Black Hawks
Retired Charter Nation: Political Affairs in Antarctic Oasis
Retired Colonel of DEN Central Command, now defunct
Former Delegate of The South Pacific, winner of TSP's "Best Dali" Award
Retired Secretary of Defense of Stargate
Terror of The Joint Systems Alliance
Mall Isaraider, son of Tram and Spartz, Brother of Tal and apparently Sev the treacherous bastard.
Frattastan quote of the month: Mall is following those weird beef-only diets now.

User avatar
Misley
Diplomat
 
Posts: 609
Founded: Jan 05, 2009
Ex-Nation

Postby Misley » Tue Jun 24, 2014 10:08 am

Mallorea and Riva wrote:
Hobbesistan wrote:
It uses NS++ backend, this script will give you the rough time a region updates as well as the variance in seconds that the calculation may be off.

I've tested it with most XML scripts and found that for more active regions (because it relies on actual activity) this script is almost always right, but if its a super-inactive region, because no data has been collected, the result will be skewed.

It's not quite working right now due to a update in NS++ backend, i'll have a patch out soonish.

Right but how wide is the variance window on the calculations?


It depends on the regional activity level of things that change at update (influence changes, issues answered, delegate changes, etc.). Large, active regions will be fairly accurate (within ~1-2 minutes) but small, inactive regions can be off by several minutes, if there's enough data to calculate an estimate at all.
EGO·VERO·CUSTOSFRATRIS·MEI·SUM
Socialist People's Provinces of Misley

   
Editor of the Red & Black
Fleet Admiral of The Red Fleet
Custodian of The Internationale

User avatar
Mallorea and Riva
Game Moderator
 
Posts: 9986
Founded: Sep 29, 2010
Benevolent Dictatorship

Postby Mallorea and Riva » Tue Jun 24, 2014 10:10 am

Misley wrote:
Mallorea and Riva wrote:Right but how wide is the variance window on the calculations?


It depends on the regional activity level of things that change at update (influence changes, issues answered, delegate changes, etc.). Large, active regions will be fairly accurate (within ~1-2 minutes) but small, inactive regions can be off by several minutes, if there's enough data to calculate an estimate at all.
That's more or less what I figured. Any approx that isn't accurate to within ten seconds really isn't useful.
Ideological Bulwark #253
Retired Major of The Black Hawks
Retired Charter Nation: Political Affairs in Antarctic Oasis
Retired Colonel of DEN Central Command, now defunct
Former Delegate of The South Pacific, winner of TSP's "Best Dali" Award
Retired Secretary of Defense of Stargate
Terror of The Joint Systems Alliance
Mall Isaraider, son of Tram and Spartz, Brother of Tal and apparently Sev the treacherous bastard.
Frattastan quote of the month: Mall is following those weird beef-only diets now.

User avatar
Hobbesistan
Minister
 
Posts: 2448
Founded: Jul 01, 2013
Ex-Nation

Postby Hobbesistan » Tue Jun 24, 2014 10:15 am

Mallorea and Riva wrote:
Hobbesistan wrote:
It uses NS++ backend, this script will give you the rough time a region updates as well as the variance in seconds that the calculation may be off.

I've tested it with most XML scripts and found that for more active regions (because it relies on actual activity) this script is almost always right, but if its a super-inactive region, because no data has been collected, the result will be skewed.

It's not quite working right now due to a update in NS++ backend, i'll have a patch out soonish.

Right but how wide is the variance window on the calculations?


I've seen 20-30seconds on more active regions, 15s or so at most.
Hobbes
ra, ra rasputin

(Ret.) Maintainer of the Nationstates FAQ and Deletiger (Ret.) of The East Pacific
russia's greatest

Hobbes is always winning, like Charlie Sheen. - Jurisdictions
love machine

Stop right there (hobbes), your rational thought and intellect will destroy the internet. - Sovreignry
it was a shame how

Giraffes think Hobbes regret a lot. A lot of giraffes do. - Rachel
he carried on.

User avatar
Misley
Diplomat
 
Posts: 609
Founded: Jan 05, 2009
Ex-Nation

Postby Misley » Tue Jun 24, 2014 10:16 am

Mallorea and Riva wrote:
Misley wrote:
It depends on the regional activity level of things that change at update (influence changes, issues answered, delegate changes, etc.). Large, active regions will be fairly accurate (within ~1-2 minutes) but small, inactive regions can be off by several minutes, if there's enough data to calculate an estimate at all.
That's more or less what I figured. Any approx that isn't accurate to within ten seconds really isn't useful.


It's not useful to time jumps or anything terribly serious, but it's nice to have a quick glance at a region and be able to tell roughly where in the update order it falls without having to refer to the dumps or a tool that pulls data from the dumps.
EGO·VERO·CUSTOSFRATRIS·MEI·SUM
Socialist People's Provinces of Misley

   
Editor of the Red & Black
Fleet Admiral of The Red Fleet
Custodian of The Internationale

User avatar
Shadow Afforess
Ambassador
 
Posts: 1270
Founded: Nov 06, 2013
Ex-Nation

Postby Shadow Afforess » Tue Jun 24, 2014 1:17 pm

Hobbesistan wrote:It's not quite working right now due to a update in NS++ backend, i'll have a patch out soonish.

What exactly broke, because I didn't change any existing fields in the backend...
Last edited by Shadow Afforess on Tue Jun 24, 2014 1:17 pm, edited 1 time in total.
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move.

User avatar
Hobbesistan
Minister
 
Posts: 2448
Founded: Jul 01, 2013
Ex-Nation

Postby Hobbesistan » Tue Jun 24, 2014 5:27 pm

Shadow Afforess wrote:
Hobbesistan wrote:It's not quite working right now due to a update in NS++ backend, i'll have a patch out soonish.

What exactly broke, because I didn't change any existing fields in the backend...


I have it set up in a numbered system (it reads the variables as numbers, i.e 1- for variance), because of the new update_order, its reading the wrong variables which spews out a stupid number (i.e <@Aiden> Major Update Calculation:  194:56:58 (+/-  16747  seconds ) )

A pretty easy fix when I have time.
Last edited by Hobbesistan on Tue Jun 24, 2014 5:29 pm, edited 1 time in total.
Hobbes
ra, ra rasputin

(Ret.) Maintainer of the Nationstates FAQ and Deletiger (Ret.) of The East Pacific
russia's greatest

Hobbes is always winning, like Charlie Sheen. - Jurisdictions
love machine

Stop right there (hobbes), your rational thought and intellect will destroy the internet. - Sovreignry
it was a shame how

Giraffes think Hobbes regret a lot. A lot of giraffes do. - Rachel
he carried on.

User avatar
Shadow Afforess
Ambassador
 
Posts: 1270
Founded: Nov 06, 2013
Ex-Nation

Postby Shadow Afforess » Tue Jun 24, 2014 6:56 pm

Ah, gotcha. The update was part of a few changes that allow NS++ to give updates for all regions, even regions with no data available. :)
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move.

User avatar
Misley
Diplomat
 
Posts: 609
Founded: Jan 05, 2009
Ex-Nation

Postby Misley » Fri Jun 27, 2014 6:58 pm

So I'm working on a Python version of this to use in XChat (a clearly superior IRC client :P ) and thought I'd share the fixed version of the mIRC script for anyone who wants to use it but doesn't care enough to figure out how to do it themselves:

Code: Select all
SerinApprox 0.98
~~~~~~~~~~~~~Minor~~~~~~~~~~~~~~~~~~~~
on *:text:.minor &:#YOURREGION:{
  if !$sock(pluspluss) { sockopen pluspluss nationstatesplusplus.net 80 | set %regionplus $2 }
  set %yourchannel #YOURREGION
  else notice $nick Wait!
}
on *:sockopen:pluspluss:{
  sockwrite -n $sockname GET /api/region/updatetime/?region= $+ %regionplus HTTP/1.0
  sockwrite -n $sockname $crlf
}

on *:sockread:pluspluss: {
  sockread &plus
  if $regex($bvar(&plus,1-).text,/"([^"]+)":("[^"]*"|[^"{][^,}]+)/g) {
    var %time = $calc($regml(12) / 1000 - 18000)
    if (%time < 0) %time = $calc(%time + 86400)
    msg %yourchannel  Minor Update Calculation:  $duration(%time,3) (+/-  $floor($calc($regml(10) /1000))  seconds )
  }
  unset %regionplus
}
~~~~~~~~~~~~~~Major~~~~~~~~~~~~~~~~~~~~~
on *:text:.approx &:#YOURREGION:{
  if !$sock(plusplus) { sockopen plusplus nationstatesplusplus.net 80 | set %regionplus $2 }
  set %yourchannel #YOURREGION
  else notice $nick Wait!
}
on *:sockopen:plusplus:{
  sockwrite -n $sockname GET /api/region/updatetime/?region= $+ %regionplus HTTP/1.0
  sockwrite -n $sockname $crlf
}

on *:sockread:plusplus: {
  sockread &plus
  if $regex($bvar(&plus,1-).text,/"([^"]+)":("[^"]*"|[^"{][^,}]+)/g) {
    var %time = $calc($regml(28) / 1000 - 18000)
    if (%time < 0) %time = $calc(%time + 86400)
    msg %yourchannel  Major Update Calculation:  $duration(%time,3) (+/-  $floor($calc($regml(26) /1000))  seconds )
  }
  unset %regionplus
}
EGO·VERO·CUSTOSFRATRIS·MEI·SUM
Socialist People's Provinces of Misley

   
Editor of the Red & Black
Fleet Admiral of The Red Fleet
Custodian of The Internationale

User avatar
Hobbesistan
Minister
 
Posts: 2448
Founded: Jul 01, 2013
Ex-Nation

Postby Hobbesistan » Fri Jun 27, 2014 8:16 pm

Hobbes
ra, ra rasputin

(Ret.) Maintainer of the Nationstates FAQ and Deletiger (Ret.) of The East Pacific
russia's greatest

Hobbes is always winning, like Charlie Sheen. - Jurisdictions
love machine

Stop right there (hobbes), your rational thought and intellect will destroy the internet. - Sovreignry
it was a shame how

Giraffes think Hobbes regret a lot. A lot of giraffes do. - Rachel
he carried on.

User avatar
Hobbesistan
Minister
 
Posts: 2448
Founded: Jul 01, 2013
Ex-Nation

Postby Hobbesistan » Wed Jul 29, 2015 5:09 pm

Version 1.2 is now live:
  • Adjusted socket system now that nationstatesplusplus.net forces HTTPS
  • Fixed what variables it calls upon as the NS++ backend now uses different numbers for different veriables
  • Fixed a annoying bug with bolding.

http://pastebin.com/eU1GHRRF
Hobbes
ra, ra rasputin

(Ret.) Maintainer of the Nationstates FAQ and Deletiger (Ret.) of The East Pacific
russia's greatest

Hobbes is always winning, like Charlie Sheen. - Jurisdictions
love machine

Stop right there (hobbes), your rational thought and intellect will destroy the internet. - Sovreignry
it was a shame how

Giraffes think Hobbes regret a lot. A lot of giraffes do. - Rachel
he carried on.


Advertisement

Remove ads

Return to Technical

Who is online

Users browsing this forum: Apy, Ariesee, Bahan Wortemburg, C o m m u n i s t a n, Cisplatinia, Der Krieg, Fasakuu, North American Imperial State, Santiago AU, Schardonia, Shirahime, Thebernesen, Tricorniolis, United Desri, Xoshen

Advertisement

Remove ads