Coding AJAX-compatible GM scripts

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

Moderators: Tech Team, Global Moderators

Forum rules
Please read the Community Guidelines before posting.

Postby Optimus Prime on Wed Sep 12, 2007 3:55 pm

I just want to say thanks to you guys who are working on getting it refurbished for all of us. That's a lot of extra work you don't have to do.

Thanks again.
User avatar
Cadet Optimus Prime
Retired Administrator
 
Posts: 9751
Joined: Mon Mar 12, 2007 9:33 pm
Medals: 51
Standard Achievement (3) Doubles Achievement (2) Triples Achievement (1) Terminator Achievement (1) Speed Achievement (1)
Teammate Achievement (1) Cross-Map Achievement (3) Ratings Achievement (3) Tournament Achievement (1) General Achievement (2)
Tournament Contribution (30) General Contribution (3)

Postby Ishiro on Wed Sep 12, 2007 4:06 pm

Yeah, well, finally an excuse to learn AJAX. :)
Image
User avatar
Corporal 1st Class Ishiro
 
Posts: 324
Joined: Mon Jul 17, 2006 5:53 pm
Location: Under the Rainbow
Medals: 10
Standard Achievement (2) Doubles Achievement (1) Triples Achievement (1) Terminator Achievement (1) Assassin Achievement (1)
Cross-Map Achievement (1) Ratings Achievement (1) General Contribution (2)

Postby stringybeany on Wed Sep 12, 2007 4:12 pm

Add my thanks. What you are doing is work and has real value. Thanks.
Image
Weak kill shots in esc = Loser
Mind your troop count and look ahead!
User avatar
Major stringybeany
 
Posts: 506
Joined: Mon May 28, 2007 10:28 am
Medals: 43
Standard Achievement (3) Doubles Achievement (2) Triples Achievement (2) Quadruples Achievement (2) Terminator Achievement (1)
Manual Troops Achievement (2) Freestyle Achievement (1) Polymorphic Achievement (2) Nuclear Spoils Achievement (1) Fog of War Achievement (3)
Trench Warfare Achievement (1) Speed Achievement (2) Teammate Achievement (2) Random Map Achievement (1) Cross-Map Achievement (3)
Ratings Achievement (4) Tournament Achievement (2) Clan Achievement (8) Tournament Contribution (1)

Postby cricket on Wed Sep 12, 2007 8:06 pm

so u guys have a link to this new script?
I am cricket, the cricket playing cricketer. The Master Blaster is the best in the world.

Highest Score - 1888
Highest Place - 292
Rank - Sergeant 1st Class
Score - 1493
User avatar
Cadet cricket
 
Posts: 233
Joined: Tue Oct 10, 2006 5:31 pm
Medals: 16
Standard Achievement (3) Doubles Achievement (2) Triples Achievement (2) Terminator Achievement (1) Manual Troops Achievement (1)
Freestyle Achievement (1) Nuclear Spoils Achievement (1) Cross-Map Achievement (1) Ratings Achievement (3) Tournament Contribution (1)

Postby Ishiro on Wed Sep 12, 2007 8:26 pm

Not yet, because parts of it don't work well at all. The map doesn't update when you do things... have to fix that first.
Image
User avatar
Corporal 1st Class Ishiro
 
Posts: 324
Joined: Mon Jul 17, 2006 5:53 pm
Location: Under the Rainbow
Medals: 10
Standard Achievement (2) Doubles Achievement (1) Triples Achievement (1) Terminator Achievement (1) Assassin Achievement (1)
Cross-Map Achievement (1) Ratings Achievement (1) General Contribution (2)

Postby sully800 on Wed Sep 12, 2007 8:48 pm

AAFitz wrote:
lackattack wrote:Here's a tip for anyone trying to fix BOB. There is an function I put in called handleResponse() that runs each time an AJAX response comes in. Perhaps the GM script could re-define that function to call gm_ConquerClubGame() at the end?


