Advertisement
by United Calanworie » Wed Jul 26, 2023 2:19 pm
by Improper Classifications » Wed Jul 26, 2023 2:27 pm
by The Ice States » Wed Aug 02, 2023 11:26 pm
by United Calanworie » Wed Aug 02, 2023 11:28 pm
The Ice States wrote:Why does the <COAUTHOR> tag of the proposals API shard now give strings such as "ARRAY(0x7f8d078abcc8)" instead of the actual co-authors listed in <N> tags? It returning these strings appears to be new, CF: The resolution shard.
by Ever-Wandering Souls » Thu Aug 03, 2023 7:05 am
Roavin wrote:Ever-Wandering Souls wrote:If you mean specific to the values themselves, they're largely possible to approximate as-is with the influence census, endos census, activity, and a loose approximation of the decay rate - accurately enough to get the job done at least. I do it for ops all the time. It just requires a massive pain in the ass spreadsheet of starting inf + endos at update (in or out of the region) - assumed decay, updated twice daily.
Having done this myself, I feel your pain
I'll bring the suggestion up backstage.
The Alicorns (Equestria) wrote:Let them stay, no need to badmouth them...From our view a bunch of nations just came in, seized the delegate position, and changed a few superficial things...we play NationStates differently...there's really no reason for us to be butthurt.
http://www.nationstates.net/page=rmb/postid=8944227
http://www.nationstates.net/page=rmb/postid=8951258
Reploid Productions wrote:Raiders are endlessly creative
by Grishahakkaverchynot » Sat Aug 05, 2023 10:21 am
by United Calanworie » Sat Aug 05, 2023 10:36 am
by Vleerian » Sun Aug 06, 2023 7:18 pm
<CARDS>
<DECK>
<CARD>
<CARDID>1526694</CARDID>
<CATEGORY>common</CATEGORY>
<SEASON>1</SEASON>
<MARKETVALUE>0.01</MARKETVALUE>
</CARD>
...
</DECK>
</CARDS>
by Vleerian » Sat Aug 12, 2023 9:37 am
<CARDS>
<CARDSEASON>3</CARDSEASON>
</CARDS>
by Eluvatar » Mon Aug 21, 2023 4:20 pm
Grishahakkaverchynot wrote:I think that maybe, if you want people to stop using the HTML site to do script stuff, it might help adding RO actions as performable API actions?
Improper Classifications wrote:Is there a private API command that allows Executive regional officers to appoint and dismiss officers?
by Improper Classifications » Mon Aug 21, 2023 9:46 pm
Eluvatar wrote:Grishahakkaverchynot wrote:I think that maybe, if you want people to stop using the HTML site to do script stuff, it might help adding RO actions as performable API actions?Improper Classifications wrote:Is there a private API command that allows Executive regional officers to appoint and dismiss officers?
What use case(s) would you like to support with such an API?
by 9003 » Fri Aug 25, 2023 9:12 am
by 9003 » Fri Sep 29, 2023 9:31 am
by Eluvatar » Fri Sep 29, 2023 12:06 pm
United Calanworie wrote:The Ice States wrote:Why does the <COAUTHOR> tag of the proposals API shard now give strings such as "ARRAY(0x7f8d078abcc8)" instead of the actual co-authors listed in <N> tags? It returning these strings appears to be new, CF: The resolution shard.
As remarked on off-site, this is due to the API going "ah yes, you *totally* wanted to have me just send the memory address of an array across the internet, didn't you?" A certified Perl classic, if you ask me.
Ideally it'll get fixed at some point in the near future.
9003 wrote:Steps to reproduce
goto/request
https://www.nationstates.net/cgi-bin/ap ... =proposals
Look at
<COAUTHOR>ARRAY(0x7f8da2748e98)</COAUTHOR>
It should be the data in the array and not the memory location of the array.
by 9003 » Fri Sep 29, 2023 4:58 pm
Eluvatar wrote:United Calanworie wrote:As remarked on off-site, this is due to the API going "ah yes, you *totally* wanted to have me just send the memory address of an array across the internet, didn't you?" A certified Perl classic, if you ask me.
Ideally it'll get fixed at some point in the near future.9003 wrote:Steps to reproduce
goto/request
https://www.nationstates.net/cgi-bin/ap ... =proposals
Look at
<COAUTHOR>ARRAY(0x7f8da2748e98)</COAUTHOR>
It should be the data in the array and not the memory location of the array.
A change has been drafted to fix this and should be available for your pleasurewithin a day or twonow.
by United States of Dictators » Sun Oct 22, 2023 7:35 am
Headers({'server': 'cloudflare', 'date': 'Sun, 22 Oct 2023 14:21:38 GMT', 'content-type': 'text/html', 'content-length': '175', 'connection': 'close', 'cf-ray': '-'})
by The Ice States » Sun Oct 22, 2023 7:53 pm
by Devious » Fri Oct 27, 2023 3:37 pm
by Frisbeeteria » Fri Oct 27, 2023 6:48 pm
Devious wrote:filter=cte seems to cover nations dying of natural causes, but not DEATs.
by Devious » Fri Oct 27, 2023 8:37 pm
Frisbeeteria wrote:Devious wrote:filter=cte seems to cover nations dying of natural causes, but not DEATs.
Why do you need this? Make your case, please.
They don't appear in the Happening because we have a feature called "silent DEAT". As a general rule, we don't want to promote the offensive names we delete by posting happenings. For particularly egregious offensive nations, we actually purge all happenings (moves, issues, posts, etc) so players don't have to look at remnants of that sort of nonsense.
by Refuge Isle » Sat Oct 28, 2023 6:46 pm
Devious wrote:this runs into the issue of nations DEATed between the point of collection and point of relaying being impossible to detect without significantly increasing the tool's API overhead by doing a call for each nation and discarding them on a 404 error
my thought was to reduce this by instead pulling a list of CTE'ed nations every time i pull foundings (currently on a 30m timer), and excluding any matches from my backlog, which would reduce the number of calls needed for that filter to #CTEs/100, rounded up. but as you mentioned, DEATs can't be grabbed from the happenings shard.
by Epithemia » Sun Dec 03, 2023 12:30 am
// Code by Epithemia
var api_version = 12;
function update() {
getEmperorEndorsers();
getCarcassonneOfficers();
getCarcassonneEndorsements();
// TODO getCitizens();
}
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Script Menu').addItem("Update Data",'update');
}
function getCarcassonneEndorsements() {
getRegionEndorsements("WA Nations","carcassonne",1,1,2);
}
function getCarcassonneOfficers() {
getRegionOfficers("Officers","carcassonne",1);
}
function getEmperorEndorsers() {
getNationEndorsers("Endorsers","ysengrim",1);
}
String.prototype.addQuery = function (obj) {
return this + "?" + Object.entries(obj).flatMap(([k, v]) => Array.isArray(v) ? v.map(e => `${k}=${encodeURIComponent(e)}`) : `${k}=${encodeURIComponent(v)}`).join("&");
}
var last_api_request = 0;
function getApiXml(params) {
var t = new Date();
params.v = api_version;
params.gdoc = SpreadsheetApp.getActiveSpreadsheet().getId();
params.useremail = Session.getActiveUser().getEmail();
Utilities.sleep(Math.max(601+last_api_request-t,0));
var response = UrlFetchApp.fetch("http://www.nationstates.net/cgi-bin/api.cgi".addQuery(params));
last_api_request = new Date().valueOf();
return XmlService.parse(response);
}
// arguments:
// sheetname: name of sheet to update
// region: name of region to query
// limit: lowest endorsement count to care about
// nation_col: column # of nation names
// ans_col: column # to put result in
function getRegionEndorsements(sheetname,regionname,limit,nation_col,ans_col) {
var sheet=SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetname);
var wa_nations = [];
var start = 1;
api_loop:
while(true) {
try {
var xml = getApiXml({region, q: 'censusranks', scale: 66, start });
var nations_xml = xml.getRootElement().getChild('CENSUSRANKS').getChild('NATIONS').getChildren();
for (nation_xml of nations_xml) {
var name = nation_xml.getChild('NAME').getText();
var endos = nation_xml.getChild('SCORE').getText();
if ( endos < limit ) {
break api_loop;
}
wa_nations.push({name, endos: endos});
Logger.log('nationname '+ name + ', endos '+endos);
}
start += 20;
} catch ( err ) {
Logger.log("Error: "+ err);
return;
}
}
sheet.getRange(2,nation_col,wa_nations.length,1).setValues(wa_nations.map(({name})=> ([name])));
sheet.getRange(2,ans_col,wa_nations.length,1).setValues(wa_nations.map(({endos})=> ([endos])));
}
// arguments:
// sheetname: name of sheet to update
// region: name of region to query
// nation_col: column # of nation names
// ans_col: column # to put office name in (optional)
function getRegionOfficers(sheetname,region,nation_col,ans_col) {
var sheet=SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetname);
var officer_nations = [];
try {
var xml = getApiXml({region, q: 'officers'});
var nations_xml = xml.getRootElement().getChild('OFFICERS').getChildren();
for (nation_xml of nations_xml) {
var name = nation_xml.getChild('NATION').getText();
var office = nation_xml.getChild('OFFICE').getText();
officer_nations.push({name, office})
Logger.log('nationname '+ name + ', office '+office);
}
} catch ( err ) {
Logger.log("Error: "+ err);
return;
}
sheet.getRange(2,nation_col,officer_nations.length,1).setValues(officer_nations.map(({name})=>([name])));
if( ans_col ) {
sheet.getRange(2,ans_col,officer_nations.length,1).setValues(officer_nations.map(({office})=>([office])));
}
}
// arguments:
// sheetname: name of sheet to update
// nation: name of nation to query
// nation_col: column # of endorser nation names
function getNationEndorsers(sheetname, nation, nation_col) {
var sheet=SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetname);
var endorser_nations = [];
try {
var xml = getApiXml({nation, q: 'endorsements'});
endorser_nations = xml.getRootElement().getChild('ENDORSEMENTS').getText().split(',');
} catch ( err ) {
Logger.log("Error: "+ err);
return;
}
Logger.log('endorser_nations '+endorser_nations);
sheet.getRange(2,nation_col,endorser_nations.length,1).setValues(endorser_nations.map((name)=>([name])));
}
by Orioni 2 » Fri Jan 12, 2024 5:33 am
https://www.nationstates.net/cgi-bin/rss.cgi?view=region.eurth;q=happenings;filter=rmb;nation=orioni_2
https://www.nationstates.net/cgi-bin/rss.cgi?view=region.eurth;q=happenings;filter=rmb
by Roavin » Mon Jan 15, 2024 10:40 am
by Refuge Isle » Mon Jan 15, 2024 5:00 pm
Advertisement
Users browsing this forum: Alt Capitalist Britain, Fauxia, New Cathen
Advertisement