[PHP] Converting Armagetron Colors to HTML Colors
- delinquent
- Match Winner
- Posts: 760
- Joined: Sat Jul 07, 2012 3:07 am
Re: [PHP] Converting Armagetron Colors to HTML Colors
Looking at that makes me confused again as to the operation of the counter... surely it should be looking for the zone first being conquered rather than the round starting? Or have I got this completely wrong?
Re: [PHP] Converting Armagetron Colors to HTML Colors
um... delinquent, how the heck is ROUND_COMMENCING and zone comqueing related?
It's meant to change maps once the round is about to start.
Ok. Actually the original code wasn't commented. I usually don't leave comments. Only through title or description in my wiki is where I explain about the use of that script.
It's meant to change maps once the round is about to start.
Ok. Actually the original code wasn't commented. I usually don't leave comments. Only through title or description in my wiki is where I explain about the use of that script.
Last edited by LOVER$BOY on Fri Aug 31, 2012 6:23 am, edited 1 time in total.
Re: [PHP] Converting Armagetron Colors to HTML Colors
Its not his fault he doesnt understand what this script does. That is the problem, you are commenting on the wrong things. There should be a link to the wiki on your script if you dont want to duplicate the usage comments or its too extended/detailed to be there.LOVER$BOY wrote:um... delinquent, who the heck is ROUND_COMMENCING and zone comqueing related?
It's meant to change maps once the round is about to start.
Ok. Actually the original code wasn't commented. I usually don't leave comments. Only through title or description in my wiki is where I explain about the use of that script.
There's a difference between knowing your shit, and knowing you're shit. Grammar does matter.
Re: [PHP] Converting Armagetron Colors to HTML Colors
Ok I got it.
Instead of posting it here, I might as well post it at my wiki with the extended details
Thanks nux. That's a great idea.
Actually I made a mistake in the wording. Instead of writing "how", I wrote "who" My bad.
Instead of posting it here, I might as well post it at my wiki with the extended details
Thanks nux. That's a great idea.
Actually I made a mistake in the wording. Instead of writing "how", I wrote "who" My bad.
Re: [PHP] Converting Armagetron Colors to HTML Colors
Don't know if it's helpful, but here's how I do it. I just throw the span's inside of each other.
Code: Select all
$servername = preg_replace('/(<|>|\\|\/)/e', 'htmlspecialchars("$1");', $servername);
while (strpos($servername, "0x") !== false)
{
$servername = preg_replace('/0x(\w{6})(.*)?/', '<span style="color: #$1;">$2</span>', $servername);
}
Re: [PHP] Converting Armagetron Colors to HTML Colors
About comments:
Mostly what comments I write is at the beginning that tells information about the script and who made it and that stuff. For example:or also this
And I figure things like are a bit self explanitory
I write comments in these places. For example:
Edit: I made a mistake on one of the comments on this post.
(I need to get out of the habit of using all those ;'s in places where they are not needed)
Mostly what comments I write is at the beginning that tells information about the script and who made it and that stuff. For example:
Code: Select all
// By Nelg; adventure time script.
Code: Select all
// Script by nelg. Created for the use of Advanced Stable version. Some commands in this script were copyed from 'Beta Trunk 0.4'.
// Some commands will Be different, lots will not be there. If you think theres something that should be here, please
// tell nelg.
Code: Select all
function [i]DEFAULT_MAP[/i]($value) {
if (($value == 1)) {
CMD("map_file Anonymous/polygon/regular/square-1.0.1.aamap.xml");
};
};
I write comments in these places. For example:
Code: Select all
$NUM_AIS_3_PLAYER = 1; // How many Ais to have with 3 players in MutiPlayer mode - No limit
(I need to get out of the habit of using all those ;'s in places where they are not needed)
Last edited by XD|VIPer on Tue Apr 02, 2013 12:32 pm, edited 1 time in total.
Re: [PHP] Converting Armagetron Colors to HTML Colors
Ya that's the way to go! I was actually planning on re-programming this script since my first attempt was pretty rough and not simple. Thanks for the heads upLight wrote:Don't know if it's helpful, but here's how I do it. I just throw the span's inside of each other.
Code: Select all
$servername = preg_replace('/(<|>|\\|\/)/e', 'htmlspecialchars("$1");', $servername); while (strpos($servername, "0x") !== false) { $servername = preg_replace('/0x(\w{6})(.*)?/', '<span style="color: #$1;">$2</span>', $servername); }
Don't worry. I haven't changed much in the habit of commenting. Rather, I'm less commenting since I'm letting my lazy attitude take over when programming. Only in situations like complexity that I prefer to comment and explain a bit on itXD|VIPer wrote:About comments:
Mostly what comments I write is at the beginning that tells information about the script and who made it and that stuff. For example:or also thisCode: Select all
// By Nelg; adventure time script.
And I figure things likeCode: Select all
// Script by nelg. Created for the use of Advanced Stable 'Beta Trunk 0.4' version. Most commands were copyed from there. // Some commands will Be different, lots will not be there. If you think theres something that should be here, please // tell nelg.
are a bit self explanitoryCode: Select all
function [i]DEFAULT_MAP[/i]($value) { if (($value == 1)) { CMD("map_file Anonymous/polygon/regular/square-1.0.1.aamap.xml"); }; };
I write comments in these places. For example:Code: Select all
$NUM_AIS_3_PLAYER = 1; // How many Ais to have with 3 players in MutiPlayer mode - No limit
(I need to get out of the habit of using all those ;'s in places where they are not needed)
Re: [PHP] Converting Armagetron Colors to HTML Colors
I've fixed up my script and assembled it to the launchpad now. It's simple, neat and very effective. On top of that, only took me 10 minutes which is better than the version 1.0 who took me hours
So Version 2.0 is now better and more effective. Also, it will not load the characters of non-color recognized. Just a place holder to stop loading in non-recognized letters.
So Version 2.0 is now better and more effective. Also, it will not load the characters of non-color recognized. Just a place holder to stop loading in non-recognized letters.
Re: [PHP] Converting Armagetron Colors to HTML Colors
Upgraded script to now check if the color codes are dark or not. If so, white background will appear with the text colored. I followed the steps taken in the game code which works great!