Page 1 of 1
[Solved] Several actions for the same key: possible?
Posted: Sun Jun 25, 2006 3:30
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?
Posted: Sun Jun 25, 2006 4:00
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
Posted: Sun Jun 25, 2006 4:04
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)
Posted: Sun Jun 25, 2006 4:20
by Enjay
See, I was trying that, but I just couldn't get it to work. I was probably typing something incorrectly though.

Posted: Sun Jun 25, 2006 4:24
by Xtife
hmm perhapes gzdoom does do it differently
i seriously thought it was the same system as quake's

Posted: Sun Jun 25, 2006 14:41
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.
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

It was the good oooold time

)
Posted: Sun Jun 25, 2006 15:38
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.
Posted: Sun Jun 25, 2006 15:42
by Phobus
That'll add a bit of spring to your step!
Ok, I'll stop now...
Posted: Sun Jun 25, 2006 17:59
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

(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.

Code pour zoom in and zoom out
Posted: Sun Jun 25, 2006 19:38
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.
Posted: Sun Jun 25, 2006 19:57
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.
Posted: Sun Jun 25, 2006 21:16
by Jive
Ok, I have it:
Code: Select all
alias +usestraf "+use; +strafe"
alias -usestraf "-use; -strafe"
bind mouse2 +usestraf
I resumed everything
HERE
Posted: Tue Jun 27, 2006 2:06
by Xtife
i guess i was right after all
