[Solved] Several actions for the same key: possible?

Advanced OpenGL source port fork from ZDoom, picking up where ZDoomGL left off.
[Home] [Download] [Git builds (Win)] [Git builds (Mac)] [Wiki] [Repo] [Bugs&Suggestions]

Moderator: Graf Zahl

Locked
User avatar
Jive
Posts: 340
Joined: Sat Mar 11, 2006 23:44
Location: Manaus (Amazonia)
Contact:

[Solved] Several actions for the same key: possible?

Post by Jive »

I need to bind the right button of my mouse with 2 different actions: to open doors AND to straff.
Is there a way to obtain it?
Using the middle button is very uncomfortable, because this button is wheeling each time I use it.

More generally, how it is possible to have several actions for the same key?
Last edited by Jive on Sun Jun 25, 2006 21:17, edited 1 time in total.
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Post by Enjay »

Whilst I don't think you can simply bind multiple actions to a single key, the Zdoom console has a fairly powerful launguage. So, you could probably use that to set up an alias that calls the +use and the +strafe commands (or whatever their syntax is) and then bind a key to your alias. Another option you might want to consider is binding your right button to strafe and use the "doublebind" console command to bind a double-click to +use.

If you want a list of all the console commands, type cmdlist at the console. If you want to store them in a text file, type logfile log.txt first. Check the Zdoom Wiki for further information.

http://www.zdoom.org/wiki/index.php?title=Main_Page
Xtife
Posts: 39
Joined: Wed Nov 02, 2005 23:21

Post by Xtife »

indeed there is, im pretty sure the bind system is very similer to quakes

bind (key) "+use; +strafe"
im pretty sure that should work, though if you dont hold a button down to strafe, but use 2 buttons to go one way or the other, you will still need 2 keys to do this
if that is the case, try this:

bind (key) "+use; +moveleft"
bind (key) "+use; +moveright"

a small walkthrough for making more if you wish :)

Code: Select all

to make a button do more then one thing, you can setup special binds that combine them like this:

bind (key) "command; command" (the ; is required to seperate the commands. must also be contained with quotation marks, and you can have as many commands as you wish confined in that space, the order of the commands is importent aswell depending on what command you wish to be executed first)

you can even make your commands this way. like this
alias (name) "command; command"
bind (key) (new alias name)

you can make a toggle-able alias by adding + to front of the alias name
 and a - to turn it off

alias (+command)
alias (-command)
bind (key) (+command)

and pressing the key again will toggle it off
that will also work with multiple commands aswell

 all aliases must be added to your config file by hand and will not be saved if done at the console ingame (if thats the way gzdoom handles it)
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Post by Enjay »

See, I was trying that, but I just couldn't get it to work. I was probably typing something incorrectly though. :?
Xtife
Posts: 39
Joined: Wed Nov 02, 2005 23:21

Post by Xtife »

hmm perhapes gzdoom does do it differently
i seriously thought it was the same system as quake's :o
User avatar
Jive
Posts: 340
Joined: Sat Mar 11, 2006 23:44
Location: Manaus (Amazonia)
Contact:

Post by Jive »

Enjay wrote:If you want a list of all the console commands, type cmdlist at the console. If you want to store them in a text file, type logfile log.txt first. Check the Zdoom Wiki for further information.
Before asking, I made my own search, I looked deeply in this wiki, and in the documentation attached to zdoom, and I searched here.

What seems to me very strange is that I'm pretty sure to have already seen it somewhere, but I don't remember where. :oops:

For Doom Legacy, they have added a new cvar "bind key = several", some years ago (thanks to my suggestion to Hurdler. At this time, we were very close, and I was the privileged beta tester of all the releases, because of my capacity to track bugs :D It was the good oooold time :cry:)
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Post by Graf Zahl »

Of course you can bind multiple commands to one key.

'bind v "+forward; +jump" is doing exactly what it is supposed to do.
User avatar
Phobus
Posts: 227
Joined: Sat Sep 03, 2005 11:48
Location: Orpington, Kent, England
Contact:

Post by Phobus »

That'll add a bit of spring to your step! ;)

Ok, I'll stop now...
User avatar
Jive
Posts: 340
Joined: Sat Mar 11, 2006 23:44
Location: Manaus (Amazonia)
Contact:

Post by Jive »

Enjay wrote:See, I was trying that, but I just couldn't get it to work. I was probably typing something incorrectly though. :?
Yep, I tried it myself, and I have the same conclusion: don't work!

bind mouse2 "+use; +strafe"

even if I put this line in the "autoexec.cfg" file
:(

Okay, I finally obtained the beginning of a function: mouse2 is opening doors, but my mouse strafe now all the time, even if I don't click!!!

But... I'm now able to zoom and un-zoom :P (I adapted a script made by me for Legacy, replacing "gr_fov" by "fov". The only bad thing is that "playersprite 0" is unknown, so I can't take a screenshot without any sprite for the player on the screen. :cry:
User avatar
Jive
Posts: 340
Joined: Sat Mar 11, 2006 23:44
Location: Manaus (Amazonia)
Contact:

Code pour zoom in and zoom out

Post by Jive »

Code: Select all

alias zoom_in "set_zoom_out; fov 80; wait 1; fov 71; wait 1; fov 62; wait 1; fov 54; wait 1; fov 46; wait 1; fov 39; wait 1; fov 32; wait 1; fov 26; wait 1; fov 20; wait 1; fov 15; wait 1; fov 10"
alias set_zoom_out "bind z zoom_out"
alias zoom_out "set_zoom_in; fov 15; wait 1; fov 20; wait 1; fov 26; wait 1; fov 32; wait 1; fov 39; wait 1; fov 46; wait 1; fov 54; wait 1; fov 62;  wait 1; fov 71;  wait 1; fov 80; wait 1; fov 90" 
alias set_zoom_in "bind z zoom_in"

bind z zoom_in
This code is the content of the file "autoexec.cfg", to put in the same repertory than GZDoom

The result is to zoom while pressing the key "z", and to come back to a normal view while pressing it again.
Last edited by Jive on Sun Jun 25, 2006 20:55, edited 1 time in total.
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Post by Enjay »

Jive wrote:Okay, I finally obtained the beginning of a function: mouse2 is opening doors, but my mouse strafe now all the time, even if I don't click!!!
That's basically the problem I was getting. Either one of the commands was being ignored, or it would get stuck on all the time.

Oh, and you want r_drawplayersprites 0 to hide the weapons.
User avatar
Jive
Posts: 340
Joined: Sat Mar 11, 2006 23:44
Location: Manaus (Amazonia)
Contact:

Post by Jive »

Ok, I have it:

Code: Select all

alias +usestraf "+use; +strafe"
alias -usestraf "-use; -strafe"
bind mouse2 +usestraf
:P

I resumed everything HERE
Xtife
Posts: 39
Joined: Wed Nov 02, 2005 23:21

Post by Xtife »

i guess i was right after all :)
Locked

Return to “GZDoom”