Page 1 of 1

Point Winnings Figure-Outer?

PostPosted: Mon Dec 17, 2007 6:12 pm
by wrightfan123
I haven't looked in depth, but is there a Grease Monkey script that will tell you the amount of points each person would win if the someone won the game right at that moment? And if there isn't, could someone please make it?

-W123

PostPosted: Mon Dec 17, 2007 6:14 pm
by Risktaker17
I think there is, but I don't have any add-ons. So I dunno anything.

PostPosted: Mon Dec 17, 2007 9:36 pm
by Ishiro
A Greasemonkey script would never be completely correct. There is a math formula for the points, but it is based on the current scores of the players, player current scores are not listed on the game screen, since Greasemonkey is just javascript that runs on the displayed page, it would not have the current scores to calculate from.

It could estimate based on rank though...

PostPosted: Mon Dec 17, 2007 9:56 pm
by hecter
Ishiro wrote:A Greasemonkey script would never be completely correct. There is a math formula for the points, but it is based on the current scores of the players, player current scores are not listed on the game screen, since Greasemonkey is just javascript that runs on the displayed page, it would not have the current scores to calculate from.

It could estimate based on rank though...

But greasemonkey can pull information from other pages, can it not?

PostPosted: Mon Dec 17, 2007 11:11 pm
by Aerial Attack
hecter wrote:But greasemonkey can pull information from other pages, can it not?


The short answer is NO.

The long answer is, yes it's possible but it would be severely convoluted.

Here is how you would have to do it for the long answer:

1) loop through all the players in the game
2) while looping through
a. check against your name so you know the score you want to calculate against
b. copy the target link to the profile page for that player.
c. open a new browser window to the profile page for that player.
d1.) Either write the player's score to a cookie saved on conquer club that the games pages and the profile pages both have access to [I believe you could use the same cookie that is used for Saved Searches and Map Opacity]
d2.) OR you send the player's score back as the result of the function that opened the new browser window [player profile browser window].
e. close the player profile browser window.
f. save this value to an array - making sure to note which one was YOURS
3) compare the values in the array against your score [from the array]
4) display a message box with how many points you would lose against each of the other players and how many you would win total

That's a lot of processing and code to handle basically 6 clicks and a calculator.

* - if this is a teams game - the loop in step 2 would have also needed to identify your teammates so as to average your team score and your opps team score.

* - Step 2d requires that the player's score always be in the same place on the page relative to other easily distinguished markers/identifiers. I'm not 100% sure that method d2 would even work.

PostPosted: Tue Dec 18, 2007 8:30 am
by Ishiro
You could also handle it by writing essentially two scripts... the first would be for the Scoreboard, as you page through it, it will store all the scores to a file. The second would be the game script that would use the stored values in the file to do calculations. Your calculations would then be correct only immediately after a scoreboard refresh, and would become approximations after that.

The problem is that a script that pulled from other pages would be horrendously slow.

Now, if Lack were to modify the site to put the user's current score in the Hover text on the user's name or rank, then we could do something with it.

PostPosted: Tue Dec 18, 2007 5:40 pm
by Night Strike
Couldn't you just check the score from the person's profile page since it's included there?? (By the way, I know nothing about scripts, but that's a different page than the scoreboard.)

PostPosted: Tue Dec 18, 2007 10:45 pm
by Herakilla
what if you made a script that went off people's ranks, it would just be an estimate but gives you an idea

PostPosted: Tue Dec 18, 2007 10:47 pm
by Ishiro
Yes.. but checking the score in a 6 person game means the script has to open 6 pages to get the info it needs.

Seriously, getting info from another page is a pain in the ass. The best bet is to first try to get Lack to include the player's current score in the tool tip hover text of either their name or their rank icon. Once the info is on the game page somewhere, it will be easy to script the calculations.

PostPosted: Sat Dec 22, 2007 10:55 am
by philh
It's not quite that bad - you can download other pages using XMLHttpRequest, so no need to open a new browser window and no need to download images at the same time. The score would be easy to extract as long as the profile page doesn't change significantly.

Lack may not appreciate the server hit if a lot of people start using it, but it wouldn't be too hard to do.