tell you what.......you install this crap for me on my computer, and ill make your moves in your game so you can win one

this would have been so much funnier if it wasnt for that "neverland game we played"


lack just beat me in a game :?

He gained 146 points total
User avatar
Major sully800
 
Posts: 4999
Joined: Wed Jun 14, 2006 5:45 pm
Location: Bethlehem, Pennsylvania
Medals: 27
Standard Achievement (3) Doubles Achievement (1) Terminator Achievement (2) Assassin Achievement (1) Freestyle Achievement (2)
Fog of War Achievement (2) Speed Achievement (1) Cross-Map Achievement (2) Ratings Achievement (2) Tournament Achievement (1)
General Achievement (3) Map Contribution (1) Tournament Contribution (1) General Contribution (5)

Postby mfontolan on Wed Sep 12, 2007 9:27 pm

Ishiro wrote:Not yet, because parts of it don't work well at all. The map doesn't update when you do things... have to fix that first.

The original BOB was write when pages are totally reloaded and now, only a few part of the page are reloaded.
I do not thing that we can make original BOB work and is not a easy think fix/maintain/upgrade someone code.
Above is what I think that is more important on the new code, that is a prototype model of clock fully working in Ajax way.
The 2 seconds difference (in the setInterval) is intentional to show that after refresh (use page link (Ajax) and not navigator button) the clock became correctly.

Code: Select all
// ==UserScript==
// @name          Conquer Club - Ajax BOB
// @namespace     http://www.itj.com.br/
// @description   Ajax BOB
// @include       http://*conquerclub.com*
// ==/UserScript==


// Starting
var TimeStr = document.getElementById('clock').innerHTML;
var TargetTime = TimeStr.split(/hrs\n|min\n|sec/);
var CurrHour = parseInt(TargetTime[0]);
var CurrMinute = parseInt(TargetTime[1]);
var CurrSecond = parseInt(TargetTime[2]);
ClockInterval = window.setInterval(ClockTimer, 2000);


// Running clock
function ClockTimer()
{
   --CurrSecond;
   if (CurrSecond < 0)
   {
     --CurrMinute;
     if (CurrMinute < 0)
     {
       --CurrHour;
       if (CurrHour < 0)
       {
         CurrHour = 0;
       }
       CurrMinute = 59;
     }
     CurrSecond = 59;
   }
   snextTurn = ' @ ';
   CurrDate = new Date();
   nextTurn = (CurrHour * 60) + CurrMinute + (CurrDate.getHours() * 60) + CurrDate.getMinutes();
   if (nextTurn > 1440)
   {
      nextTurn -= 1440;
      snextTurn = ' tomorrow @ ';
   }
   StrClock = document.getElementById('clock');
   StrClock.innerHTML = zslash(CurrHour, 2) + 'hrs ' + zslash(CurrMinute, 2) + 'min ' + zslash(CurrSecond, 2) + 'sec' + snextTurn + '<b>' + zslash(parseInt(nextTurn / 60), 2) + ':' + zslash(nextTurn - parseInt(parseInt(nextTurn / 60) * 60), 2) + '</b />';
}


// Ajax Code
var bob_gameLog = unsafeWindow.gameLog;
var bob_gameChat = unsafeWindow.gameChat;
var bob_handleResponse = unsafeWindow.handleResponse;
unsafeWindow.handleResponse = function() {
   if (typeof(unsafeWindow.request.responseText) != "undefined")
   {
      var bob_response = unsafeWindow.request.responseText.split("&"); 
      if (bob_response.length > 2)
      {
         if (bob_response[2] != "")
         {
            TargetTime = bob_response[2].split(/hrs|min|sec/);
            CurrHour = parseInt(TargetTime[0]);
            CurrMinute = parseInt(TargetTime[1]);
            CurrSecond = parseInt(TargetTime[2]);
         }
         var CurrDate = new Date();
         bob_gameChat.innerHTML += '<b>' + zslash(CurrDate.getHours(), 2) + ':' + zslash(CurrDate.getMinutes(), 2) + ':' + zslash(CurrDate.getSeconds(), 2) + '</b /> Ajax Test - I am a response!<br />';
         }
   } else {
      var CurrDate = new Date();
      bob_gameChat.innerHTML += '<b>' + zslash(CurrDate.getHours(), 2) + ':' + zslash(CurrDate.getMinutes(), 2) + ':' + zslash(CurrDate.getSeconds(), 2) + '</b /> Ajax Test - I am not!<br />';
   }
   return bob_handleResponse();
}


