Results 1 to 10 of 26

Thread: key on keyboard

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by goddzila View Post
    Is it possible to bind 5 not to open the menu
    but it is obvious when you're in the game
    For example, while you're in the game you push the button 5 and then you set sentrygun

    or something else
    COD2 only monitors certain keys in the engine - attackbuttonpressed() meleebuttonpressed() usebuttonpressed(). Any other key cannot be detected by the engine. If you want a key such as 5 to be used for something you have to create a work-around, where you use a menu and scriptmenuresponse and monitor for it. And then it is just a single push of the button. The game will not detect you holding a key down for a certain period.

    All this has been posted on this site numerous times. I suggest you get to know the "search" button at the top of the forum, and learn to use it to find all the threads that are on this subject.

  2. #2
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Quote Originally Posted by Tally View Post
    The game will not detect you holding a key down for a certain period.
    Exactly that I wanted to try some days ago and I wasn't able to implement that, though had some nice idea.

    In Counter-Strike Source this is possible:

    PHP Code:
    alias +sens "sensitivity 1"
    alias -sens "sensitivity 3"
    bind alt +sens 
    When pressing "Alt-Key" now, the sensitivity is really slow, hence good aiming on far distance.

    I wanted to make that for CoD 2 starting with:

    PHP Code:
    set +sens "sensitivity 1" 
    That fails already, because cvar-keys are not allowed to have "+" in it. But there is a way around:

    PHP Code:
    // set +sens is not possible, illegal name
    set sens_p "sensitivity 1; say test_a"
    set sens_m "sensitivity 3; say test_b"

    // they didnt check in setfromdvar though :)
    setfromdvar +sens sens_p
    setfromdvar 
    -sens sens_m

    // the actual binding:
    bind o +sens 
    That looked for me, that it could already work, but the result is kinda strange:

    PHP Code:
    // pressing o results in:
    // +sens = "111 -1471273609"
    // -sens = "111 -1471273546"
    // the last number is always random, but often starts with -147 
    Well, "bind o +sens" kinda "executes" a cvar, so I tried stuff like

    PHP Code:
    bind o "vstr +sens" 
    , but that doesn't worked also :S Would be nice if somebody push the idea with +/- further for new state-keys like attackButtonPressed().
    timescale 0.01

  3. #3
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    You can FAKE a button and check if its pressed or not, i'll provide the bind when im at home. However this is not as good and save as useButtonPressed() and its counterparts
    syntax is similar to:
    bind F5 "openscriptmenu test start_f5; +speed; openscriptmenu test stop_f5;-speed"

    speed and some other available in cod2, but not used binds only can be used and not all of them reset themselfes with -speed

    this will trigger a menuresponse when pressed and also when released the F5-key

    as already said, its not this safe and smooth, but it kind of works!

  4. The Following User Says Thank You to serthy For This Useful Post:

    kung foo man (15th January 2014)

  5. #4
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    Quote Originally Posted by serthy View Post
    bind F5 "openscriptmenu test start_f5; +speed; openscriptmenu test stop_f5;-speed"
    correct syntax:

    PHP Code:
    bind F5         "+holdbreath;-holdbreath;openscriptmenu clientcmd custombutton1;-holdbreath"
    bind F6         "+strafe;-strafe;openscriptmenu clientcmd custombutton2;-strafe"
    bind F7         "+speed;-speed;openscriptmenu clientcmd custombutton3;-speed"
    bind F8         "+mlook;-mlook;openscriptmenu clientcmd custombutton4;-mlook" 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •