PDA

View Full Version : Want my console to speak to me!


Codec
03-12-2004, 09:33 AM
I want to be able to output text from the console in an admin mod i'm writing. I can easily display text using iprintln("Hello World!") although i want it to appear in the global chat at the top of the screen so it looks like;

console:blah blah.

NOT at the bottom left. I am aware this can be done using;

say blah blah.

in the console or;

\rcon say blah blah.

remotely, although i want to be able to do this using script.

OldandSlow
03-12-2004, 01:41 PM
The "console: " text comes from typing directly into the game console with the "say" command.

To do that (at least on a Linux server), you need to launch the server program with stdin redirected from a named pipe (FIFO). stdout can be trapped in the same way but you will need to communicate with a program to load the front end of the input pipe.

Without that, you are stuck with "rcon say"...

Codec
03-13-2004, 07:13 AM
Mmmm, I have been advised that there are mods that can do this, I just haven't found one to pull apart yet!!

I am running autokick to get automated messages in the chat area, although I really want to achieve this with a single pk3 so I can use the messages triggered by events. I feel it should be trivial thing to do, just haven't found how to do it.

thejerk
03-13-2004, 11:23 AM
Mmmm, I have been advised that there are mods that can do this, I just haven't found one to pull apart yet!!

I am running autokick to get automated messages in the chat area, although I really want to achieve this with a single pk3 so I can use the messages triggered by events. I feel it should be trivial thing to do, just haven't found how to do it.

Theoretically, you could define the location on the screen where iprintln appears. I could have sworn, anyhow, that I saw this in a mod somewhere (I pull mods apart quite often). Perhaps it might be a good idea to completely define the iprintln function. Are there more fields than the string, perhaps? Is there another function that defines where iprintln and iprintlnbold appears on screen? The trick after determining that is keeping that definition seperate from the basic in-game messages such as kills and objective messages.

I have to do some work on my mod today anyway, so I'll see if I can't figure this out myself. Would be nice to know (I may want to change a couple of my message locations, myself :wink: ).

Codec
03-13-2004, 03:08 PM
I like the sound of where your going there theJerk, not quite what I was after, although it may be a better solution for one of my problems. Had a look and couldn't find anything that performs those functions you asked. Keep me posted and I'll let you know what I find (if anything).

I would still like to know how to send chat messages from the console though. Its been annoying me and I would like to use it in another applications as well.

thejerk
03-13-2004, 04:47 PM
I like the sound of where your going there theJerk, not quite what I was after, although it may be a better solution for one of my problems. Had a look and couldn't find anything that performs those functions you asked. Keep me posted and I'll let you know what I find (if anything).

I would still like to know how to send chat messages from the console though. Its been annoying me and I would like to use it in another applications as well.

I posted at TMT a little while ago asking if anyone knows anything about iprintln and iprintlnbold in the scripting forum (too lazy to include link). I personally haven't had the chance to do anything mod-related as of yet, although I will later before I get my gaming fix in.

Just for the sake of what you're actually asking, perhaps you should stop by autokick.com and ask there. I know Crowking has gotten the "console:" working with AK (although not sure if it's placed where you want yours to show). Post back here if you learn anything, please. :wink:

Codec
03-14-2004, 08:08 AM
Thanks for your time theJerk.

Autokick uses RCON to display console chat messages. This is exactly what I want, but I don't want to use an external program. I want to use a pk3 instead.

I know you can use '\rcon say blah blah' to get what I want from an external program (such as autokick), but I want this triggered from events inside a pk3 (such as a score reaching a specified level for example).

OldandSlow
03-14-2004, 09:42 AM
you might look at one of the mods like "killing spree" that does something similar. It might be a CoDaM plugin, so you might look into that as well.

thejerk
03-14-2004, 12:41 PM
Has there been an update to that script since 12/4? That's the one I have and it uses the same iprintln function as I mentioned before. That basically prints in the same manner as kills.

thejerk
03-14-2004, 04:39 PM
Here's one way:

I believe CoDaM does this with its version number, along with other things.
Demolition also does alot with strings and hud elements as well.

If I remember correctly you have to precache the string and then you can set it as a hud element.

Example from Demolition 96bprecacheString(&"^2Press USE [\{+activate\}] for Demolition Made Easy!");

//jump 4000 lines of code :shock:

specmenu = newClientHudElem(self);
specmenu.archived = false;
specmenu.x = 320;
specmenu.y = 40;
specmenu.alignX = "center";
specmenu.alignY = "middle";
specmenu.fontScale = 2;
specmenu setText(&"^2Press USE [\{+activate\}] for Demolition Made Easy!");

So server messages would have to be hard scripted to be able to be displayed using this method. Unless you can use: message = getcvar("sv_message1");
precacheString(&message);


I dont know of anyother way except making it a hud element. :blink:

I was so caught up in trying to figure out a iprintln that I didn't even think to look at Demo's code for this. I think this would pretty much cover what you're looking to do. :wink:

Codec
03-14-2004, 06:30 PM
Thanks theJerk

Unfortunately it looks like I have been caught up by 'real' work, so this is gonna have to on the back burner for a while. I will try it out when I have an opportunity.

Thanks again for your efforts.

thejerk
03-14-2004, 10:16 PM
Not a problem. Personally, I'm a little disappionted by the lack of functionality in the regular print commands. I don't like having to precache the strings I'm going to use for server messages and whatnot. But this really seems like what you're looking for, which is why I posted it.

I wonder if it's at all possible for us to at some point get IW to give us a decent list of functions and such that we can use in modding, etc. Not having the basic definitions for all of this stuff leaves so many questions, even for the simplest of tasks. If someone else every gets around to my poking around on the internet, I'll post back, but I honestly think I've gotten about as much from everyone else as I'm going to get. In the meantime, if I can ever get back to working on my own mod (mostly just been too lazy to read the code), I'll see if I can figure it out myself. ;)

Good luck!

Codec
03-15-2004, 09:40 AM
I have been advised that IW were going to release the CoD SDK a short while ago, although it was pushed back at the last min for some unknown reason (unknown to me that is). If this is the case I should imagine that it will be making an appearance fairly soon (Fingers crossed).

This of course could be my optimism speaking!

thejerk
03-15-2004, 07:23 PM
This of course could be my optimism speaking!

LOL It's good to be optimistic. I'm still fairly certain that PB will be out by Thanksgiving! :lol:

AADiC
03-18-2004, 11:59 AM
Is this what you are looking for RudeDogs Message Center (http://www.codadmin.com/nuke/modules.php?name=Downloads&d_op=getit&lid=42#dl)

thejerk
03-18-2004, 12:44 PM
Message Center shows up with the list of kills, whereas he was looking for something that showed up elsewhere on the screen.

AADiC
03-18-2004, 01:13 PM
oh :)