Conquer Club

army and territory count bookmarklet

Archival storage to keep things organized and uncluttered. Can't find what you need? Search for old topics here.

Moderator: Tech Team

Forum rules
Please read the Community Guidelines before posting.

army and territory count bookmarklet

Postby registered_user on Sat Sep 29, 2007 8:42 pm

Here's a quick bookmarklet script that may or may not be useful to you folks. I keep it in my bookmarks bar. Basically, you hit the bookmarklet, and the browser shows an alert that contains the players' names and how many armies and territories they have.

To use it, you create a bookmark and change the URL to this:

Code: Select all
javascript:var np=document.getElementById("players").getElementsByTagName("li").length;var te=new Array();var ar=new Array();var players=new Array();var skip=0;for(var i=0;i<np;i++){te[i]=0;ar[i]=0;var s=document.getElementById("players").getElementsByTagName("li")[i].getElementsByTagName("a")[0]; if(s){players.push(s.getElementsByTagName("span")[0].innerHTML);}else{skip++;}}np=np-skip;var aa=document.getElementById('armies').innerHTML.split(',');for(var i=0;i<aa.length;i++){var seg=aa[i].split("-");ar[seg[0]-1]=(ar[seg[0]-1]*1)+(seg[1]*1);te[seg[0]-1]++;}var output="There are "+np+" players\n---------------\n";for(var i=0;i<np;i++){output+=players[i]+"\n\tTotal Armies: "+ar[i]+"\n\tTotal Territories: "+te[i]+"\n\n";}alert(output);



It's not terribly exciting, and it may have been done before. I hope y'all find it useful. I tested in Safari 2 and Firefox 2.

enjoy.

edit: fixed the script to work in team games.
edit2: conflicted with the attack to drop-down, so I adjusted it, and I removed whitespace and shortened variable names.
Last edited by registered_user on Sun Sep 30, 2007 11:24 am, edited 2 times in total.
Major registered_user
 
Posts: 22
Joined: Sat Sep 08, 2007 8:50 pm
Location: Providence, RI

Postby gimil on Sat Sep 29, 2007 8:47 pm

if you use firefox theres a script that give these states on the in game window.

but its the thought that counts buddy :wink:

may be usful for those people who dont use FF
What do you know about map making, bitch?

natty_dread wrote:I was wrong


Top Score:2403
User avatar
Corporal 1st Class gimil
 
Posts: 8599
Joined: Sat Mar 03, 2007 12:42 pm
Location: United Kingdom (Scotland)

Postby registered_user on Sat Sep 29, 2007 8:56 pm

I also just noticed that it doesn't work in team games. It seems that the headlines are list items like the players. Oh well, it's not perfect. edit: fixed -- it now works in team games.

And yes, I've seen the FF add-ons. But I don't like Firefox, and when I do use it, I don't have any real use for Greasemonkey, so I'd just as soon keep the add-ons simple. :)
Last edited by registered_user on Sat Sep 29, 2007 9:34 pm, edited 1 time in total.
Major registered_user
 
Posts: 22
Joined: Sat Sep 08, 2007 8:50 pm
Location: Providence, RI

Postby PerkinsRooster on Sat Sep 29, 2007 8:56 pm

gimil wrote:
may be usful for those people who dont use FF


or those who use ajax like me
Let's golf.
Major PerkinsRooster
 
Posts: 90
Joined: Wed Feb 21, 2007 11:05 pm
Location: Canada

Postby registered_user on Sat Sep 29, 2007 9:34 pm

I hope you find it useful, Perkins.

Also, I just edited the original post. I fixed the script so that it works in team games.
Major registered_user
 
Posts: 22
Joined: Sat Sep 08, 2007 8:50 pm
Location: Providence, RI

Postby philh on Sun Sep 30, 2007 6:28 am

Works in Opera 9.2 as well.
Major philh
 
Posts: 85
Joined: Sat Jan 20, 2007 6:30 am

Re: army and territory count bookmarklet

Postby psaxnoulis on Sat May 03, 2008 2:18 pm

Thanx, man! Saves you from counting... And fatal mistakes...
User avatar
Major psaxnoulis
 
Posts: 14
Joined: Wed Mar 19, 2008 5:27 am
Location: Athens, Greece

Re: army and territory count bookmarklet

Postby registered_user on Mon Jun 09, 2008 6:35 pm

Hey! Does this count towards a Special Contribution medal?

::begs for hand out::
Major registered_user
 
Posts: 22
Joined: Sat Sep 08, 2007 8:50 pm
Location: Providence, RI

Re: army and territory count bookmarklet

Postby t-o-m on Sat Jun 14, 2008 4:54 pm

i dont get this?
User avatar
Major t-o-m
 
Posts: 2918
Joined: Sat Mar 22, 2008 2:22 pm

Re: army and territory count bookmarklet

Postby gdeangel on Sat Jun 14, 2008 4:55 pm

t-o-m wrote:i dont get this?

It seems to be a poor mans version of BoB... probably for people who don't have firefox / grease monkey.

I haven't tried it...
My ever constant two last games seem to have no end in sight!
User avatar
Sergeant gdeangel
 
Posts: 779
Joined: Mon Jan 14, 2008 11:48 pm
Location: In the Basement

Re: army and territory count bookmarklet

Postby psaxnoulis on Sat Oct 10, 2009 5:25 am

just installed on firefox 3.5.3 - works ok
User avatar
Major psaxnoulis
 
Posts: 14
Joined: Wed Mar 19, 2008 5:27 am
Location: Athens, Greece

Re: army and territory count bookmarklet

Postby Calidrmr on Tue Aug 16, 2011 11:47 am

moved to archives by Calidrmr
reason: over 1 year since last post, appears obsolete
shadow topic left for 72 hours
Image
<Juan_Bottom>You're like the Barry Bonds of drinking. You don't need the practice you just do it because you like it.
User avatar
Corporal Calidrmr
 
Posts: 641
Joined: Wed Sep 12, 2007 5:00 pm
Location: the corner bar...


Return to Tool Archives

Who is online

Users browsing this forum: No registered users