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 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
Sergeant lackattack
 
Posts: 6096
Joined: Sun Jan 01, 2006 10:34 pm
Location: Montreal, QC

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!
General Wild_Tiger
 
Posts: 809
Joined: Sat Feb 03, 2007 3:39 pm
Location: Netherlands

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: 9624
Joined: Thu Jan 04, 2007 9:02 am

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
Major Night Strike
 
Posts: 8512
Joined: Wed Apr 18, 2007 2:52 pm

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: 9624
Joined: Thu Jan 04, 2007 9:02 am

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.

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

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

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

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

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: 9624
Joined: Thu Jan 04, 2007 9:02 am

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

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

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.
Let's golf.
Major PerkinsRooster
 
Posts: 90
Joined: Wed Feb 21, 2007 11:05 pm
Location: Canada

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

Postby Aerial Attack on Fri Sep 28, 2007 5:35 pm

If there were no BOB, you would count on your own - you would almost be forced to. The biggest problem is on non-standard maps, trying to figure out what bonuses people are actually earning. Sometimes you don't realize they have a 1 defending a 4+ bonus. At that point, it's almost always worth taking out. Of course, there are those of us who can't actually count properly (or try counting on Pearl Harbor or World 2.1).
User avatar
Sergeant Aerial Attack
 
Posts: 1132
Joined: Mon Jun 04, 2007 7:59 pm
Location: Generation One: The Clan

Postby Herakilla on Sat Sep 29, 2007 1:13 pm

i might get chewed out for saying this but the few times i have done some programming or what not and i got stuck i just started all over again, with nothing. starting from scratch
Come join us in Live Chat!
User avatar
Lieutenant Herakilla
 
Posts: 4283
Joined: Fri Jun 09, 2006 8:33 pm
Location: Wandering the world, spreading Conquerism

Postby chewyman on Thu Oct 04, 2007 3:17 am

First of all I just wanted to say thanks for working on this, I'm really looking forward to being able to use AJAX.

But I was wondering, why is this being made as a separate patch? Wouldn't it be easier to make it part of the website itself?
If I had a world of my own, everything would be nonsense. Nothing would be what it is, because everything would be what it isn't. And contrary wise, what is, it wouldn't be. And what it wouldn't be, it would. You see?
User avatar
Colonel chewyman
 
Posts: 400
Joined: Sat Feb 17, 2007 12:48 am

Postby jiminski on Thu Oct 04, 2007 6:49 am

I used to count all the troops up .. count cards, going back through all the game text.... without Bob i can;t see a way i could possibly play more than 20 games at a time.

GM is genius and if i had the knowledge i would be helping out with patches and scripts and cups of Tea.... but i am not that smart!

Thanks! email me if you want a cup of Tea.
User avatar
Captain jiminski
 
Posts: 5422
Joined: Tue Feb 20, 2007 3:30 pm
Location: London

Postby Ishiro on Thu Oct 04, 2007 10:14 am

The biggest problem has been that if I do a traditional function override for GM, the BOB functions execute 5 times per click. It slows down and breaks the functions that otherwise work. So I've been working on how to limit the execution of BOB functions. It ain't easy. Right now, the script works 100% if it is not your turn. Once it is your turn, the overexecution causes the map to stop updating, forcing you to exit and return to the game after every action. Unacceptable.

Still working on it...
Image
User avatar
Corporal 1st Class Ishiro
 
Posts: 324
Joined: Mon Jul 17, 2006 5:53 pm
Location: Under the Rainbow

Postby Aerial Attack on Mon Oct 08, 2007 9:42 am

Not that you don't already have enough on your hands getting BOB to work with AJAX ...

But, You'll also need to update the way it reads XML. Right now - for maps that use partial bonuses, BOB does not handle "non-explicit" partial pairings.

I'll use Italy as my example map.

New XML
Code: Select all
(you need to talk to whoever wrote the XML for the Italy Map OR Pearl Harbor Map for the new XML)


Old (Explicit Partial Pairings) XML
Code: Select all
(this is only an approximation - not the exact code)
<bonuses>
  <bonus:+1>
    <territory:Napoli>
    <territory:Palermo>
  </bonus>
  <bonus:+1>
    <territory:Napoli>
    <territory:Roma>
  </bonus>
  <bonus:+1>
    <territory:Napoli>
    <territory:Torino>
  </bonus>
  <bonus:+1>
    <territory:Napoli>
    <territory:Venezia>
  </bonus>
  <bonus:+1>
    <territory:Palermo>
    <territory:Roma>
  </bonus>
  <bonus:+1>
    <territory:Palermo>
    <territory:Torino>
  </bonus>
  <bonus:+1>
    <territory:Palermo>
    <territory:Venezia>
  </bonus>
  <bonus:+1>
    <territory:Roma>
    <territory:Torino>
  </bonus>
  <bonus:+1>
    <territory:Roma>
    <territory:Venezia>
  </bonus>
  <bonus:+1>
    <territory:Torino>
    <territory:Venezia>
  </bonus>
