Announcement

Collapse
No announcement yet.

Binding Two Keys to One Command?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Binding Two Keys to One Command?

    Hey, I need to know if it's possible to bind two keys on a PSP (Like L+R) to one command?

    So, it would look something like this: bind "L Trigger;R Trigger" "impulse 81"

    Meaning, if I press both triggers at the same time, it would launch the command. However, pressing just one of them wouldn't call for the command.

    Would this be possible for Q1? Or is there a QC file I can add to the source of the mod I'm using to enable it to work?

    If this is not possible, is there a way I could bind a key to load a new set of config.cfg files, like in Team Fortress Quake 1 Mod?

    Thanks!

  • #2
    Originally posted by jastolze View Post
    Meaning, if I press both triggers at the same time, it would launch the command. However, pressing just one of them wouldn't call for the command.
    That would very definitely require engine modifcation to do as you require, unfortunately. The QuakeC is shieleded from the raw inputs very heavily, which makes it so portable; however, on a system with so few keys (basically, anything where you don't have a keyboard), the limited number of keys makes doing anything complicated for clever a bit of a hassle.

    I will say, though, that this is a very good feature request. Even for non-console engines.
    Intelligence is knowing that there is an 'i' in "community".
    Wisdom is knowing that there is no 'i' in "community".

    Comment


    • #3
      Why cant it be put in QC?

      All he needs to do is isolate the buttons
      make an if (both held) condition
      and stuffcmd (i believe) || call a function
      http://www.nextgenquake.com

      Comment


      • #4
        Originally posted by MadGypsy View Post
        Why cant it be put in QC?

        All he needs to do is isolate the buttons
        make an if (both held) condition
        and stuffcmd (i believe) || call a function
        Well, you could, except:

        1: You can't have 2 different impulses happening at once. A single number between 0 and 255 is passed to the QuakeC (.impulse), which handles all inputs that aren't specially handled by the engine.

        2: Most of the other input commands (which take the form of +foo and -foo) are never passed to the QuakeC. The only two that are are +attack (.button0) and +jump (.button2). The code hints that it was intended for a third such input to be availble (+use, as .button1), but this was never implemented. It would be an easy engine change to make this work (as upto 8 such buttons can be implemented without protocol change), but this would limit the mod to only working with your particular engine. Furthermore, you can't simply use .button1 because there are a number of mods still floating around that misuse this field for their own purposes. Most of these were written circa 1997, back when people didn't know how to code properly; although judging by some QuakeC I've looked at recently, some people still don't...

        So you're basically limited to detecting an impulse while either shooting or jumping. Which isn't really what was asked for...
        Intelligence is knowing that there is an 'i' in "community".
        Wisdom is knowing that there is no 'i' in "community".

        Comment


        • #5
          What about a simple switch with a wait. For instance you have:

          a impulse 22
          b impulse 44

          start in Impulse commands looking for 22.
          Code:
          if (22) thinker(), return;
          if (44) return;			//stopping self.impulse from being set to 0
          
          float times;
          
          void()thinker = {
          	if (44) do double button press option, impulse = 0;
          	else
          	{ 
          		if(times>amount || !22) stop checking, impulse = 0; 
          		else check again in a short amount of time, ++times;
          	}
          };
          not exactly simultaneous but it just might work.
          Last edited by MadGypsy; 10-24-2013, 07:39 PM.
          http://www.nextgenquake.com

          Comment


          • #6
            many 3rd-party engines already support +button3 and .button3 etc.

            multiple impulses should be workable
            bind a "impulse 1; wait; impulse 10"
            should always select shotgun, and not axe/next.
            but maybe that went out the window with the rush for higher framerates.

            Try this:
            Console commands (stuffcmd them):
            bind shift +shift
            alias +shift "impulse 51;wait"
            alias -shift "impulse 50;wait"
            bind z +z
            alias +z "impulse 53;wait"
            alias -z "impulse 52;wait"

            QC source:
            if ((self.impuse & 254) == 50)
            shiftdown = self.impulse&1;
            if ((self.impuse & 254) == 52)
            zdown = self.impulse&1;
            if (shiftdown && zdown)
            sprint(self, "omg spam\n");

            You may still loose impulses due to packetloss (yay NQ - just repress the button for the release event to hopefully not get dropped again), but they shouldn't otherwise overwrite. Using this trick you can detect both press and release events, and thus detect when two buttons are held.
            Beware that it cannot distinguish between multiple buttons bound to the same aliases - the first release will effectively release both. The only way to deal with that is to use krimzon_sv_parseclientcommand instead of impulses as that is fully reliable. While it doesn't need client extensions, it does need server support. I'm sure you can figure that part out yourself.
            Some Game Thing

            Comment


            • #7
              that's what's up. Excellent.

              edit: With this technology, you could turn your PSP into like a million "buttons".

              not unlike this
              Last edited by MadGypsy; 10-24-2013, 07:53 PM.
              http://www.nextgenquake.com

              Comment


              • #8
                Using the shoulder buttons as modifier keys, essentially? That would be one way to get more buttons, for sure. Although that would require either an engine modification, or a wrapper running around the engine that can interpret modifier+foo into separate buttons.
                Intelligence is knowing that there is an 'i' in "community".
                Wisdom is knowing that there is no 'i' in "community".

                Comment


                • #9
                  I think yesterday means make a shoulder button change other buttons, kind of like shift. To make it mod friendly, you would have to set up buttons as aliases, then change those aliases when a shoulder button is pressed; such as starting with:

                  bind A +attack
                  bind Shoulder1 Set1

                  then using:

                  alias Set1 "bind A +jump; bind Shoulder1 Set2"
                  alias Set2 "bind A +attack; bind Shoulder1 Set1"

                  If you know how to do +type aliases, then you can get a more shift-button like feel.

                  Comment


                  • #10
                    @zops post - That is the backbone of the controller I posted above, a shift button (3 actually - 1 being a complete controller map shift)
                    http://www.nextgenquake.com

                    Comment

                    Working...
                    X