r/badcode • • Feb 10 '17

other language Too much effort

Post image
123 Upvotes

15 comments sorted by

36

u/WhAtEvErYoUmEaN101 Feb 10 '17

incrementvar? I bet it's the Source Engine

19

u/_getout Feb 10 '17

We have a winner

5

u/gu3st12 Feb 10 '17

Yeah.

I've used a similar command to toggle between 0, 0.5 and 1.0 volume. Handy command :)

22

u/Didaktylos Feb 10 '17

well to be fair, the upper script is from half life 1 engine/cs 1.6 where incrementvar didn't exist

18

u/YMK1234 Feb 10 '17

Plus, how would you do the nice slider thingy?

-2

u/[deleted] Feb 10 '17

I really hope that's not a serious question

20

u/YMK1234 Feb 10 '17

I see you never worked with valve's scripting language, especially pre-source. There is no such thing as ifs and string formats.

3

u/[deleted] Feb 10 '17

I have not, that sounds like the scripting language itself is the bad code

15

u/YMK1234 Feb 10 '17

Well, it is really not meant as a general purpose scripting language ... back in the HL1 days it could really be summarized as "bind a chain of console commands to a key" (including rebinding keys). Which, in 1998, was totally fine and surprisingly versatile, if verbose.

I had a lot of very intricate ones, it gets really funny if you have a multi-level menu-kind of structure bound to your numpad and each command reprograms all keys there (basically think of a manually resolved state engine)

2

u/Prom3th3an Feb 11 '17

Could the bindings trigger other bindings? If so, could you have bindings that didn't actually correspond to any keys? I think if both are true, then it's Turing-complete and could be transpiled from a real programming language.

3

u/[deleted] Feb 11 '17

If I remember correctly, yes, you could call an alias from a bind

9

u/[deleted] Feb 10 '17

I would love to see a proper scripting engine for source. Or just some form of real IPC so you can do things like auto record demos.