Conquer Club

Coding AJAX-compatible GM scripts

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.

Postby yeti_c on Thu Nov 08, 2007 3:59 am

OK - I've just uploaded the latest version...

VERSION : 2.13
(2.12 was crap)

FIXED :
Fixed Coloured Drop downs for Doodle earth (and other maps with brackets in)
Fixed Link labels to point to this thread...

TODO :

Clock Format doesn't work <- does anyone care about this one?
Clock Parsing not always correct (Noticed with 08 and 09 times - anymore?)

WISHLIST :

Objectives <- Added once first map with this in Quenched (AoR?)
Territory counter for FOW games.
Anything else that needs to be added?

C.
Image
Highest score : 2297
User avatar
Lieutenant yeti_c
 
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am

Postby Aerial Attack on Thu Nov 08, 2007 10:03 am

yeti,

You are one responsive dude when it comes to AJAX BOB updates !!!

PS. I didn't mean to incorporate the Search Functionality into AJAX BOB - I meant add it as a second file on userscripts.org
Image
My Conquer Club Scripts | Bests: 2133, #205
User avatar
Sergeant Aerial Attack
 
Posts: 1132
Joined: Mon Jun 04, 2007 7:59 pm
Location: Generation One: The Clan

Postby xmaveric on Thu Nov 08, 2007 10:40 am

Could you please disable clock processing until the 08 & 09 times are fixed? Or add that as an option to the menu?
User avatar
Corporal xmaveric
 
Posts: 43
Joined: Wed Jun 20, 2007 6:46 am

Postby yeti_c on Thu Nov 08, 2007 11:05 am

xmaveric wrote:Could you please disable clock processing until the 08 & 09 times are fixed? Or add that as an option to the menu?


Due to the fact that 08 -> 09 are less than the majority of the time - this is fairly minor - so for that very reason I won't for the majority script...

Adding an option that is superfluous for the future is to much work...

However you could do this...

Right click on Monkey...

Select "Conquer Club - BOB"

Click Edit

Search on clock.innerHTML

Then put two forward slashes at the beginning of the line...

i.e.
Code: Select all
//   clock.innerHTML = hours1+'hrs '+minutes1+'min '+seconds1+'sec';

instead of...
Code: Select all
   clock.innerHTML = hours1+'hrs '+minutes1+'min '+seconds1+'sec';


This will disable the updates to the clock...

C.
Image
Highest score : 2297
User avatar
Lieutenant yeti_c
 
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am

Postby Optimus Prime on Thu Nov 08, 2007 3:51 pm

To be completely honest I wouldn't mind it if we got back the feature with the clock that said:

12 hrs 22 mins left .... @ 10:02am tomorrow

However, just having the clock that counts down would work for me. That's about it though. Is it really something that can't be done?
User avatar
Cadet Optimus Prime
 
Posts: 9665
Joined: Mon Mar 12, 2007 9:33 pm

Postby Ishiro on Thu Nov 08, 2007 6:08 pm

The problem with the clock counting down is that lack already makes updates to the clock section. Any changes made to it are overwritten by lack. You end up with two processes battling for control, and depending on how they are written will determine which, if either, wins.

I never tested to make sure this worked, but...

The first section is the functions needed to advance the clock.
Code: Select all
function ClockTimer()
{
   var TimeStr = unsafeWindow.gameClock.innerHTML;
   var stepClock = document.getElementById("newclock").innerHTML;
   var TargetTime = TimeStr.split(/hrs\n|min\n|sec/);
   var TargetTime2 = stepClock.split(/hrs\n|min\n|sec/);
   var CurrHour = parseInt(TargetTime[0]);
   var CurrMinute = parseInt(TargetTime[1]);
   var CurrSecond = parseInt(TargetTime[2]);
   var stepCurrHour = parseInt(TargetTime2[0]);
   var stepCurrMinute = parseInt(TargetTime2[1]);
   var stepCurrSecond = parseInt(TargetTime2[2]);

   if (!(CurrHour < stepCurrHour) && !(CurrMinute < stepCurrMinute))
   {
      CurrHour = stepCurrHour;
      CurrMinute = stepCurrMinute;
      CurrSecond = stepCurrSecond;
   }

   --CurrSecond;
   if(CurrSecond < 0 ){
    --CurrMinute;
    if( CurrMinute < 0 ){
      --CurrHour;
      if( CurrHour < 0 ){
       CurrHour = 0;
      }
      CurrMinute = 59;
    }
    CurrSecond = 59;
   }
   document.getElementById("newclock").innerHTML = zslash(CurrHour, 2) + 'hrs\n' + zslash(String(CurrMinute), 2) + 'min\n' + zslash(CurrSecond, 2) + 'sec ';
   var currentTime = new Date();
   var hours = currentTime.getHours();
   var minutes = currentTime.getMinutes();
   var day = ' @ ';
   var ampm = ' ';
   
   minutes = (minutes + CurrMinute);
   if (minutes >= 60) {
         hours = hours + 1;
         minutes = minutes - 60;
      }

   hours = (hours + CurrHour);
   //alert ('h:' + hours);
   if (hours >= 24)
      {
         day = " tomorrow @ ";
         hours = hours - 24
      }
      if (myOptions['24hourClockFormat']=="am/pm") {
         ampm = " am";
         if (hours >= 12)
         {
            ampm = " pm";
            hours = hours - 12;
         }
         if (hours == 0) hours = 12;
      }
   else
   {
      if (hours < 10)
      {
         hours = "0" + hours;
      }
   }

   if (minutes < 10)
      minutes = "0" + minutes;

   var clock
   if (myOptions['24hourClockFormat']!="Off") {
      clock =  "<br />" + day + "<b>" + hours + ":" + minutes + ampm + " " + "</b>"
   }
   else
   {
      clock = ""
   }
   document.getElementById("newclock").innerHTML += ' ' + clock;
}

function zslash(svalue, iwidth)
{
   var szero = String(svalue);
   var ch = szero.substr(0,1);
   while (ch == ' ')
   {
     szero = szero.substr(1, szero.length);
     ch = szero.substr(0,1);
   }
   ch = szero.substr(szero.length - 1, szero.length);
   while (ch == ' ')
   {
     szero = szero.substr(0, szero.length - 1);
   ch = szero.substr(szero.length - 1, szero.length);
   }
   
   var i=0;
   for (i=0; i < (iwidth - szero.length); i++)
   {
     szero = '0' + szero;
   }   

   return szero;
}


The second section is to initialize the clock.
Code: Select all
var clockInterval;
/*---- Start Clock ----*/
var TimeStr = unsafeWindow.gameClock.innerHTML;
unsafeWindow.gameClock.style.display = "none !important";
var newClock = document.createElement('span');
   newClock.id="newclock";
   unsafeWindow.gameClock.parentNode.insertBefore(newClock, unsafeWindow.gameClock);
newClock.innerHTML = TimeStr;

if (clockInterval != "")
{
   window.clearInterval(clockInterval);
   clockInterval = "";
}
clockInterval = window.setInterval(ClockTimer, 1000);


What this does is hide lack's clock and insert a new one. The new one is updated from lack's and then the countdown is started. Its supposed to check its own count against lack's count every cycle, and if lack's count is different, update to use his count.

As I said, not sure if this works, but its worth a shot yeti_c. If not, perhaps you can fix whatever is broken.
Image
User avatar
Corporal 1st Class Ishiro
 
Posts: 324
Joined: Mon Jul 17, 2006 5:53 pm
Location: Under the Rainbow

Postby yeti_c on Fri Nov 09, 2007 4:16 am

I'll take a look at slipping that stuff in...

I stripped the original back down to simpler stuff to make it just update the countdown... and then when AJAX updates it get the new starting numbers and start counting down again...

Like Ishiro says - it's all a matter of getting the timing right without breaking each others code...

C.

PS no more updates this week - will have another look next week.
Image
Highest score : 2297
User avatar
Lieutenant yeti_c
 
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am

Postby Frop on Fri Nov 09, 2007 10:47 am

yeti_c wrote:
Frop wrote:I like how the Map Inspect option was modified, but you're still stuck to manually refreshing the page if you want the 'Map Inspect' text map to (dis)appear.

Apart from that, keep up the great work! :)


Actually - the latest version does the on off for map inspect on the fly - check the correct topic for better updates...

C.


Yeah, with 'modified' I was talking about the on-the-fly stuff. What I meant was that you still have to manually refresh the page if you want the 'Map Inspect' text map to (dis)appear. :)

Image
User avatar
Captain Frop
 
Posts: 1201
Joined: Thu May 10, 2007 3:02 pm

Postby Aerial Attack on Fri Nov 09, 2007 11:01 am

Frop wrote:
yeti_c wrote:
Frop wrote:I like how the Map Inspect option was modified, but you're still stuck to manually refreshing the page if you want the 'Map Inspect' text map to (dis)appear.

Apart from that, keep up the great work! :)


Actually - the latest version does the on off for map inspect on the fly - check the correct topic for better updates...

C.


Yeah, with 'modified' I was talking about the on-the-fly stuff. What I meant was that you still have to manually refresh the page if you want the 'Map Inspect' text map to (dis)appear. :)

Image


Frop,

Please post the Game #, so we (members of the forum and yeti_c) can see the map and situation. In all of my games, the map inspect refreshes appropriately when I stop HOVERING over a territory - now, I haven't actually CLICKED on a territory.
Image
My Conquer Club Scripts | Bests: 2133, #205
User avatar
Sergeant Aerial Attack
 
Posts: 1132
Joined: Mon Jun 04, 2007 7:59 pm
Location: Generation One: The Clan

Postby yeti_c on Fri Nov 09, 2007 11:12 am

Frop wrote:
yeti_c wrote:
Frop wrote:I like how the Map Inspect option was modified, but you're still stuck to manually refreshing the page if you want the 'Map Inspect' text map to (dis)appear.

Apart from that, keep up the great work! :)


Actually - the latest version does the on off for map inspect on the fly - check the correct topic for better updates...

C.


Yeah, with 'modified' I was talking about the on-the-fly stuff. What I meant was that you still have to manually refresh the page if you want the 'Map Inspect' text map to (dis)appear. :)

Image


What version of the code are you running?

C.
Image
Highest score : 2297
User avatar
Lieutenant yeti_c
 
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am

Postby casper on Fri Nov 09, 2007 1:27 pm

Thanks for the update.

But what are these Map Centering pixel settings for?

I have to set it to -1 left for the armies to line up correctly on all my maps. Kind of annoying.
User avatar
Major casper
 
Posts: 416
Joined: Wed Feb 01, 2006 6:36 pm
Location: Chicago

Postby Frop on Fri Nov 09, 2007 3:15 pm

casper wrote:Thanks for the update.

But what are these Map Centering pixel settings for?

I have to set it to -1 left for the armies to line up correctly on all my maps. Kind of annoying.


Yeah, same here. Not sure either what it's for, since there's still another army overlay 'beneath' it.
User avatar
Captain Frop
 
Posts: 1201
Joined: Thu May 10, 2007 3:02 pm

Postby Frop on Fri Nov 09, 2007 3:26 pm

yeti_c wrote:
Frop wrote:
yeti_c wrote:
Frop wrote:I like how the Map Inspect option was modified, but you're still stuck to manually refreshing the page if you want the 'Map Inspect' text map to (dis)appear.

Apart from that, keep up the great work! :)


Actually - the latest version does the on off for map inspect on the fly - check the correct topic for better updates...

C.


Yeah, with 'modified' I was talking about the on-the-fly stuff. What I meant was that you still have to manually refresh the page if you want the 'Map Inspect' text map to (dis)appear. :)

Image


What version of the code are you running?

C.


Firefox 2.0.0.9, Greasemonkey 0.7.20070607.0, script version 2.13. To avoid issues I always uninstall the previous version of the script including all associated preferences.

I took a number of screenshots, hopefully I can illustrate the situation. Prerequisite is to browse a game with Map Inspect turned off.

Image
1) Off

Now when I turn Map Inspect on, you can see that it works when I hover over a country - yet there is no text map.

Image
2) On, no refresh

However, when I manually refresh the page the text map shows up (site option 'refresh map' does not have the same effect).

Image
3) On, refreshed

When I turn Map Inspect off again the text map remains on the screen and doesn't disappear until I manually refresh the page.