// Counters, Map inspect...


// Common Functions
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);
   }
   for (var i=0; i < (iwidth - szero.length); i++)
   {
      szero = '0' + szero;
   }   
   return szero;
}
Brazil #3 @ Agu, 2007.
User avatar
Private 1st Class mfontolan
 
Posts: 23
Joined: Wed Feb 21, 2007 5:48 pm
Location: South
Medals: 7
Standard Achievement (3) Terminator Achievement (2) Ratings Achievement (2)

Postby Incandenza on Wed Sep 12, 2007 9:32 pm

I too would like to extend my thanks to the brave souls on the front line in the battle against ajax. :D
THOTA: dingdingdingdingdingdingBOOM

Te Occidere Possunt Sed Te Edere Non Possunt Nefas Est
User avatar
Colonel Incandenza
 
Posts: 4961
Joined: Thu Oct 19, 2006 5:34 pm
Location: Playing Eschaton with a bucket of old tennis balls
Medals: 44
Standard Achievement (2) Doubles Achievement (3) Triples Achievement (2) Quadruples Achievement (2) Terminator Achievement (1)
Manual Troops Achievement (1) Nuclear Spoils Achievement (1) Fog of War Achievement (3) Speed Achievement (1) Random Map Achievement (1)
Cross-Map Achievement (3) Ratings Achievement (3) Tournament Achievement (6) General Achievement (3) Clan Achievement (8)
General Contribution (4)

Postby Ishiro on Thu Sep 13, 2007 6:48 am

I'm pretty sure I can get the map inspect working properly, however, it may have to lose the color coding and just show attack/defend paths. Working on that today.
Image
User avatar
Corporal 1st Class Ishiro
 
Posts: 324
Joined: Mon Jul 17, 2006 5:53 pm
Location: Under the Rainbow
Medals: 10
Standard Achievement (2) Doubles Achievement (1) Triples Achievement (1) Terminator Achievement (1) Assassin Achievement (1)
Cross-Map Achievement (1) Ratings Achievement (1) General Contribution (2)

Postby yeti_c on Thu Sep 13, 2007 7:25 am

Most aspects of the map inspect are fairly rigid (i.e. what you can and can't attack)

But obviously the things that change are the colour coding of each territory.

The Table of data code would need to be run on every refresh... of course that's the bit that takes time as it inspects game logs - so may not actually complete in time for a refresh... so could be nasty - unless it's made easier to get this info out of the system now.

C.
Image
Highest score : 2297
User avatar
Lieutenant yeti_c
 
Posts: 9670
Joined: Thu Jan 04, 2007 9:02 am
Medals: 46
Standard Achievement (2) Doubles Achievement (2) Triples Achievement (2) Quadruples Achievement (3) Terminator Achievement (1)
Assassin Achievement (1) Freestyle Achievement (1) Fog of War Achievement (3) Cross-Map Achievement (3) Ratings Achievement (3)
General Achievement (1) Map Contribution (13) Tournament Contribution (1) General Contribution (10)

Postby lackattack on Thu Sep 13, 2007 8:56 am

Let me throw in some incentive - free premium membership* to the contributors of an AJAX-compatible GM script that can replace Tr0y's & BOB**, so I can move everyone onto AJAX :mrgreen:


* Main contributor(s) will get 12 months, secondary contributors according to their contribution :)

