PHP Map Preview Script

Everything todo with programming goes HERE.
Post Reply
User avatar
LOVER$BOY
Match Winner
Posts: 731
Joined: Thu Jan 24, 2008 12:46 pm

PHP Map Preview Script

Post by LOVER$BOY »

So your wondering "What is this about?"

As it is my general desire to express myself briefly through the subject title, I think you can guess what this is going to be about :P

Yes. I've finally decoded the Javascript and recoded it in PHP. I don't know if anyone thought it was possible (I didn't think it would be). It took me a day to fully understand the script written in Javascript and then another day to find out as much as I could about the commands that I needed to accomplish what I had in mind.

Finally, after taking a few hours rest and a few hours of university studying, I have completed a version that I have tested and can tell you all that it works!

I've attached it to this post. So I hope people will find it useful. ;)

UPDATE: 14 - 02 - 2013
Script is now located here: https://code.launchpad.net/~zodiacsohma ... ap_preview
Last edited by LOVER$BOY on Thu Feb 14, 2013 3:48 am, edited 1 time in total.
Image
User avatar
LOVER$BOY
Match Winner
Posts: 731
Joined: Thu Jan 24, 2008 12:46 pm

Re: PHP Map Preview Script

Post by LOVER$BOY »

Oopsy... I made a slight mistake in the script.

At line 131 and 132, those two values should be enclosed in the '..'

Like this:

Code: Select all

$sizeWidth = '100%';		// the width of the map to display on the browser screen
$sizeHeight = '100%';		// the height of the map to display on the browser screen
Image
User avatar
AI-team
Shutout Match Winner
Posts: 1020
Joined: Tue Jun 23, 2009 6:17 pm
Location: Germany/Munich
Contact:

Re: PHP Map Preview Script

Post by AI-team »

clientside rendering > serverside rendering :D
  
 
"95% of people believe in every quote you post on the internet" ~ Abraham Lincoln
 
 
User avatar
LOVER$BOY
Match Winner
Posts: 731
Joined: Thu Jan 24, 2008 12:46 pm

Re: PHP Map Preview Script

Post by LOVER$BOY »

um... I don't understand what your trying to say AI-Team... :?

UPDATE: 14 - 02 - 2013
If anyone want an preview example of this script, check out my map's preview: http://vertrex.tk/aa/resource/index.php ... .aamap.xml

Here are the color standards:
GREEN - Win Zone
LIGHT GREEN - Target Zone
RED - Death Zone
Blue - Flag Zone
Orange - {Rubber | Unknown} Zone
Yellow - Teleport Zone
Brown - Ball Zone
Last edited by LOVER$BOY on Thu Feb 14, 2013 3:54 am, edited 5 times in total.
Image
nux
Round Winner
Posts: 206
Joined: Mon Sep 12, 2011 11:20 pm

Re: PHP Map Preview Script

Post by nux »

AI-team wrote:clientside rendering > serverside rendering :D
The client is still the one rendering, this script is more of a translator from xml to svg.
There's a difference between knowing your shit, and knowing you're shit. Grammar does matter.
User avatar
AI-team
Shutout Match Winner
Posts: 1020
Joined: Tue Jun 23, 2009 6:17 pm
Location: Germany/Munich
Contact:

Re: PHP Map Preview Script

Post by AI-team »

you know what I mean <_<
  
 
"95% of people believe in every quote you post on the internet" ~ Abraham Lincoln
 
 
nux
Round Winner
Posts: 206
Joined: Mon Sep 12, 2011 11:20 pm

Re: PHP Map Preview Script

Post by nux »

AI-team wrote:you know what I mean <_<
I do, but i havent seen the JS one, so theres not much context.
There's a difference between knowing your shit, and knowing you're shit. Grammar does matter.
User avatar
LOVER$BOY
Match Winner
Posts: 731
Joined: Thu Jan 24, 2008 12:46 pm

Re: PHP Map Preview Script

Post by LOVER$BOY »

Oh ok.

Well the JS is linked in my first post. It's at pastebin for you all to see.

Well at-least this is now useful, I hope. Took me quite a while to get it right.
Image
nux
Round Winner
Posts: 206
Joined: Mon Sep 12, 2011 11:20 pm

Re: PHP Map Preview Script

Post by nux »

LOVER$BOY wrote:um... I don't understand what your trying to say AI-Team... :?
Any resources you dont use in your server (by having the client do some of the work) mean they can be used for other things. This is what he means, if somebody has to waste resources, the client is preferred. Having the client do this has its pros and cons, same for doing it on the server; in this case, it doesnt really matter which way you go.
There's a difference between knowing your shit, and knowing you're shit. Grammar does matter.
User avatar
Light
Reverse Outside Corner Grinder
Posts: 1667
Joined: Thu Oct 20, 2011 2:11 pm

Re: PHP Map Preview Script

Post by Light »

Your percentages on line 131 & 132 should be a string, else you get an error.
At least I do on version, PHP 5.4.4-12.

Now what I'm interested in, as I'm not used to SVG is, would it be possible to show point coordinates at the end of each wall? I'm trying to edit a map that has the most impossible to read coordinates ranging from like -25000 to 25000 and I just need to change one wall by a few places. I can't figure out which wall it is though, lol. :(

Well, figured it out the hard way, but coordinates would be very nice in the future.
User avatar
LOVER$BOY
Match Winner
Posts: 731
Joined: Thu Jan 24, 2008 12:46 pm

Re: PHP Map Preview Script

Post by LOVER$BOY »

Sure, I'll see what I can do about it. Thanks for bringing this to my attention :)

I know what your talking about since I have seen turtle/adveture/ maps of Advanced Racing of Adventures of Tron. I can barely see the overview of the map since sine mapped it so huge :P

Also, if people are interested, all of my free scripts are located here: http://vertrex.tk/wiki/Scripts
Image
Post Reply