Thread: Start recording in Counter-Strike

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    188

    Start recording in Counter-Strike

    Hi!

    I'm making a program which will start Counter-Strike and then automatically record the game. There is a command in-game to record, which is "record <name>".

    steam.exe -applaunch 10 +cl_allowdownload 1 +connect " + ip + " +password " + pw + " +record test
    This is the executable-path i'm using. I don't understand why it doesn't start to record. Because Steam sais in it's manual that you can use all the variable names in this line. If you put a "+" before.
    http://developer.valvesoftware.com/w...ldsource_Games

    What am i doing wrong? Please help me!

  2. #2
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    I don't see what are the "" you put for

  3. #3
    Registered User
    Join Date
    Jun 2003
    Posts
    129
    Look up Process.Start(). There's another function very similarly named that handles arguments too...
    He who asks is a fool for five minutes, but he who does not ask remains a fool forever.

    The fool wonders, the wise man asks. - Benjamin Disraeli

    There are no foolish questions and no man becomes a fool until he has stopped asking questions. Charles Steinmetz

  4. #4
    Registered User
    Join Date
    Jan 2007
    Posts
    188
    Oh, i think you've misunderstood me. I know how to start a process. My question is how to make cstrike.exe start recording a demo since my execute-path doesn't work.

    Btw, here's my code;
    Code:
    string arguments = "-applaunch 10 +cl_allowdownload 1 -32bit +connect " + ip + " +password " + pw + " +record match_demo";
                    Process myProcess = new Process();
                    ProcessStartInfo myProcessStartInfo = new ProcessStartInfo("C:/Program Files/Steam/Steam.exe", arguments);
                    myProcess.StartInfo = myProcessStartInfo;
                    myProcess.Start();
    Last edited by Livijn; 10-28-2008 at 09:38 AM.

  5. #5
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    I suggest running that command manually so you know if the error lies in Steam/the command line or if it's a programmatic error. A quick search on your linked site shows there's no "record" command.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  6. #6
    Registered User
    Join Date
    Jan 2007
    Posts
    188
    hl.exe <parameter1> <parameter2> <cvar1> <cvar2>

    Example;
    hl.exe +sv_lan 1 +mp_startmoney 800

    And record is also a command so it should work, right?

  7. #7
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    There is a huge difference in commands and variables in counterstrike

    For instance, sv_restartround 1 means restart the round in 1 second.

    Setting the players startmoney can be accomplished by using mp_startmoney .

    mp_startmoney is more or less a variable that can be set , so whenever you restart the server it would take this into account (its not like this immediately effects the game state).

    record function exist but i guess it can only be started from the console (since this is not a setting like mp_startmoney).

    What you can do is simulate the keypresses to get to the in game console, simulate the typing of record en hit enter. (requires the game to be running and you have some sort of hook to accomplish this)

  8. #8
    Registered User
    Join Date
    Jan 2007
    Posts
    188
    So, how do i simulate KeyPresses? I did like this;

    Code:
    private void recordDemo()
    {
         SendKeys.Send("{DEL}"); //DEL toggles the console
         SendKeys.Send("record");
         SendKeys.Send("{BACKSPACE}");
         SendKeys.Send("match_demo");
         SendKeys.Send("{ENTER}");
    }
    And after the Process.Start(); I had this;

    Code:
    Thread.Sleep(10000); // 10 seconds
    recordDemo();
    This doesn't seem to work.
    Last edited by Livijn; 10-28-2008 at 04:17 PM.

  9. #9
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    I dont know how to simulate keypresses since I never tried it , I'm just saying that from my experience in setting up a counterstrike server and messing with configs and all sorts of scripts, I just think that adding the record option to exe as param wont work. Maybe have a look at HLTV (halflife tv) maybe theres some sort of api you can use... (probably not since eveyrthing that includes steam screams - more money!!!)

  10. #10
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    You've got your quotes and commands all mixed up (looks like you're attempting to dump symbolic names that didn't get bound to anything "+ ip +"??):
    Code:
    -applaunch 10 -32bit +cl_allowdownload 1 +connect 1.2.3.4 +password mypassword +record match_demo
    Also, why not just use a script? then add "+exec myscript" to the command line options

  11. #11
    Registered User
    Join Date
    Jan 2007
    Posts
    188
    @nthony, i said earlier that those are for this;
    string arguments = "-applaunch 10 +cl_allowdownload 1 -32bit +connect " + ip + " +password " + pw + " +record match_demo";

    Well, i have almost made it.

    EDIT:
    Oh, i'm wrong. I haven't made it. But with this solution, there will be many things that can go wrong. Example: If the person is talking with anyone on steamfriends, this won't work.
    So, is it hard to record via my program instead, like Fraps. Are there any guidelines?
    Last edited by Livijn; 10-29-2008 at 06:54 AM.

  12. #12
    Registered User
    Join Date
    Jan 2007
    Posts
    188
    Any ideas?

  13. #13
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    What exactly are you attempting to do? i.e. what is your goal?

  14. #14
    Registered User
    Join Date
    Jan 2007
    Posts
    188
    Well, in Counter-Strike you can use "Wallhack". I wan't to see if the user is using it. That's why it would much better if the program recorded the screen, because then you can see if he/she is cheating.

    EDIT:
    Check here instead http://cboard.cprogramming.com/showthread.php?t=108701
    Last edited by Livijn; 10-30-2008 at 07:05 AM.

  15. #15
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    Yes, I think a .dem records game state/vars, but not actual visual output, so a recording from a hacked perspective may playback normally from a non-hacked game. I think you're best bet if that is the case would be to use fraps... although if it's not, you can save yourself loads of disk space with your original idea.

    If you're having problems launching the game, using the Steam protocol may help (though it requires they have it installed)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Adventures in labyrinth generation.
    By guesst in forum Game Programming
    Replies: 8
    Last Post: 10-12-2008, 01:30 PM
  2. C++ gui for windows where to start
    By prixone in forum Windows Programming
    Replies: 2
    Last Post: 12-16-2006, 11:48 PM
  3. GNOME Desktop won't start (Mandriva)
    By psychopath in forum Tech Board
    Replies: 10
    Last Post: 07-19-2006, 01:21 PM
  4. WHEN to start game programming
    By mrcheesypants in forum Game Programming
    Replies: 18
    Last Post: 02-02-2006, 04:09 PM
  5. Where is a good place to start?!
    By bobthefish3 in forum Game Programming
    Replies: 1
    Last Post: 10-09-2001, 11:28 AM