Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Quake2: Is it possible to bind a command to a key release.

225 views
Skip to first unread message

Jason Koloseike

unread,
Jan 19, 1998, 3:00:00 AM1/19/98
to

Most bind statements attach a command to a key press.
Is it possible to bind a command to a key release?


What I would like to do is bind a zoom command to a
mouse button. Press it, I would zoom in; release it
I would zoom out.

Thank you for any help.

Jason Koloseike
Jason.K...@cognos.com
(613)738-1338 Ext 7090

Alexander Höschele

unread,
Jan 20, 1998, 3:00:00 AM1/20/98
to Jason Koloseike

as far as i know , make it work this way:
bind mouse2 +zoom

and have 2!!! aliases:
+zoom ......
-zoom ......

in this example the commands which were assigned to +zoom are executed
when you press 2nd mouse button and the commands associated with -zoom
are executed when zou release it; at least it works for me that way

hope this helps

Jason Koloseike schrieb:

Morten Wennevik

unread,
Jan 20, 1998, 3:00:00 AM1/20/98
to

Jason Koloseike (Jason.K...@cognosnos.com) wrote:
: Most bind statements attach a command to a key press.

: Is it possible to bind a command to a key release?

Yes, with + and - you can assign actions to both press and release.
Bind a key to a command, and make a + and - alias for that commend.

If you want to use mousebutton 1, you would write
bind mouse1 "zoom
alias +zoom "whatever command it is, maybe fov 170"
alias -zoom "reset the values to default, fov 90"
the config files can't store aliases so you need to write them in a
textfile, for instance zoom.cfg, then exec zoom.cfg to load the aliases.

Good Luck!
Morten

Jason Koloseike

unread,
Jan 20, 1998, 3:00:00 AM1/20/98
to

Thank you to everyone who replied.

On 20 Jan 1998 12:09:01 GMT, mp...@taxus.uib.no (Morten Wennevik)
wrote:


>Yes, with + and - you can assign actions to both press and release.
>Bind a key to a command, and make a + and - alias for that commend.
>
>If you want to use mousebutton 1, you would write
>bind mouse1 "zoom
>alias +zoom "whatever command it is, maybe fov 170"
>alias -zoom "reset the values to default, fov 90"
>the config files can't store aliases so you need to write them in a
>textfile, for instance zoom.cfg, then exec zoom.cfg to load the aliases.
>

It is possible to use the autoexec.cfg for alias and custom bingings.
This file is automatically exec'd by Quake and Quake2 upon startup.

Andreas Baus

unread,
Jan 20, 1998, 3:00:00 AM1/20/98
to

Jason Koloseike (Jason.K...@cognosnos.com) wrote:
: Most bind statements attach a command to a key press.
: Is it possible to bind a command to a key release?

That's indeed possible... If you bind a command whose name starts with a
'+' to a key, then upon pressing that key, that alias will be executed,
and as soon as you release the key, the game will try to execute a command
with the same name, only with a '-' in place of the '+' (if that's a
little confusing, I'll give an example below)

: What I would like to do is bind a zoom command to a


: mouse button. Press it, I would zoom in; release it
: I would zoom out.

Nothing easier than that - here is the appropriate section from my
autoexec.cfg use:

--- CUT HERE ---

alias +zoom "fov 15; set hand 2; set sensitivity 2"
alias -zoom "fov 90; set hand 0; set sensitivity 8"

bind T +zoom

--- CUT HERE ---

What this does is the following: when I press T, the game executes the
'+zoom' alias, setting the fov to 15, reduces mouse sensitivity for
high-precision aiming, and (as a little extra gadget) sets 'handedness' to
'center' (because the offset from left/righthandedness makes exact aiming
a little bit difficult).
When I release T, the game automatically executes '-zoom' to set
everything back to normal.

This works with any pair of '+<alias>' and '-<alias>'... very useful!

--
----
-----------------------------------------------------------------------
"I can't think of anything I'd rather anticipate than have right away, can----
you?" - "Death comes to mind" (Calvin & Hobbes) --

Andreas Baus
an...@fsinfo.cs.uni-sb.de
an...@studcs.uni-sb.de

Chris Butcher

unread,
Jan 22, 1998, 3:00:00 AM1/22/98
to

On Mon, 19 Jan 1998, Jason Koloseike wrote:

> Most bind statements attach a command to a key press.
> Is it possible to bind a command to a key release?
>

If you bind a key to a command that starts with a +, then when you let
go of that key it fires the corresponding - command.

e.g. bind w +forward

executes +forward when you press w, and -forward when you release it.

So, you can do something like this:

alias +myzoom echo "Zoom in"
alias -myzoom echo "Zoom out"
bind z +myzoom

Is that what you're looking for?

--
Chris Butcher "Bother," said Pooh as his
cbut...@atlas.otago.ac.nz flick knife failed to open.


0 new messages