Official Soldat Forums

Soldat Fans => Fan Apps => Topic started by: DePhille on May 02, 2007, 08:57:56 am

Title: PHP Taunt maker - [23/05: Azerty support added]
Post by: DePhille on May 02, 2007, 08:57:56 am
Hi,

On request, I've made a PHP script that helps you create and/or edit taunts.txt files. You can simply load an existing taunts.txt file or start from scratch.
The script is hosted on SoldatPage (http://soldatpage.u13.net/) and you need a SoldatPage account to be able to use it, I've included screenshots if you don't want to sign up just to view it.
Please post any possible feedback!

Features:
- Upload and load an existing taunts.txt file.
- Generate new taunts.txt files.
- Very simple GUI.
- Automatic download of the taunts.txt file.
- Support for azerty keyboards.

PHP Taunt Maker (http://soldatpage.u13.net/tools_tauntmaker.php)

Screenshot - Input (http://soldatpage.u13.net/dump/phptauntmaker_screen2.gif)
Screenshot - Result (http://soldatpage.u13.net/dump/phptauntmaker_screen1.gif)

Grtz, DePhille
Title: Re: PHP Taunt maker
Post by: TBDM on May 02, 2007, 09:35:50 am
nice!

/uses
Title: Re: PHP Taunt maker
Post by: DePhille on May 04, 2007, 10:00:16 am
Thanks!

However, I'm looking for some taunt presets, they have to be made from the Soldat 1.4 taunts.txt file. If you have one please link me to it or send it to me via e-mail.

Grtz, DePhille
Title: Re: PHP Taunt maker
Post by: -Skykanden- on May 04, 2007, 10:11:35 am
Nice tool im doing my tauns, thanks i never discoverwhat key is what taunt :P
Title: Re: PHP Taunt maker
Post by: DePhille on May 04, 2007, 03:51:59 pm
Thanks :).
I'm currently looking for someone who can test it using an Azerty keyboard. I think the keys only correspond to a Qwerty keyboard and not to an Azerty one, I've had the problem a few years ago when I still had my Azerty keyboard.
Would be the first and only taunt editor that supports Azerty keyboards then ;).

Grtz, DePhille
Title: Re: PHP Taunt maker
Post by: Psycho on May 04, 2007, 04:42:28 pm
ontopic: very nice taunt editor. one of the best I think :D
offtopic: please make the server status thing next ^^
Title: Re: PHP Taunt maker
Post by: Sytrus on May 05, 2007, 09:07:49 am
Hm, my old taunts still work with 1.4

So I'm not going to use it. Seems to be sweet though.
Title: Re: PHP Taunt maker
Post by: DePhille on May 05, 2007, 11:26:48 am
Well, the taunts.txt file in 1.4 differs slightly from the one in 1.3.1 .
As you can see (or already saw) the 1.4 taunts.txt file is over 1024 bytes while the old one is around 400 bytes.
There's some binary data in the taunts.txt file in 1.4, probably for the unicode support or something.
The taunt maker should be able to handle both 1.4 and 1.3.1 taunts.txt files.

Grtz, DePhille
Title: Re: PHP Taunt maker
Post by: NinjaGimp369 on May 11, 2007, 05:47:48 am
I've encountered a problem, I made my taunt file and replaced the existing one in my Soldat folder. I went in-game to try them out but they are still the original taunts. Anyone know what the problem is and how to fix it? Any help is much appreciated.

@ DePhille: Program is very easy to use, thanks.
Title: Re: PHP Taunt maker
Post by: DePhille on May 11, 2007, 01:01:13 pm
Hi,

You're probably using profiles. If you do then you need to find the appropriate taunts.txt in the Profiles folder.

Grtz, DePhille
Title: Re: PHP Taunt maker
Post by: NinjaGimp369 on May 11, 2007, 08:44:09 pm
Oh true, thanks DePhille!
Title: Re: PHP Taunt maker
Post by: DePhille on May 12, 2007, 04:12:23 am
No problem.
If anyone tried using Unicode characters, please let me know if they worked or not since I'm not able to test that.
Thanks!

Grtz, DePhille
Title: Re: PHP Taunt maker
Post by: hyrr on May 12, 2007, 03:21:06 pm
Remember to save the taunts.txt in Unicode :)
Title: Re: PHP Taunt maker
Post by: urraka on May 12, 2007, 07:01:28 pm
UNICODE characters didn't work for me. It should work without touching the file, right?
And hyrr is right, you have to save taunts.txt in Unicode, thing you aren't doing.
Title: Re: PHP Taunt maker
Post by: DePhille on May 13, 2007, 04:01:55 am
Alright, I'll look that up and I'll try to implement that. Thanks for testing it out for me and! :)
I'll update this post when it's finished.

