r/Tf2Scripts • • Feb 19 '20

Satisfied Counting Style Script?

Is there any way possible to create a script that could count?

Say I hit a bounded key 5 times, I could then hit another key to output : “5” into the chat.

I know part of the “limits of scripting” said that you can’t read or add to values in cVar, but I wondered if there was any sort of loophole.

Probably a dumb question

6 Upvotes

16 comments sorted by

View all comments

Show parent comment

3

u/pdatumoj Feb 20 '20

OK, so, to try to get the functional specification hammered down ...

  • Track which team does more cool stuff overall
  • Announce which team did more cool stuff at end-of-game

So, when it comes to design, there are some things to consider ...

  • Should it really operate two counters, or should it have a single counter which starts at a balanced value and then gets nudged this-way-and-that by events in game? The latter would certainly be simpler and cleaner to implement.*
  • Limits will need to be set for this kind of script ... so it's important to get an idea of what kind of thing you'd classify as such a cool event, or at least how many such things you'd anticipate witnessing in a single game. This will be important for code generation and other decisions ... such as:
  • Output formatting - if you'd want this to be two separate counters for some reason, doing multi-line output as mentioned by u/id-rotatcepS and u/just_a_random_dood would probably make sense, though it'd obviously be subject to interruption by other people's messages.
  • Buttons - if this is for assessing one team vs. the other, you'll need two roughly equally accessible buttons that're not in use for anything else that you can dedicate purely to keeping score. Obviously, you'll also need your output button still ... and a reset button would probably be good too.

Anyway, with that all addressed, you should be well on your way to yelling things like "10 points to gryffindor" in no time.

* I recommend the latter.