TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

PHP causes numpad-keys (and much more) to misbehave

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
F-3000



Joined: 06 Dec 2010
Posts: 66
Location: Next to polarbear

PostPosted: Mon Dec 06, 2010 12:33 pm    Post subject: PHP causes numpad-keys (and much more) to misbehave Reply with quote

Hi!

First off, thanks for this nice piece. I haven't found anything as useful for Ubuntu so far - although I stopped searching after trying this out (again, first time was on Mac, some years ago). Even it requires (learning of and) tweaking of xterm to get to work as supposed to, it beats KildClient.

Sadly, I have found a thing that renders some of it's functionality (thru PHP) useless. In both 1.99.3 (installed thru Synaptic) and 2.00.4 (manually installed) when using #script php, about half of the keys change behavior, if the script contains certain commands.

Behavior is quite similar with gnome-terminal and xterm.

Normally in xterm, while Alt/NumLock Modifiers is turned off, numpad 8 (as an example) produces \eOx. But after running a PHP script with certain commands, numpad 8 will produce ^[Ox. And if I press return while there is this ^[Ox, \eOx will be printed as blue, and it reacts as I would have pressed numpad 8 with proper behavior.

Example. I have macro that sends "north" to the mud, if I press kpd8. If I run a script that causes misbehavior, pressing kpd8 does no longer send that "north" to the mud, instead it prints ^[Ox on prompt line. Now, if on this situation I press enter, the mud will receive "north".

Here's what I use to call the php-script:
Code:
#action {^Abandon hope, all ye who enter here...$} {#script php ~/Asiakirjat/fl\ kamaa/php/start_logger.php $character}


Here is content of the php-script:
Code:
<?php

$file="./Asiakirjat/fl kamaa/logs/".date("Y")."/".$argv[1]." ".date("m-d");
//$file2=str_replace(" ","\\ ",$file);
//if(!file_exists($file2))exec('touch '.$file2);
echo '#log {a} {'.$file.'};';
//echo '#showme <818>Logging...';

?>

I had temporarily commented out three lines to dig out about what in this script caused the screw-up, and it was the echo, which turned logging on.

Another php-script that would be nice, but is unusable due to this misbehavior:
Code:
<?php

// sound_player.php
$path='/usr/share/sounds/speech-dispatcher/test.wav';
if(isset($argv[1]))$path=$argv[1];
exec('aplay -q '.$path.' > /dev/null &');

?>

I've rounded the problem with abovementioned script with this, which works just fine:
Code:
#action {%1 tells you '%2'$} {#system aplay -q /usr/share/sounds/speech-dispatcher/test.wav &}

(annoyingly, the & is required at the end of the shell-command, or tt++ will halt until sound stops playing)


If Alt/NumLock Modifiers is on, the misbehavior does not affect keypad.

Keys that stop working properly:
F1-F12
Numpad
Arrow-keys
Insert, Del, home, end, page up, page down
Esc

Plus their shift/ctrl equivalents. I don't know about Print screen, Pause or Screen lock, since I'm using Apple's keyboard (attached to my laptop) with keys F13-F15. Their behavior seems to be per-application.

ACTIONs DEBUGged gives just this:
Code:
#DEBUG ACTION {^Abandon hope, all ye who enter here...$}
[02] script php ~/Asiakirjat/fl\ kamaa/php/start_logger.php $character
[02] log {a} {./Asiakirjat/fl kamaa/logs/2010/charname 12-6}


I'll need to round the bug with ALIAS (with manually given date) while waiting for fix.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3796

PostPosted: Mon Dec 06, 2010 2:17 pm    Post subject: Reply with quote

Looks like php alters the terminal settings and doesn't restore them on exit.

I've updated the beta so it'll restore the default terminal settings after a call to #script or #system.

Beta is available here: http://tintin.sf.net/download/tintin-beta.tar.gz
Back to top
View user's profile Send private message Send e-mail
F-3000



Joined: 06 Dec 2010
Posts: 66
Location: Next to polarbear

PostPosted: Mon Dec 06, 2010 3:20 pm    Post subject: Reply with quote

So, it's really PHP's fault? That sucks. But it's great if you can do something about it. I'll give the beta a test shot tomorrow (or wednesday), and will let you know how things go for me. Thanks for the quick response.

Thumbs Up
Back to top
View user's profile Send private message Visit poster's website AIM Address
F-3000



Joined: 06 Dec 2010
Posts: 66
Location: Next to polarbear

PostPosted: Tue Dec 07, 2010 3:18 am    Post subject: Reply with quote

After quick test, works flawless. Thank you for your efforts.

Can the repository version of tt++ for Ubuntu be updated as well? It's dragging behind badly with version 1.99.3. I was able to cut out the "touch"-part of the logging PHP-script, since #log in 2.00.4 (beta at least) is able to create the actual file if it doesn't exist.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3796

PostPosted: Tue Dec 07, 2010 8:29 am    Post subject: Reply with quote

I'm not a maintainer of the Ubuntu packages.

Guess I could look into using launchpad, but I'm unfamiliar with the process.
Back to top
View user's profile Send private message Send e-mail
F-3000



Joined: 06 Dec 2010
Posts: 66
Location: Next to polarbear

PostPosted: Sun May 29, 2011 7:30 am    Post subject: Reply with quote

Bad news Scandum. Yesterday I updated my Ubuntu distro from 9.10 to 10.4, and today I ran into the problem I had earlier: PHP screws the keyboard behavior.

I got TT 2.0.0.6 (beta?).
Back to top
View user's profile Send private message Visit poster's website AIM Address
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3796

PostPosted: Sun May 29, 2011 9:35 pm    Post subject: Reply with quote

Is this caused by #script, or by #run / #system ?

The terminal restore is still in place for #script.
Back to top
View user's profile Send private message Send e-mail
F-3000



Joined: 06 Dec 2010
Posts: 66
Location: Next to polarbear

PostPosted: Mon May 30, 2011 2:06 am    Post subject: Reply with quote

Scandum wrote:
Is this caused by #script, or by #run / #system ?

The terminal restore is still in place for #script.

I believe it's #script, but I'll check that out.
Back to top
View user's profile Send private message Visit poster's website AIM Address
F-3000



Joined: 06 Dec 2010
Posts: 66
Location: Next to polarbear

PostPosted: Mon May 30, 2011 2:31 am    Post subject: Reply with quote

Yeps, it was #script. I'll test if #system produces same problem.

[Edit] #system causes same.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3796

PostPosted: Mon May 30, 2011 10:30 am    Post subject: Reply with quote

Alright, I'll look into it when I got time.
Back to top
View user's profile Send private message Send e-mail
F-3000



Joined: 06 Dec 2010
Posts: 66
Location: Next to polarbear

PostPosted: Tue May 31, 2011 2:24 pm    Post subject: Reply with quote

F-3000 wrote:
#system causes same.

I was wrong. #system doesn't cause any misbehavior, only #script. I made a double-check, and for a good reason it seems.
Back to top
View user's profile Send private message Visit poster's website AIM Address
F-3000



Joined: 06 Dec 2010
Posts: 66
Location: Next to polarbear

PostPosted: Tue May 31, 2011 3:27 pm    Post subject: Reply with quote

For a record: When Ubuntu distro is upgraded, Tintin++ is downgraded to match the version offered thru repository.

My problems were due to that.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group