[PHP/HTML] TMF Color Parser 1.3c

This is the place where you can find everything related to the dedicated server, control scripts and community tools.

Moderators: Pit Crew, TM-Patrol

SilentStorm
wheelbarrow operator
wheelbarrow operator
Posts: 19
Joined: 30 Sep 2008 18:37
Owned TM-games: TMUF

Re: [PHP/HTML] TMF Color Parser 1.3c

Post by SilentStorm » 22 Aug 2009 03:12

Hey,

I found this nice little thing when downloading a new Version of one of your other Stuff. Of course only after I already spent hours making my own ColorParser :S

Anyways... besides whats already been said about Nadeo accepting faulty ColorCodes as long as the first Char after the $ is valid, I have a few other things to mention that could be improved.

1) If you aren't going to copy Nadeo on the faulty ColorCodes (which I could accept as I too think it should never been allowed in the first place) you should at least strip the next 3 Characters from the String. So that $fxxNickname becomes Nickname instead of fxxNickname.

2) you parse the w Tag as bold whereas the Game parses it with something along the lines of

Code: Select all

<span style="letter-spacing: 5px; font-weight: bold;">
. Just Bold seems to be the o-Tag.

3) (Appendix to 1) If there are nonvalid Codes in the TM Code they should be stripped entirely like the game does it. For example the Following Code:

Code: Select all

$W$B$I$900U$c60n$ff0i$090t$3ffe$00fd $1005
gives (without the Colors - im too lazy right now) BUnited 5 with your Tool, but should return United 5.

4) There seem to be a Problem with your Parsing of the m-Tag. You seem to be parsing it just the same way as the n-Tag.

Code: Select all

require_once('./classes/tmfcolorparser.inc.php');
$Parser = new TMFColorParser;
	//$test = '$w$i$0f0Wide Italics $z$nNarrow Normal $z$n$i$00fNarrow Italics $z$w$n$iWideNarrowItalics $zStandard Text $nNarrow Default $mStandard Text';
	$test = '$oSome Bold Text. $z$nSome Narrow Text $mSome Normal Text';
	echo $Parser->toHTML($test);
4.1) The Narrow Text looks just like the normal one

5) Your Parser also ignores the $w Code in cases like the following one:

Code: Select all

$w$yBanana $i$069Split
. Which gives yBanana in default Color and no formatting at all and formats the Split with the correct formatting of WideItalic in the correct Color.

I also found that you seem to accept 2 Digit Color Codes aswell which seems odd as they will never be valid and should'nt exist in the first place.

Code: Select all

if (preg_match("/^[0-9a-f]{2,3}/i",$chunks[$i], $matches)){
shouldn't that be just {3} instead of {2,3}?
then in the same function (toHTML) you double the Color Codes to make them standard 6 Digit Color Codes whereas every Browser I know of accepts the 3 Digit ones just like the 6 digit ones... I just thought I would mention it.


Other than that its a pretty nice tool :) that I unfortunately found way too late...

OffTopic: Why is it that while not logged in, the Forum looks just fine, but once logged in its waaay too huge (and thus ugly imho)?
Last edited by SilentStorm on 23 Aug 2009 18:05, edited 1 time in total.

Xymph
Pit Crew
Pit Crew
Posts: 5706
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

Re: [PHP/HTML] TMF Color Parser 1.3c

Post by Xymph » 22 Aug 2009 08:34

SilentStorm wrote:OffTopic: Why is it that while not logged in, the Forum looks just fine, but once logged in its waaay too huge (and thus ugly imho)?
Choose your preferred board style in your user control panel.
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub

SilentStorm
wheelbarrow operator
wheelbarrow operator
Posts: 19
Joined: 30 Sep 2008 18:37
Owned TM-games: TMUF

Re: [PHP/HTML] TMF Color Parser 1.3c

Post by SilentStorm » 23 Aug 2009 18:07

Doh! right thanks. I dont know why I didnt check there first but anyway.

User avatar
svens
speedy pilot
speedy pilot
Posts: 304
Joined: 05 Dec 2009 23:30
Owned TM-games: TMUF, TMS, TMO
Location: Bern, CH
Contact:

Re: [PHP/HTML] TMF Color Parser 1.3c

Post by svens » 22 Jan 2010 21:08

Sorry for diggin up this thread. I just want to share my modification of the parser. It adds horizontal alignment support for the draw styled string function.

Code: Select all

drawStyledString($src_img,$size, $x, $y , $color, $font, $text, $stripColors = false, $stripTags = '', $alignment = 'left')
Possible values for $alignment are "left", "right" and "center". The total length of the text will be calculated before drawing it. This allows to adjust the x position precisely.

Of course you can neither upload php nor zip nor txt files on this forum (FUUUU). You'll find it here:
http://www.svenstucki.ch/tmfcolorparser.zip

User avatar
paljas
wheelbarrow operator
wheelbarrow operator
Posts: 22
Joined: 07 Oct 2006 23:07
Owned TM-games: TMU
Contact:

Re: [PHP/HTML] TMF Color Parser 1.3c

Post by paljas » 29 Mar 2010 07:56

I had been building something similar myself, but it was incomplete. When I was made aware of this class, I replaced my code by it. Great work!

Gekko
speedy pilot
speedy pilot
Posts: 550
Joined: 03 Sep 2006 18:20
Owned TM-games: ALL
Location: Naples - Italy
Contact:

