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.
User avatar
Twill
Posts: 3630
Joined: Fri Jan 20, 2006 10:54 pm

Post by Twill »

You guys amaze me :)

Thanks for working so hard to get the monkey back up and running!
User avatar
RiskTycoon
Posts: 1093
Joined: Wed Nov 29, 2006 3:29 pm
Gender: Male
Location: Massachusetts, USA

Post by RiskTycoon »

I second that Twill...just wish I was smart enough to help lol but alas I am not......so I thank you code savvy people from the bottom of my CC heart!
"How do you like that? Even among misfits you're a misfit!"
User avatar
lackattack
Posts: 6097
Joined: Sun Jan 01, 2006 10:34 pm
Location: Montreal, QC

Post by lackattack »

yeti_c wrote: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.


Done. Hope it helps..
User avatar
yeti_c
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am
Gender: Male

Post by yeti_c »

Perfect... this should help the coding effort a great deal...

Ta,

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

Post by yeti_c »

Righto - here's an update for now...

My new BOB is working quite well... all the stats update themselves per turn... and that all works really well...

The only problem that I have is that my BOB script breaks the Map updates from AJAX!!

I will work on this Friday and see if I can stop that from happening... then will try and reintegrate the map inspectors and so forth...

Also I need to improve the parsing of the XML to read <required> tags and <bombardments>

But we're making good progress I think.

C.
Image
Highest score : 2297
User avatar
gimil
Posts: 8599
Joined: Sat Mar 03, 2007 12:42 pm
Gender: Male
Location: United Kingdom (Scotland)

Post by gimil »

keep it up yeti_C buddy your commitment outstands me :D
What do you know about map making, bitch?

natty_dread wrote:I was wrong


Top Score:2403
User avatar
lackattack
Posts: 6097
Joined: Sun Jan 01, 2006 10:34 pm
Location: Montreal, QC

Post by lackattack »

Keep in mind that with AJAX, you need to fetch updated maps with a url like this:

map.php?key=map24a3e7d1310463a58e66e4be29d9b943

The old way of passing armies to map.php is going the way of the dodo.
User avatar
yeti_c
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am
Gender: Male

Post by yeti_c »

lackattack wrote:Keep in mind that with AJAX, you need to fetch updated maps with a url like this:

map.php?key=map24a3e7d1310463a58e66e4be29d9b943

The old way of passing armies to map.php is going the way of the dodo.


Yeah I worked that one out - I piggybacked your variable gameArmies -> which you update for me...

I think the map's not updating cos I've got a script error which is stopping the process from running...

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

Post by yeti_c »

Hmmm - still can't get the map updates to work...

Ishiro? Does your script stop the map from updating?

Drop me a PM if you like and we can discuss the merits of our 2 approaches and perhaps can merge the 2 into 1 working script?!

C.
Image
Highest score : 2297
User avatar
Ishiro
Posts: 324
Joined: Mon Jul 17, 2006 6:53 pm
Gender: Male
Location: Under the Rainbow
Contact:

Post by Ishiro »

Yep, it stops the map, and I have no idea why.

It does work if I strip the colors out of the map inspect and just have it load once to show attack paths but don't update it for changes. I think the browser may just not like the slew of updates and either kills it or is just really slow... I've never tried waiting to see if it catches up.
Image
User avatar
yeti_c
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am
Gender: Male

Post by yeti_c »

Ishiro wrote:Yep, it stops the map, and I have no idea why.

It does work if I strip the colors out of the map inspect and just have it load once to show attack paths but don't update it for changes. I think the browser may just not like the slew of updates and either kills it or is just really slow... I've never tried waiting to see if it catches up.


Bugger!!

The colours eh?! which bit?

The initialisation bit?

Or all the magicmap stuff?

At the mo my "magicmap" div can't be found - so I've commented it all out...

C.
Image
Highest score : 2297
User avatar
Ishiro
Posts: 324
Joined: Mon Jul 17, 2006 6:53 pm
Gender: Male
Location: Under the Rainbow
Contact:

Post by Ishiro »

The main thing you have to change in the script is that "inner-map" used to be a DIV, its not anymore, so most of the code that uses "inner-map" is broken.
Image
User avatar
yeti_c
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am
Gender: Male

Post by yeti_c »

