[SCR] Multi-user chat in-game via X-DEVNET: ALPHA release.

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

User avatar
AtomicDryad
Posts: 209
Joined: Sat, 19. Jan 08, 01:04

[SCR] Multi-user chat in-game via X-DEVNET: ALPHA release.

Post by AtomicDryad »

MODERATORS: This requires the user to configure his egosoft username / password. If any of you know perl, please give this a look-over and a thumbs up that it is safe :P

DESCRIPTION
I'm releasing this early due to possible busyness in the near future, however despite my desire to rewrite the entire thing it's stable and works.

With this, you can chat on X-DEVNET (the Egosoft chatroom) from within X3TC. It's basically 2 in-game scripts and a perl script that I wrote up one night to see if it could be done, and have been sporadically optimizing etc since.

This was developed in Cygwin (unix for windows), however I have found a portable perl runtime that doesn't need installation, and the daemon appears to run fine from that. If you use cygwin, all you need are 'togame.pl', 'CONFIG.txt', and the 'ipc' dir.

FEATURES
If the message is on a particular dev level it will show that. Will add support for writing to devlevel Real Soon Now.
Multiple methods of putting chat in the background:
[ EXIT ] will terminate the in-game chat parser, saving precious cpu cycles.
[ MINIMIZE ] (or hitting esc): In this, the parser still runs, but skips over things like folding lines. Thus, you will get an in-game message if someone sends you a private message. You will also see the message (and any public message containing your username) as a subtitle.

[ external image ]

http://fnord.to/x3/x3chat-r1.zip

HOWTO USE:
Unzip zip into your gamedir.
Edit chat\CONFIG.txt and replace user/pass with the appropriate.
If your game is not english, change lang=44 to appropriate.
Copy chat\scripts\*.* to your scripts dir.
Run x3chat.bat.
Run game, configure X-DEVNET chat hotkey.
Hit hotkey, click [ LOGIN ], wait up to 10 seconds, and you should be in.

[ SAY ] takes the following arguments:
/msg username whatever
/ me poses.
/who
/logout
'g whatever' will spew out the first 20 google results of 'whatever'. Clicking on a line will spit the url out into public chat.

Selecting a user's chat line and hitting enter will write your message as:
@User blah blah blah
Selecting a privmsg and hitting enter will compose a private message to the user.

If you're running in cygwin, !command will exec a system command, ie: !df


CAVEATS:
+ This is an ALPHA because: the perl script should be more modular, the entire 512-line buffer is re-read by the in-game daemon, and stuff like OPTIONS, etc, are not done. Still, I have not noticed any slowdown caused by the daemon, and have ran the thing in foreground mode for 10+ hours.
+ EXIT does not log you out of chat. Exiting the game does not log you out of chat. [ LOGOFF ] in-game will log you out, and closing the x3chat.bat program will.
+ I'm a FRACKING NOOB who has used this to learn about X3's task allocation system, and may have made silly mistakes writing the in-game client/server system.
+ This should probably be an AL script. See above.

HOW THIS WORKS:
The perl script rewrites a T-file (9123) and reads a logfile (log23230.txt).

TODO:
Rewrite:
Each input line should be split into multiple t-file entries, with timestamp / flags / content / etc, so the in-game daemon doesn't have to parse TYPE:TIMESTAMP:RETVAL:FLAGS:!:!:STUFF FROM CHAT.
Perl daemon should helpfully point out the buffer index of new messages, which means x3 daemon should spew timestamps often (possibly worse for performance).
Optional google translate of DE txt ;>
More features.
Really dumbed down webbrowsing.
IRC.
Instant messengers.
x3rpm revival.
User avatar
Tycow
Posts: 2141
Joined: Wed, 6. Nov 02, 20:31
x4

Post by Tycow »

Installed and works fine with Steam version of Terran Conflict. :D
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22430
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow »

would it be better to put the chat messages as info lines, then u'll have the options appear at the bottom in a seperate sections.

plus, it would be inline with most other chat clients that have the text/cmd box at the bottom
User avatar
AtomicDryad
Posts: 209
Joined: Sat, 19. Jan 08, 01:04

Post by AtomicDryad »

Cycrow wrote:would it be better to put the chat messages as info lines, then u'll have the options appear at the bottom in a seperate sections.

plus, it would be inline with most other chat clients that have the text/cmd box at the bottom
I started to shun infolines as they tend to muck up scrolling (unless there's a way around that). That layout would also need an ascending order of chatlines, and I'm not sure how to make it scrolled down by default.
Mad_CatMk2
Posts: 518
Joined: Sun, 22. Feb 09, 20:13
x4

Post by Mad_CatMk2 »

Hmm, when I try using the chat, I get a Readtext in the far right of the LOGIN line.

I've noticed that (since my game is in the program files folder in Win 7) does that mess up privileges?
I fly an OWP. What about you?
User avatar
AtomicDryad
Posts: 209
Joined: Sat, 19. Jan 08, 01:04

Post by AtomicDryad »

It might be bad pems on the t-file if the script creates it. Try adjusting the privs; after it's created they should remain even after the perl script rebuilds the file.
Make sure you change LANG from 44 to whatever if the game isnt english.
If that doesnt help, send me t/9123-L44.xml
Last edited by AtomicDryad on Sun, 2. May 10, 12:52, edited 1 time in total.
DannyDSC
Posts: 7070
Joined: Sun, 5. Dec 04, 20:32
x4

Post by DannyDSC »

useful! very very nice work!
The Indie Seeker - The Twitter Channel for your indiegames!

Ex Egosoft Translator/Currently writer for www.ilvideogioco.com

@IlVideogiococom is the ONLY italian website that offers full coverage to ALL #indiegames! Are you an #indiedev?
Feel free to follow and contact us on Twitter/Facebook/Instagram!
User avatar
AtomicDryad
Posts: 209
Joined: Sat, 19. Jan 08, 01:04

Post by AtomicDryad »

DannyD wrote:useful! very very nice work!
Thanks. If I dont respond in chat it's because I keep forgetting to terminate the damon when I stop playing. I should probably add a means of detecting if the game is running.
User avatar
Samuel Creshal
Posts: 17833
Joined: Sat, 6. Mar 04, 16:38
x3tc

Post by Samuel Creshal »

Could anyone re-upload the script?

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”