Fancy text plugin by pyrolord

Discuss everything about Xymph's Aseco flavoured server control scripts for TM Forever / classic TMN and for TM² Canyon.

Moderators: Xymph, TM-Patrol

Post Reply
pyrolord
pedestrian
pedestrian
Posts: 5
Joined: 27 Nov 2009 10:07
Owned TM-games: TMU-F

Fancy text plugin by pyrolord

Post by pyrolord » 27 Nov 2009 10:20

Hiho all.

I created a plugin for Xaseco. Actually it's working just nice, except for one big problem: Special characters.
My plugin uses the text and formats it, before it's given back.

However, if someone uses special chars in his/her message there's no output. Letters like "ä/ö/ü/ß/greek letters" etc. Chars like "^/!/?/" don't make any problems.

I hope someone can explain what is going wrong. That's the last thing to solve before i can release it.

Here's the code:

Code: Select all

<?php
/* vim: set noexpandtab tabstop=2 softtabstop=2 shiftwidth=2: */

/**
 * Chat plugin.
 * Created by Freakay
 */
 
require("fancy.class.php");

Aseco::addChatCommand('fancy', 'Creates a custom gradient text');

function chat_fancy($aseco, $command) {

  $pattern = '#^[0-9A-Fa-f]{3}[\s]+[0-9A-Fa-f]{3}(|[\s]+[^\$]*)$#is';
	$player = $command['author'];
	$login = $player->login;

	// check if on global mute list
	if (in_array($player->login, $aseco->server->mutelist)) {
		$message = formatText($aseco->getChatMessage('MUTED'), '/fancy');
		$aseco->client->query('ChatSendServerMessageToLogin', $aseco->formatColors($message), $player->login);
		return;
	}

  if ($command['params'] != '') {
    $getstring = formatText($command['params']);
    $arglist = explode(' ', $command['params'], 3);
    if (ctype_xdigit($arglist[0]) && ctype_xdigit($arglist[1]) && preg_match($pattern, $getstring)){
      $fancymsg=new gradienttext($arglist[0],$arglist[1],$arglist[2]);
      $msg = '$g[' . $player->nickname . '$z$s] '.$fancymsg->create();
      $aseco->client->query('ChatSendServerMessage', $msg);
    }else{
      $aseco->client->query('ChatSendServerMessageToLogin', "Syntax error!", $login);
      $aseco->client->query('ChatSendServerMessageToLogin', "Example: '/fancy fff 000 message'.", $login);
    }		
  }	
}  // chat_fancy
?>
Kind regards,
Pyro

reaby
smooth traffic navigator
smooth traffic navigator
Posts: 213
Joined: 02 Jul 2009 21:24
Owned TM-games: TMUF

Re: Fancy text plugin by pyrolord

Post by reaby » 27 Nov 2009 11:32

are the script files in utf-8 ?
have you tried utf8_encode() ?

pyrolord
pedestrian
pedestrian
Posts: 5
Joined: 27 Nov 2009 10:07
Owned TM-games: TMU-F

Re: Fancy text plugin by pyrolord

Post by pyrolord » 27 Nov 2009 15:13

Yes, the cript files are utf-8.

utf8_encode() helped, kind of.
Now i get the output (yay! ^_^) but instead of "äöüß etc" there are weird letters.

Regards

pyrolord
pedestrian
pedestrian
Posts: 5
Joined: 27 Nov 2009 10:07
Owned TM-games: TMU-F

Re: Fancy text plugin by pyrolord

Post by pyrolord » 28 Nov 2009 11:09

Hiho

Still have the same problem. With utf8_encode i get an output, but it's pretty cryptical for special chars.
I just don't understand it, cause the whole script isn't very different to /me e.g.
Hope someone has an idea what's going on.

Regards.

pyrolord
pedestrian
pedestrian
Posts: 5
Joined: 27 Nov 2009 10:07
Owned TM-games: TMU-F

Re: Fancy text plugin by pyrolord

Post by pyrolord » 30 Nov 2009 10:05

*push*

No ideas, anyone? :shock:

Lambda
happy cruiser
happy cruiser
Posts: 131
Joined: 22 Feb 2009 22:03
Owned TM-games: TMU+F, TM²C

Re: Fancy text plugin by pyrolord

Post by Lambda » 30 Nov 2009 10:27

Can you post fancy.class.php?

pyrolord
pedestrian
pedestrian
Posts: 5
Joined: 27 Nov 2009 10:07
Owned TM-games: TMU-F

Re: Fancy text plugin by pyrolord

Post by pyrolord » 30 Nov 2009 12:31

fancy.class.php just creates a text gradient and works fine with utf-8. I checked that already. :?

dukez30
sunday driver
sunday driver
Posts: 59
Joined: 23 Aug 2008 14:26
Owned TM-games: TMU

Re: Fancy text plugin by pyrolord

Post by dukez30 » 11 Dec 2009 18:36

So this is working? i have enabled the plugin but the text chat is just the same....

User avatar
ramabk1
sunday driver
sunday driver
Posts: 57
Joined: 26 Feb 2009 13:36
Owned TM-games: TMU
Manialink(s): Mania
Location: Lithuanian/Vilnius

Re: Fancy text plugin by pyrolord

Post by ramabk1 » 11 Dec 2009 19:22

:roflol:

Post Reply