ValveSoftware / halflife

Half-Life 1 engine based games
Other
3.69k stars 624 forks source link

[Feature] Bind toggle and/or incrementvar #3114

Open torriz opened 3 years ago

torriz commented 3 years ago

Would it be possible to implement the toggle (bindtoggle?) or incrementvar feature from Source (HL2, CSGO)?

A VERY convenient command for toggling a Cvar on or off by pressing a single key.

Example usages: toggle bind "j" "toggle volume 0.01 0.23 0"

incrementvar bind "j" "incrementvar volume 0 0.1 1"

There is also a variant called "BindToggle" that I haven't really tested, but according to the Valve developer wiki it functions identically to the incrementvar. BindToggle "j" "sv_cheats" `BindToggle "mouse4" "cl_righthand "

https://developer.valvesoftware.com/wiki/Bind#BindToggle

fysiks1 commented 3 years ago

You can easily create your own toggling bind like this (cl_xhair_style is a cvar in Day of Defeat):

alias xhair0 "cl_xhair_style 0; alias xhair xhair2"
alias xhair2 "cl_xhair_style 2; alias xhair xhair3"
alias xhair3 "cl_xhair_style 3; alias xhair xhair6"
alias xhair6 "cl_xhair_style 6; alias xhair xhair7"
alias xhair7 "cl_xhair_style 7; alias xhair xhair14"
alias xhair14 "cl_xhair_style 14; alias xhair xhair15"
alias xhair15 "cl_xhair_style 15; alias xhair xhair0"
alias xhair xhair7

Works with just about anything that you can alias. For example, I do this for printing admin messages with cycling colors using amx_tsay.

You could probably generate a set of aliases like this to emulate the incrementvar functionalty, it's just a bit tedious.

torriz commented 3 years ago

Replying to https://github.com/ValveSoftware/halflife/issues/3114#issuecomment-873658048

Well, creating aliases isn't the solution to everything. Plus it's automatically removed/disabled/banned from 'competitive CS' f.ex due to having abusive "possibilities".

But thanks for the input

fysiks1 commented 3 years ago

Sure, it might not be the solution to everything (something I never claimed). Can you give an example that can't be done this way?

How would it automatically be removed when it's simply a client-side configuration? Also not sure how any server would be able to know that it exists.

Maxi605 commented 3 years ago

Replying to #3114 (comment)

Well, creating aliases isn't the solution to everything. Plus it's automatically removed/disabled/banned from 'competitive CS' f.ex due to having abusive "possibilities".

But thanks for the input

Well, your idea would also be removed/disabled/banned from 'Competitive CS' since it's quite similar.

torriz commented 3 years ago

Well, your idea would also be removed/disabled/banned from 'Competitive CS' since it's quite similar.

@Maxi605 I don't see how toggling on/off a variable is similar to the aliases, it's just binding two/three keys functions to one key, while aliases can go on forever and do all sorts of stuff.

I'd love to hear more on how it could be abused the same way aliases can though (recoil scripts, bunnyhop, duck spamming etc). Want to share some more insight? Got some ideas/examples that would cause it to be removed/disabled/banned?

@fysiks1 What's your issue with adding it though? If it's that bad/stupid why did they add it in HL2?

Sure, it might not be the solution to everything (something I never claimed). Can you give an example that can't be done this way?

No offense, but I didn't ask for a how to change my crosshair or introduction to creating aliases either though, I simply suggested to add a "nice to have" feature from HL2.

Plus

You could probably generate a set of aliases like this to emulate the incrementvar functionalty, it's just a bit tedious.

Exactly. It's tedious and not user-friendly for a "simple" task like toggling volume on/off or changing crosshair etc..

How would it automatically be removed when it's simply a client-side configuration? Also not sure how any server would be able to know that it exists.

Well for CS it would either just be banned by league administrators or anti-cheat software would automatically remove ALL aliases.

rtxa commented 3 years ago

Good feature but very unlikely to be added in the near future. In case you want info about how to implement this here is the code https://github.com/LevShisterov/BugfixedHL/pull/16/files

fysiks1 commented 3 years ago

@fysiks1 What's your issue with adding it though? If it's that bad/stupid why did they add it in HL2?

I never said I was against adding a new feature. I just happen to know how reality works i.e. it is extremly unlikely to happen (based on the fact that they won't even fix some bugs). So, I was just offering an alternative to waiting forever for this to be implemented.

If you happen to get lucky and they implement it, that's awesome.

metita commented 3 years ago

@fysiks1 In fact we waited since 2013 for updates and did we get some almost 7 years later, there is hope :)

deprale commented 3 years ago

@fysiks1 In fact we waited since 2013 for updates and did we get some almost 7 years later, there is hope :)

Yes but nobody is gonna live their entire life in goldsrc bro, 7 years is a lot for an already arguably dead game. (yes, 10k players doesnt count as an alive game)