Re: [PHP/HTML] TMF Color Parser 1.3c

Post by Gekko » 29 Mar 2010 16:22

Hi fish, great parser mate!!!
Regards!! :lovetm

P.S.: I think i can mod it to show images names directly in the game in real time. Hmmmm, what do you think it can work??

Paris69
speedy pilot
speedy pilot
Posts: 381
Joined: 05 Apr 2006 20:50

Re: [PHP/HTML] TMF Color Parser 1.3c

Post by Paris69 » 30 Mar 2010 09:33

Gekko wrote:I think i can mod it to show images names directly in the game in real time. Hmmmm, what do you think it can work??
in the game? not understand where you aimed....

Gekko
speedy pilot
speedy pilot
Posts: 550
Joined: 03 Sep 2006 18:20
Owned TM-games: ALL
Location: Naples - Italy
Contact:

Re: [PHP/HTML] TMF Color Parser 1.3c

Post by Gekko » 30 Mar 2010 11:26

I will use this class to create immediate .png image to show ingame using different fonts from the TM original fonts.
It can be much useful in my OS.

Keyser
pedestrian
pedestrian
Posts: 7
Joined: 13 Apr 2009 09:44
Owned TM-games: TMUF

Re: [PHP/HTML] TMF Color Parser 1.3c

Post by Keyser » 08 Apr 2010 20:17

Is it possible to display TM nickname with color with TM Login ?

Do you know a command that can retrieve the username using the login ?

My TM login is "keyserlike", how can i display my TM nickname ?

I know it's possible because few website dispaly color nickname with only TM login.

Xymph
Pit Crew
Pit Crew
Posts: 5706
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

Re: [PHP/HTML] TMF Color Parser 1.3c

Post by Xymph » 08 Apr 2010 21:08

Keyser wrote:Is it possible to display TM nickname with color with TM Login ?

Do you know a command that can retrieve the username using the login ?

My TM login is "keyserlike", how can i display my TM nickname ?

I know it's possible because few website dispaly color nickname with only TM login.
They might be retrieving nicknames from an underlying dedicated server, or from Nadeo's stats server using the TMF Data Fetcher.
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub

Keyser
pedestrian
pedestrian
Posts: 7
Joined: 13 Apr 2009 09:44
Owned TM-games: TMUF

Re: [PHP/HTML] TMF Color Parser 1.3c

Post by Keyser » 09 Apr 2010 06:46

thank you very much, that's exactly what I wanted

User avatar
Fisch.666
happy cruiser
happy cruiser
Posts: 136
Joined: 18 May 2006 01:13
Owned TM-games: TMU, TMN, TMUF, TMNF
Location: Germany
Contact:

Re: [PHP/HTML] TMF Color Parser 1.3c

Post by Fisch.666 » 14 Apr 2011 09:51

Hi!

I'm getting a lot of this messages:

Code: Select all

PHP Notice:  Undefined index: wide in /tmnfstats/includes/ColorParser.php on line 440
PHP Notice:  Undefined index: italic in /tmnfstats/includes/ColorParser.php on line 441
PHP Notice:  Undefined index: caps in /tmnfstats/includes/ColorParser.php on line 442
PHP Notice:  Undefined index: color in /tmnfstats/includes/ColorParser.php on line 445
When using the tmfcolorparser 1.3c with this stats:

viewtopic.php?f=127&t=27475

Is this a problem from tmfcolorparser or from the stats? Thanks in advance for a reply.

User avatar
nicomoore0
speedy pilot
speedy pilot
Posts: 314
Joined: 27 May 2008 16:58
Owned TM-games: All
Location: Scotland
Contact:

Re: [PHP/HTML] TMF Color Parser 1.3c

Post by nicomoore0 » 10 Sep 2011 17:58

I am trying to install this on my website http://www.crazygaming.co.tv which is Nuke Evoultion Xtreme 2.0.9d How can I do this? Thanks
C®AżΨ αηηιнιllαтσя ッ

User avatar
Fix
Developer
Developer
Posts: 267
Joined: 12 Aug 2005 14:25
Owned TM-games: TMU, TMO, TMS
Location: Bièvres

Re: [PHP/HTML] TMF Color Parser 1.3c

Post by Fix » 13 Sep 2011 11:51

$b$i$w$s$0afF$5cfi$adfx displayed
bFix
because of the wrong parameter $b
________________________________________________________________
You have beaten the None, do you want to challenge the Finished ?

User avatar
TStarGermany
speedy pilot
speedy pilot
Posts: 387
Joined: 27 Aug 2006 18:12
Owned TM-games: TMN,TMNF,TMUF
Manialink(s): creative
Location: GER
Contact:

Re: [PHP/HTML] TMF Color Parser

Post by TStarGermany » 02 Oct 2011 10:13

Problem1:

Code: Select all

$ff0ำॆѕ$cf6τृα॒я$6f9ुбंεя$3fcмुα$0ffη़$0cfैγ
becomes this:
http://manialink4.mania-creative.com/avatars/fehler.png
=
When rendering to an image, spaces get inserted between the different chunks with different color codes. This only happens when unicode signs are in the textstring.

and
Problem2:

Code: Select all

$o$l[shop.mania-creative.com]$00fᄀ$f00ᄊ$ff0ᄃSHOP
becomes : nothing, black image output :ß
seems the combination of $o$l causes problems. without $o, the other code gets rendered fine.
Image

Post Reply