Ishiro wrote:The main thing you have to change in the script is that "inner-map" used to be a DIV, its not anymore, so most of the code that uses "inner-map" is broken.


Yeah - at the mo I've dropped any innermap stuff... but I'll have a check!!

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

Post by yeti_c »

Right - I've disabled anything running on the refresh and it still doesn't work...

I reckon it must be the inital script that kills the map then...

Like you say - no div stuff now... I wonder if the div's added for the stats and map inspect etc stop the AJAX from working!?

C.
Image
Highest score : 2297
User avatar
Ishiro
Posts: 324
Joined: Mon Jul 17, 2006 6:53 pm
Gender: Male
Location: Under the Rainbow
Contact:

Post by Ishiro »

It shouldn't... lack is referring to everything by name. But I know some of the stuff in BOB was doing things by type and counting them, I had to redo a bunch of that. I'd give you a copy but that PC is currently dead and I haven't had time to work on it.
Image
User avatar
yeti_c
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am
Gender: Male

Post by yeti_c »

I've had a thought - I suspect that this problem is security based...

The browser might be stopping the script from reaccessing the objects that are in the main page correctly...

I will run a couple of tests to see if this is truly the case...

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

Post by yeti_c »

I was wrong...

It's definitely something in the initialisation of the script that breaks the map...

To test this
I first stopped my refreshGMScript() doing anything... map still broken...
Then I stopped my refreshGMScript() function redefining itself - and the map is still broken...

So this can't be any security issue... their must be something that stops the map from refreshing in the init... I'll continue to work on this...

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

Post by yeti_c »

Righto - I've narrowed it down to the Card Redemption DIV...

I will attempt to recode this bit into something that doesn't break the map!!

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

Post by yeti_c »

Righto...

I think I have an AJAX compatible BOB...

Not all of the features are in yet...

and things like <required> for continents aren't finished yet...

BUT it's a start...

I will send latest to LACK and get him to host for now... expect updates throughout this week to get it working...

Also feel free to post any errors/bugs in it into this thread...

C.
Image
Highest score : 2297
User avatar
Rocketry
Posts: 1416
Joined: Wed May 16, 2007 6:33 pm
Gender: Male
Location: Westminster
Contact:

Post by Rocketry »

good work so far lol. If i had a clue how to help, i would....

Rocketry
User avatar
yeti_c
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am
Gender: Male

Post by yeti_c »

Known bugs in current version...

Next card Redemption value no longer shown. (Escalating only)
Map Inspect/Hover type stuff no longer shown.
Strength calculation = NaN.
Terminator Summary keeps getting added to the log.
New XML features aren't calculated yet.
Confirm Buttons are a bit screwy!!

Please reply here once you have the new script in and if you find anything else...

C.

PS Also the new script DOESN'T work with AJAX off... because I couldn't be bothered to make it backwards compatible (as Lack will be disabling the nonajax feature anyway - I decided that was the way to go)!!
Image
Highest score : 2297
User avatar
RobinJ
Posts: 1901
Joined: Mon Aug 21, 2006 2:56 pm
Location: Northern Ireland

Post by RobinJ »

Bravo guys. I haven't got much of a clue what you're talking about but I've gathered that you've found something that works.

How much free premium did lack offer you? ... it should be more!

=D>
nmhunate wrote:Speak English... It is the language that God wrote the bible in.


Highest Score: 2437
Highest Place: 84
User avatar
yeti_c
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am
Gender: Male

Post by yeti_c »

Hi Robin,

He doesn't offer anything and I don't expect anything... I did it for the challenge!!

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

Post by yeti_c »

OK - early work this morning has gleaned the following...

Map Fade now works (renamed to Map Opacity as it works the opposite way to before!)

Strength Calculation now works.

Redemption Div now appears and works.

TODO:

(Actually host the file somewhere - expect that later this arvo)
Map Inspect. <- thinking about how to do this easily!!
Log tweaking. <- thinking about how to do this easily.
New XML features aren't calculated yet. <- I've worked out my logic for this - just need to code.
Confirm Buttons are a bit screwy!! <- I know why now too!!

C.
Image
Highest score : 2297
User avatar
Aerial Attack
Posts: 1132
Joined: Mon Jun 04, 2007 8:59 pm
Location: Generation One: The Clan

Post by Aerial Attack »

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, yeti_c - lack did offer.
Locked

Return to “Tool Archives”