** Colourblind feature is now core, no need to replace that
User avatar
Private 1st Class lackattack
Retired Administrator
 
Posts: 6112
Joined: Sun Jan 01, 2006 10:34 pm
Location: Montreal, QC
Medals: 9
Standard Achievement (1) Doubles Achievement (1) Triples Achievement (1) Freestyle Achievement (1) Speed Achievement (1)
Teammate Achievement (1) Cross-Map Achievement (1) General Achievement (2)

Postby Wild_Tiger on Thu Sep 13, 2007 8:59 am

if I cheer for the programmers, will that get me a couple days, lack?
Image
I got beaten by 2 privates and all I got was this lousy feedback!
User avatar
General Wild_Tiger
 
Posts: 808
Joined: Sat Feb 03, 2007 3:39 pm
Location: Netherlands
Medals: 37
Standard Achievement (2) Doubles Achievement (3) Triples Achievement (3) Quadruples Achievement (1) Terminator Achievement (2)
Assassin Achievement (1) Manual Troops Achievement (1) Freestyle Achievement (3) Fog of War Achievement (3) Speed Achievement (2)
Teammate Achievement (2) Random Map Achievement (1) Cross-Map Achievement (3) Tournament Achievement (4) Clan Achievement (5)
Tournament Contribution (1)

Postby yeti_c on Thu Sep 13, 2007 9:00 am

lackattack wrote:Let me throw in some incentive - free premium membership* to the contributors of an AJAX-compatible GM script that can replace Tr0y's & BOB**, so I can move everyone onto AJAX :mrgreen:


* Main contributor(s) will get 12 months, secondary contributors according to their contribution :)

** Colourblind feature is now core, no need to replace that


Interesting...

C.
Image
Highest score : 2297
User avatar
Lieutenant yeti_c
 
Posts: 9670
Joined: Thu Jan 04, 2007 9:02 am
Medals: 46
Standard Achievement (2) Doubles Achievement (2) Triples Achievement (2) Quadruples Achievement (3) Terminator Achievement (1)
Assassin Achievement (1) Freestyle Achievement (1) Fog of War Achievement (3) Cross-Map Achievement (3) Ratings Achievement (3)
General Achievement (1) Map Contribution (13) Tournament Contribution (1) General Contribution (10)

Postby Night Strike on Thu Sep 13, 2007 9:04 am

lackattack wrote:Let me throw in some incentive - free premium membership* to the contributors of an AJAX-compatible GM script that can replace Tr0y's & BOB**, so I can move everyone onto AJAX :mrgreen:


* Main contributor(s) will get 12 months, secondary contributors according to their contribution :)

** Colourblind feature is now core, no need to replace that


I think it's because he doesn't want to do it all and make it part of the actual site. But hey, whatever works.
Image
User avatar
Captain Night Strike
 
Posts: 8646
Joined: Wed Apr 18, 2007 2:52 pm
Medals: 79
Standard Achievement (3) Doubles Achievement (3) Triples Achievement (2) Quadruples Achievement (2) Terminator Achievement (2)
Assassin Achievement (1) Manual Troops Achievement (1) Freestyle Achievement (1) Nuclear Spoils Achievement (1) Fog of War Achievement (3)
Speed Achievement (1) Teammate Achievement (1) Random Map Achievement (2) Cross-Map Achievement (3) Ratings Achievement (3)
Tournament Achievement (2) General Achievement (7) Clan Achievement (11) Tournament Contribution (12) General Contribution (18)

Postby yeti_c on Thu Sep 13, 2007 9:16 am

lackattack wrote:Let me throw in some incentive - free premium membership* to the contributors of an AJAX-compatible GM script that can replace Tr0y's & BOB**, so I can move everyone onto AJAX :mrgreen:


* Main contributor(s) will get 12 months, secondary contributors according to their contribution :)