Image
4) Off, no refresh

:)
User avatar
Captain Frop
 
Posts: 1201
Joined: Thu May 10, 2007 3:02 pm

Postby Aerial Attack on Fri Nov 09, 2007 3:27 pm

My armies all seem to line up perfectly. I am using the Large Maps setting (in CC's My Settings).

I am using the latest version of BOB (released Thurs Nov 8).

My guess is that you are either using an older version - possible

OR

You have Small Maps in your My Settings (under Personal Menu in the left navigation area) - more likely.

I guess yeti will have to do an update that checks for map size setting.
Image
My Conquer Club Scripts | Bests: 2133, #205
User avatar
Sergeant Aerial Attack
 
Posts: 1132
Joined: Mon Jun 04, 2007 7:59 pm
Location: Generation One: The Clan

Postby Frop on Fri Nov 09, 2007 5:32 pm

Aerial Attack wrote:My armies all seem to line up perfectly. I am using the Large Maps setting (in CC's My Settings).

I am using the latest version of BOB (released Thurs Nov 8).

My guess is that you are either using an older version - possible

OR

You have Small Maps in your My Settings (under Personal Menu in the left navigation area) - more likely.

I guess yeti will have to do an update that checks for map size setting.


Don't know about casper, but I have the same problem with map size set to Large.
User avatar
Captain Frop
 
Posts: 1201
Joined: Thu May 10, 2007 3:02 pm

Postby casper on Fri Nov 09, 2007 8:22 pm

yep i use large maps. any idea yeti? what is that feature for in the first place?
User avatar
Major casper
 
Posts: 416
Joined: Wed Feb 01, 2006 6:36 pm
Location: Chicago

Postby yeti_c on Sat Nov 10, 2007 2:09 am

casper wrote:yep i use large maps. any idea yeti? what is that feature for in the first place?


Widowmakers pointed out the pixels were off by one... but they weren't for me... and no-one else had complained... so my assumption - and I believe it's still true is that "most" people it works with the offsets at 0...

However there are a few with this problem - thus I intorduced the ability to move the numbers around a bit to line them up... the overlaid numbers are there to replace the existing numbers that get faded out when you change the map fade options...

C.
Image
Highest score : 2297
User avatar
Lieutenant yeti_c
 
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am

Postby yeti_c on Sat Nov 10, 2007 2:09 am

Frop wrote:
yeti_c wrote:
Frop wrote:
yeti_c wrote:
Frop wrote:I like how the Map Inspect option was modified, but you're still stuck to manually refreshing the page if you want the 'Map Inspect' text map to (dis)appear.

Apart from that, keep up the great work! :)


Actually - the latest version does the on off for map inspect on the fly - check the correct topic for better updates...

C.


Yeah, with 'modified' I was talking about the on-the-fly stuff. What I meant was that you still have to manually refresh the page if you want the 'Map Inspect' text map to (dis)appear. :)

Image


What version of the code are you running?

C.


Firefox 2.0.0.9, Greasemonkey 0.7.20070607.0, script version 2.13. To avoid issues I always uninstall the previous version of the script including all associated preferences.

I took a number of screenshots, hopefully I can illustrate the situation. Prerequisite is to browse a game with Map Inspect turned off.

Image
1) Off

Now when I turn Map Inspect on, you can see that it works when I hover over a country - yet there is no text map.

Image
2) On, no refresh

However, when I manually refresh the page the text map shows up (site option 'refresh map' does not have the same effect).

Image
3) On, refreshed

When I turn Map Inspect off again the text map remains on the screen and doesn't disappear until I manually refresh the page.

Image
4) Off, no refresh

:)


Great bug report - I'm pretty sure I know what's going on - I'll fix it on Monday...

C.
Image
Highest score : 2297
User avatar
Lieutenant yeti_c
 
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am

Postby Marshall Law on Sat Nov 10, 2007 2:13 am

yeti_c wrote:
casper wrote:the overlaid numbers are there to replace the existing numbers that get faded out when you change the map fade options...
C.