Grtz, DePhille
Title: Re: PHP Taunt maker
Post by: urraka on May 13, 2007, 12:27:14 pm
This might be a little help.

Code: [Select]
<?php
    header
("Content-disposition: attachment; filename=taunts.txt");
    echo 
iconv("UTF-8""UTF-16LE"$taunts);
?>

Assuming you have a $taunts variable with all the taunts and that you are using utf-8 as your website encoding. This seems to work fine cause you open the output file in notepad and you can read everything, but for some reason it doesn't work in soldat unless i open the file in notepad and save it. I'm not sure if soldat uses utf-16le, but that's the encoding i use in a taunts app i made and it works.
Title: Re: PHP Taunt maker
Post by: DePhille on May 13, 2007, 03:55:27 pm
Ah thanks alot for the suggestion. Spared me the time of having to look it up. it seems to work for me too, now the generated taunts.txt has the exact same size as the one that came with Soldat 1.4 and some people told me it was working now.
Unicode feature was added.

Grtz, DePhille
Title: Re: PHP Taunt maker
Post by: urraka on May 13, 2007, 09:55:46 pm
It stills doesn't work properly. For some reason, some characters are converted to some kind of numeric representation.

For example, I set ALT + 0 = привет, (hello in russian), but when I open the taunts file I see this:
привет

EDIT: LOL I didn't notice the paste actually made those number turn into the word again, i'll try again:
& # 1087; & # 1088; & # 1080; & # 1074; & # 1077; & # 1090;
I added some spaces between the symbols so it doesnt happen again

Grtz, PerroAZUL
Title: Re: PHP Taunt maker
Post by: DePhille on May 14, 2007, 11:58:59 am
Hi,

Seems like PHP5 doesn't support Unicode fully. I've browsed the internet and all I could find were unanswered questions about Unicode support in PHP. PHP6 however will have extended Unicode support, but that's still in development and not available to the public.

I managed to get the decimal value of every character but chr() only supports ASCII numbers, and not Unicode. I'm currently using mb functions to convert the text but it returns some special characters. It might be that it works now, but I severely doubt it. Anyway, this is the closest I can come to solve this problem besides for waiting for PHP6.