** Colourblind feature is now core, no need to replace that


Actually - I'll make a deal with you...

If I get it up and running - will you look at creating a test area in the Foundry for new maps?

C.
Image
Highest score : 2297
User avatar
Lieutenant yeti_c
 
Posts: 9670
Joined: Thu Jan 04, 2007 9:02 am
Medals: 46
Standard Achievement (2) Doubles Achievement (2) Triples Achievement (2) Quadruples Achievement (3) Terminator Achievement (1)
Assassin Achievement (1) Freestyle Achievement (1) Fog of War Achievement (3) Cross-Map Achievement (3) Ratings Achievement (3)
General Achievement (1) Map Contribution (13) Tournament Contribution (1) General Contribution (10)

Postby MR. Nate on Thu Sep 13, 2007 10:23 am

Do it! It's totally worth it to all of us who sit here and admire everyone's work!
AAFitz wrote:There will always be cheaters, abusive players, terrible players, and worse. But we have every right to crush them.
MeDeFe wrote:This is a forum on the internet, what do you expect?

End the Flame Wars.
User avatar
Corporal MR. Nate
 
Posts: 951
Joined: Tue Dec 19, 2006 10:59 am
Location: Locked in the warehouse.
Medals: 6
Standard Achievement (2) Doubles Achievement (1) Triples Achievement (1) Cross-Map Achievement (1) Ratings Achievement (1)

Postby Ishiro on Thu Sep 13, 2007 11:26 am

I'm going through the code now making sure it does not over update too much. Colors still may be dropped from map inspect... have to wait and see. Being able to lose color blind options helps a bit.
Image
User avatar
Corporal 1st Class Ishiro
 
Posts: 324
Joined: Mon Jul 17, 2006 5:53 pm
Location: Under the Rainbow
Medals: 10
Standard Achievement (2) Doubles Achievement (1) Triples Achievement (1) Terminator Achievement (1) Assassin Achievement (1)
Cross-Map Achievement (1) Ratings Achievement (1) General Contribution (2)

Postby Ishiro on Thu Sep 13, 2007 1:56 pm

Blah... starting over. Some of the paths I went down were wrong and resulted in a map that never updated during your turn. (Like, you attack 10v1 and win, but the map still shows 10 and 1 even while the action section has moved on to Advancement.)

Its probably going to be next week before I get something that works since I have to return to work tomorrow.
Image
User avatar
Corporal 1st Class Ishiro
 
Posts: 324
Joined: Mon Jul 17, 2006 5:53 pm
Location: Under the Rainbow
Medals: 10
Standard Achievement (2) Doubles Achievement (1) Triples Achievement (1) Terminator Achievement (1) Assassin Achievement (1)
Cross-Map Achievement (1) Ratings Achievement (1) General Contribution (2)

Postby Tyrion81 on Fri Sep 14, 2007 2:16 am

Hmmm this has got me interested now.... I already started modifications to BOB to get things working with AJAX... I found testing a real pain in the ass though... Having to wait every time my turn came around sucks. (especially cuz i'm limited to my 4 games)
Corporal 1st Class Tyrion81
 
Posts: 14
Joined: Thu Mar 22, 2007 8:29 pm
Location: Sydney, Australia
Medals: 1
Standard Achievement (1)

Postby Ishiro on Fri Sep 14, 2007 5:15 am

While some things need to wait for turns to test... here is a hint, posting a chat message to yourself in a non-team game goes through the ajax routines to update the chat log.

Starting over reworking the script from the ground up, I've got the clock and player stats working. Text map and map inspect are halfway there.
Image
User avatar
Corporal 1st Class Ishiro
 
Posts: 324
Joined: Mon Jul 17, 2006 5:53 pm
Location: Under the Rainbow
Medals: 10
Standard Achievement (2) Doubles Achievement (1) Triples Achievement (1) Terminator Achievement (1) Assassin Achievement (1)
Cross-Map Achievement (1) Ratings Achievement (1) General Contribution (2)

Postby yeti_c on Fri Sep 14, 2007 5:36 am

Ishiro wrote:While some things need to wait for turns to test... here is a hint, posting a chat message to yourself in a non-team game goes through the ajax routines to update the chat log.

Starting over reworking the script from the ground up, I've got the clock and player stats working. Text map and map inspect are halfway there.


Nice work buddy - I'll leave it to you then...

C.
Image
Highest score : 2297
User avatar
Lieutenant yeti_c
 
Posts: 9670
Joined: Thu Jan 04, 2007 9:02 am
Medals: 46
Standard Achievement (2) Doubles Achievement (2) Triples Achievement (2) Quadruples Achievement (3) Terminator Achievement (1)
Assassin Achievement (1) Freestyle Achievement (1) Fog of War Achievement (3) Cross-Map Achievement (3) Ratings Achievement (3)
General Achievement (1) Map Contribution (13) Tournament Contribution (1) General Contribution (10)

Postby mfontolan on Fri Sep 14, 2007 6:08 am

Ishiro wrote:While some things need to wait for turns to test... here is a hint, posting a chat message to yourself in a non-team game goes through the ajax routines to update the chat log.
Starting over reworking the script from the ground up, I've got the clock and player stats working. Text map and map inspect are halfway there.

Well, I think you understand what I say before.
Is other way of thinking. You have to put all your necessary stuff at the start and then change using "handleResponse".
Ishiro, we are doing a double job. I will stop my development and help you if you want.
Brazil #3 @ Agu, 2007.
User avatar
Private 1st Class mfontolan
 
Posts: 23
Joined: Wed Feb 21, 2007 5:48 pm
Location: South
Medals: 7
Standard Achievement (3) Terminator Achievement (2) Ratings Achievement (2)

Postby RobinJ on Fri Sep 28, 2007 11:53 am

Just would like to say that even a scaled down version of BOB would be much appreciated if it makes things easier, like TR0Y's first script
nmhunate wrote:Speak English... It is the language that God wrote the bible in.


Highest Score: 2437
Highest Place: 84
User avatar
Sergeant 1st Class RobinJ
 
Posts: 1901
Joined: Mon Aug 21, 2006 1:56 pm
Location: Northern Ireland
Medals: 13
Standard Achievement (3) Doubles Achievement (2) Triples Achievement (2) Quadruples Achievement (1) Terminator Achievement (2)
Cross-Map Achievement (2) Ratings Achievement (1)

Postby PerkinsRooster on Fri Sep 28, 2007 12:15 pm

I concur. The only thing I really miss is the territory counter. And yes, I do know how to count myself.
Official Member of the Comic Misfits

High score: 2232
Major PerkinsRooster
 
Posts: 89
Joined: Wed Feb 21, 2007 11:05 pm
Location: Canada
Medals: 12
Standard Achievement (3) Doubles Achievement (1) Triples Achievement (2) Fog of War Achievement (1) Speed Achievement (1)
Teammate Achievement (1) Ratings Achievement (3)

Postby RobinJ on Fri Sep 28, 2007 4:59 pm

PerkinsRooster wrote:I concur. The only thing I really miss is the territory counter. And yes, I do know how to count myself.


But, like me, you can't be bothered :wink:
nmhunate wrote:Speak English... It is the language that God wrote the bible in.


Highest Score: 2437
Highest Place: 84
User avatar
Sergeant 1st Class RobinJ
 
Posts: 1901
Joined: Mon Aug 21, 2006 1:56 pm
Location: Northern Ireland
Medals: 13
Standard Achievement (3) Doubles Achievement (2) Triples Achievement (2) Quadruples Achievement (1) Terminator Achievement (2)
Cross-Map Achievement (2) Ratings Achievement (1)

Next

Return to Tool Archives

Who is online

Users browsing this forum: No registered users

Login