It seems to go back and forth for me. Sometimes it's right on and other times it's not. I haven't looked into the code (I am a bit rusty) but i dont understand why it has to be this way. In the older versions of BOB was there an double overlay approach like this one? Are the original numbers locked into the map image? Thanks, yeti.
User avatar
Private 1st Class Marshall Law
 
Posts: 50
Joined: Mon Aug 13, 2007 9:45 am

Postby yeti_c on Sat Nov 10, 2007 2:17 am

Marshall Law wrote:
yeti_c wrote:the overlaid numbers are there to replace the existing numbers that get faded out when you change the map fade options...
C.


It seems to go back and forth for me. Sometimes it's right on and other times it's not. I haven't looked into the code (I am a bit rusty) but i dont understand why it has to be this way. In the older versions of BOB was there an double overlay approach like this one? Are the original numbers locked into the map image? Thanks, yeti.


The old non ajax way of coding the site was completely changed for the AJAX way... and the only way for me to be able to fade the map - fades the numbers... and then the only way to get non faded numbers is to overlay another map that's not inside the div that's faded...

It's interesting that it changes for you... I assumed it would either be correct or out!!

I've not found any rhyme or reason as to why it's out - except that Widowmakers reported it - and he's got a long user name - and that might knock out some layout!!

C.
Last edited by yeti_c on Sat Nov 10, 2007 6:31 am, edited 1 time in total.
Image
Highest score : 2297
User avatar
Lieutenant yeti_c
 
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am

Postby yeti_c on Sat Nov 10, 2007 6:30 am

OK - I've just uploaded the latest version...

VERSION : 2.14

FIXED :
Map Inspect Div now dynamic when turning it on and off.

TODO :

Clock Format doesn't work <- does anyone care about this one?
Clock Parsing not always correct (Noticed with 08 and 09 times - anymore?)

WISHLIST :

Objectives <- Added once first map with this in Quenched (AoR?)
Territory counter for FOW games.
Anything else that needs to be added?

C.
Image
Highest score : 2297
User avatar
Lieutenant yeti_c
 
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am

Postby casper on Sat Nov 10, 2007 4:16 pm

i updated to 2.14 and the pixel problem is gone. thanks yeti!!
User avatar
Major casper
 
Posts: 416
Joined: Wed Feb 01, 2006 6:36 pm
Location: Chicago

Postby Lobster Crush on Sat Nov 10, 2007 9:21 pm

good job on this yeti...but bob's been wacky for me since about version 2.09 or so.
see image below...the army counts are duplicated again below the map, and map inspect doesn't work at all.
also, there's no menu for bob on the left.

Image

i've tried clearing my cache, etc., but with no luck so far.
the only thing i haven't done is opened up the script to manually tweak the settings, to see if it's one setting in particular that's causing the bug.
if i discover something, i'll post it here.
User avatar
Sergeant 1st Class Lobster Crush
 
Posts: 93
Joined: Sun Mar 18, 2007 12:18 am
Location: Winneapolis, Minnetoba

Postby Frop on Sat Nov 10, 2007 10:13 pm

casper wrote:i updated to 2.14 and the pixel problem is gone. thanks yeti!!


That's funny, I updated as well and still have the same problem. :p
User avatar
Captain Frop
 
Posts: 1201
Joined: Thu May 10, 2007 3:02 pm

Postby yeti_c on Mon Nov 12, 2007 3:48 am

Lobster Crush wrote:good job on this yeti...but bob's been wacky for me since about version 2.09 or so.
see image below...the army counts are duplicated again below the map, and map inspect doesn't work at all.
also, there's no menu for bob on the left.

Image

i've tried clearing my cache, etc., but with no luck so far.
the only thing i haven't done is opened up the script to manually tweak the settings, to see if it's one setting in particular that's causing the bug.
if i discover something, i'll post it here.


Hi Lobster,

Can you do the following...

a) Install latest.
b) goto "Tools" -> "Error Console"
c) Press the "Clear" button.
d) Press the "Errors" tab
e) Load a game that this occurs in
f) Copy what appears in the Error Console screen and post it in here.

Cheers,

C.
Image
Highest score : 2297
User avatar
Lieutenant yeti_c
 
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am

PreviousNext

Return to Tool Archives

Who is online

Users browsing this forum: No registered users