// negative because of overlap with 3 terrs
  <bonus:-1>
    <territory:Napoli>
    <territory:Palermo>
    <territory:Roma>
  </bonus>
  <bonus:-1>
    <territory:Napoli>
    <territory:Palermo>
    <territory:Torino>
  </bonus>
  <bonus:-1>
    <territory:Napoli>
    <territory:Palermo>
    <territory:Venezia>
  </bonus>
  <bonus:-1>
    <territory:Napoli>
    <territory:Roma>
    <territory:Torino>
  </bonus>
  <bonus:-1>
    <territory:Napoli>
    <territory:Roma>
    <territory:Venezia>
  </bonus>
  <bonus:-1>
    <territory:Napoli>
    <territory:Torino>
    <territory:Venezia>
  </bonus>
  <bonus:-1>
    <territory:Palermo>
    <territory:Roma>
    <territory:Torino>
  </bonus>
  <bonus:-1>
    <territory:Palermo>
    <territory:Roma>
    <territory:Venezia>
  </bonus>
  <bonus:-1>
    <territory:Palermo>
    <territory:Torino>
    <territory:Venezia>
  </bonus>
  <bonus:-1>
    <territory:Roma>
    <territory:Torino>
    <territory:Venezia>
  </bonus>
// back to positive because of dual overlap with 4 or 5 terrs
  <bonus:+1>
    <territory:Napoli>
    <territory:Palermo>
    <territory:Roma>
    <territory:Torino>
  </bonus>
  <bonus:+1>
    <territory:Napoli>
    <territory:Palermo>
    <territory:Roma>
    <territory:Venezia>
  </bonus>
  <bonus:+1>
    <territory:Napoli>
    <territory:Palermo>
    <territory:Torino>
    <territory:Venezia>
  </bonus>
  <bonus:+1>
    <territory:Palermo>
    <territory:Roma>
    <territory:Torino>
    <territory:Venezia>
  </bonus>


For the Italy map the number of bonus lines are the same, but for Age of Merchants - I know that the new XML would require fewer lines and therefore less processing time.
User avatar
Sergeant Aerial Attack
 
Posts: 1132
Joined: Mon Jun 04, 2007 7:59 pm
Location: Generation One: The Clan

Postby yeti_c on Tue Oct 09, 2007 4:32 am

I was looking into this...

I can get the handleResponse() back but I can't manage to override it with a new version - without copy and pasting the contents of the function from the source file...

Code: Select all
//function dave()
//{
//   alert("dave");
//}
//
//var newHandleResponse = unsafeWindow.handleResponse;
//var contents = ""+newHandleResponse;
//alert(newHandleResponse);
//start = contents.substring(0,28);
//middle = "dave();";
//end = contents.substring(28, contents.length);
//alert(start);
//alert(middle);
//alert(end);


This creates a new String that holds the entirety of the function - with my new function in it... (dave();) but I can't override the existing function easily... any ideas?

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

Postby yeti_c on Tue Oct 09, 2007 6:08 am

In actual fact - what would be better LACK... is if you coded a dummy function...

i.e. refreshGMScript()

which was called from handleResponse() by you...

and then we could override refreshGMScript easily without having to merge your code into it...

Is this something that you could do?

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

Postby Ishiro on Tue Oct 09, 2007 7:41 am

A dummy function would be great, especially if lack coded it to always be called last as a clean up once he's done all his stuff.

If you want to override lack's handleResponse, you can either:
a) copy his entire function and make the changes you need to it (this is what I'm currently working on).
pros: lets you place new code exactly where it is needed.
cons: it replaces lack's function and so if he makes changes to that function you will be ignoring it until you update your script.

b) make a copy of his function and throw in your own code like this:
Code: Select all
var newhandleResponse = unsafeWindow.handleResponse;
unsafeWindow.handleResponse = function() {
   //put all your new code here
   return newhandleResponse();
}

pros: doesn't replace lack's code, so when he makes changes you won't be ignoring his new code.
cons: as I've mentioned before, the handleResponse function is called 4 or 5 times per action, so BOB executes 4 or 5 times making it slow and actually breaking the map (it "freezes", stops updating with the AJAX).
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 Tue Oct 09, 2007 8:07 am

Ishiro wrote:A dummy function would be great, especially if lack coded it to always be called last as a clean up once he's done all his stuff.

If you want to override lack's handleResponse, you can either:
a) copy his entire function and make the changes you need to it (this is what I'm currently working on).
pros: lets you place new code exactly where it is needed.
cons: it replaces lack's function and so if he makes changes to that function you will be ignoring it until you update your script.

b) make a copy of his function and throw in your own code like this:
Code: Select all
var newhandleResponse = unsafeWindow.handleResponse;
unsafeWindow.handleResponse = function() {
   //put all your new code here
   return newhandleResponse();
}

pros: doesn't replace lack's code, so when he makes changes you won't be ignoring his new code.
cons: as I've mentioned before, the handleResponse function is called 4 or 5 times per action, so BOB executes 4 or 5 times making it slow and actually breaking the map (it "freezes", stops updating with the AJAX).


Ah yes - that's a nice way of doing it - nice work Ishiro...

With regards to the 5 times calling...

I think you need to examine the parameters that are being called upon it... that way you could pick and choose which ones update your data...

--------------

I was thinking the best way for BOB to run is to hold all the data in arrays - and then only modify the data based on this turns action (Frist time init will be slow (as per) but each auto-refresh will be quicker... (You can hold the index of this)... this way you'll not have to do so much work... what do you reckon? (If a proper F5 is done though then a slow re-init will be run but that could be mentioned in the docs?)

n.b. for freestyle - will have to be this round... for sequential can be limited to the players turn.

The time consuming stuff of BOB is the Log parsing.

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