Grtz, DePhille
Title: Re: PHP Taunt maker
Post by: urraka on May 14, 2007, 01:15:02 pm
Using the small code i posted before it worked just fine for me, the only problem was that i had to resave the file.
Hmm, i think i used another header too, but for the site. Look, I'll post the exact code I used for my testing:
Code: [Select]
<?php
if (isset(
$_REQUEST['text'])) {
header("Content-disposition: attachment; filename=taunts.txt");
echo iconv("utf-8""UTF-16LE"$_REQUEST['text']);
}
else {
header("Content-Type: text/html; charset=UTF-8"true);
?>

<html><head></head><body>
<form action="uni.php">
<input name="text" type="text" /><input type="submit" />
</form>
</body>
</html>
<?php ?>

I wonder what are u using that converts unicode characters into that numeric representation.
Title: Re: PHP Taunt maker
Post by: DePhille on May 14, 2007, 01:38:37 pm
This is the submit form:
Code: [Select]
<form method="POST" accept-charset="UTF-8">
<table>
<?php
$taunts
=safestr($taunts);
foreach(
$taunts as $curkey=>$curval) { 
?>

<tr>
<td> <?php echo $tauntkeys[$curkey]; ?> </td>
<td><input type="text" name="taunt<?php echo $curkey?>" size="50" value="<?php echo $curval?>"></td>
</tr>
<? } ?>
</table>
<br>
<br>
<INPUT type="submit" value="Make Taunts.txt">
</form>

And this is the header for the download:
Code: [Select]
<?php
header
("Content-type: application/txt");
header('Content-Disposition: attachment; filename="taunts.txt"');
$taunts=file_get_contents("dump/tauntmaker_output.txt");
echo 
iconv("UTF-8""UTF-16LE"$taunts);
?>


I tried:
- Removing my self-made safestr() function, that changed nothing.
- Playing with utf8_encode and utf8_decode.
- Playing with the enctype and accept-charset settings.

The problem is already there within the $_POST[] values, so I'd normally think changing the enctype or accept-encoding should've done the trick. I did find a solution on the net to convert the $_POST[] values to numeric values, but there's no solution to make the numeric values into unicode characters other than using the HTML charcodes (the & #1080 you mentioned, without the space). Alot of topics died with the comment "Good luck with Unicode and PHP, seems like we'll see you again here very often" .
I did find alot of topics saying that PHP6 will support Unicode.

Grtz, DePhille
Title: Re: PHP Taunt maker
Post by: urraka on May 14, 2007, 03:16:39 pm
Well, i see in your script that you make the output of the taunts from a file, where i guess you have all the tautns stored. The only thing i can think about that is causing the problem is when you write or read that file. Why don't you do the output directly from the post data?
It has to work, because it works perfectly for me.

test it yourself (http://perroazul.dyndns.org/tests/uni.php)
Title: Re: PHP Taunt maker
Post by: DePhille on May 14, 2007, 03:25:39 pm
Unfortunately that isn't the problem, I tried using the POST method directly.
The values stored in the $_POST[] already generate the &" 1080 HTML codes when echo'ed or compared to another string. I've tried manipulating them with several functions but it never showed the correct output. Also, the file always showed the same contents as the echo'ed output, so I really think the output-file-download method isn't causing the problem.
I rather think it's somewhere in the PHP settings or version. I'll test your script on my server soon, but I've got no time now.

Grtz, DePhille
Title: Re: PHP Taunt maker
Post by: urraka on May 14, 2007, 05:09:54 pm
I forgot to mention that the numeric HTML codes aren't generated anymore, now i see like random symbols, like the 2 bytes of a character are treated as 2 different characters.
Title: Re: PHP Taunt maker
Post by: DePhille on May 23, 2007, 01:22:06 pm
Yeah, that's closest I could get. I was hoping, in a wild dream, that it might've been the correct characters on a PC with language packs. (I don't have the language packs installed on my PC).
I'll just have to wait until PHP6 :(.

Grtz, DePhille

Date Posted: 15-05-2007, 16:12:47
I added support for Azerty keyboards. Now users with an azerty keyboard (usually Belgian and French people) can easily create a tauntsfile too. Simply select "Azerty" as keybard layout and then fill in the fields.

Grtz, DePhille
Title: Re: PHP Taunt maker - [23/05: Azerty support added]
Post by: NinjaGimp369 on May 25, 2007, 08:33:16 am
I was editting my taunts today and wondering what that was for lol.
Title: Re: PHP Taunt maker - [23/05: Azerty support added]
Post by: ghg on May 25, 2007, 01:20:59 pm
Would anyone mind sending me a blank file as I can't be bothered registering there and I broke my taunts file.
Title: Re: PHP Taunt maker - [23/05: Azerty support added]
Post by: Shadow G-Unit on May 25, 2007, 04:32:43 pm
I LOVE YOU
Title: Re: PHP Taunt maker - [23/05: Azerty support added]
Post by: DePhille on May 26, 2007, 03:49:17 am
ghg: The registration has a few reasons. First of all, I'm trying to relaunch the SoldatPage community, and by making the features available for registered users only, I'm hoping to contact a bigger audience. Secondly there's abuse, using the accounts I can very easily ban those who excessively abuse the scripts.
As for the blank taunts file, you can simply create a new taunts.txt file with notepad. The first 10 lines contain ALT+0 to ALT+9, the next lines are the alphabet: ALT+A to ALT+Z. Add a ^ as the first character for a teamchat taunt.

Grtz, DePhille
Title: Re: PHP Taunt maker - [23/05: Azerty support added]
Post by: Shadow G-Unit on July 06, 2007, 09:51:00 am
Hey, DePhille anyway you can make this into a program?
Title: Re: PHP Taunt maker - [23/05: Azerty support added]
Post by: DePhille on July 06, 2007, 10:28:34 am
Yeah, that isn't hard at all.
Any specific thoughts on how I should make the GUI?

Grtz, DePhille
Title: Re: PHP Taunt maker - [23/05: Azerty support added]
Post by: urraka on July 06, 2007, 10:56:32 am
I've made a taunt editor already, feel free to use it. The only instruction is to enter the path to the taunts.txt file the first time you run the program.

Here I posted it. (http://forums.soldat.pl/index.php?topic=13922.msg159261#msg159261)
Title: Re: PHP Taunt maker - [23/05: Azerty support added]
Post by: DePhille on July 06, 2007, 11:44:17 am
Oh alright, then I don't think it's that important for me to make another Taunt-editor anymore. I'll create one whenever I get bored.

Grtz, DePhille
Title: Re: PHP Taunt maker - [23/05: Azerty support added]
Post by: Shadow G-Unit on July 06, 2007, 02:18:29 pm
I've made a taunt editor already, feel free to use it. The only instruction is to enter the path to the taunts.txt file the first time you run the program.

Here I posted it. (http://forums.soldat.pl/index.php?topic=13922.msg159261#msg159261)
Thanks, you're awesome.