Results 1 to 9 of 9

Thread: Binding custom keys to perform action

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Quote Originally Posted by Mitch View Post
    This is how it is done in the plane & tank mod.

    PHP Code:
    self execClientCmd("bind m openscriptmenu -1 m");
    self waittill("key_m"); 
    PHP Code:
    monitorExKeys()
    {
        
    self endon"intermission" );
        
    self endon("disconnect");

        if( 
    isDefinedself.monitorExtraKeys ) )
            return;
        
    self.monitorExtraKeys true;
        
    wait (1);
        if( !
    isDefinedself )  )
            return;
        
        while( 
    isDefinedself )  )
        {
            
    self waittill("menuresponse"menuresponse);

            if(  
    menu == "-1" && isAliveself ) && response.size == )
            {
                
    self notify"key_" response );
            }
        }

    (run on each player)

    But you can also use the supported keys by libcod e.g. space, left/right/up (forward)/down (back) arrows, lean left/right (Q/E) and aim button (left mouse).
    This monitors every key you press right?

  2. #2
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by Ni3ls View Post
    This monitors every key you press right?
    Every key that you bind with 'bind [insert key] openscriptmenu -1 [insert key]'.

    Edit: the libcod keys you need to keep checking in a loop like the use / melee functions.
    Last edited by Mitch; 9th September 2015 at 17:03.

  3. The Following 2 Users Say Thank You to Mitch For This Useful Post:

    kung foo man (10th September 2015),Ni3ls (10th September 2015)

Posting Permissions

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