PDA

View Full Version : Morning style nametag



Goldace31415
01-03-2017, 02:58 PM
So if you don't know already, Morning's name ingame has a check mark on the left of it, presumably his tag. Whenever he types a new message in chat tho this check changes color and I've been interested in it for quit some time now. I know he is fairly secretive about it so I won't be releasing any code publicly without his permission but if someone could help me out with a few questions I have that would be awesome! I have devised a couple of ways to achieve this effect ingame:

1. Completely random colors
This would involve randomly generating either a letter (A-F) or a number (0-9) and formatting it into a hex to create a truly random color (ex: #FA5C00)
Then you would have to execute sm_customtag "{}HEXCOLORpreferredtag" either every time you type a message or every ____ period of time

2. Random KSF colors
Since KSF has default colors; {1}, {2}, etc. You could randomly generate a number between 1 and the number of presets on ksf
Then sm_customtag "{RNGNUMBER}preferredtag" again either every time you type a message or every ____ period of time

3. Set 2 colors
For example if you only wanted to switch between blue and green, you could have an integer counter or boolean that switches between 1 and 0, or true and false respectively. You could then use an if statement to determine whether to sm_customtag "{}COLOR1preferredtag" or to sm_customtag "{}COLOR2preferredtag" executed after each message.

4. Set colors >2
If you wanted more than two specific colors this can be achieved in the same way as method 3 but an integer counter must be used. For each message you send the counter would have to be increased by one and a different if statement would signify a different colors in the sm_customtag command, executed after each message

5. Random color from list
If you had a list of colors that you liked but didn't care in which order they appeared in, you could have a random number generated from 0 - #of colors and have a separate if statement for each color, executed either after each message or randomly every ___ period of time

As I do have the programming capabilities to achieve this, I have little to no experience with coding in CSS or valve language in general, for all I know there may not be a language that is executable beyond in-game commands. I have looked at a list of over 2000 commands and nowhere in there is a simple random number generator (RNG) or something that can act as a boolean, counter, if statement, or detector for when a message is sent ingame. If anyone knows of a way to program this into the source code of CSS it would be much appreciated! Thanks for taking the time to read :)

EDIT: This could also be done by a third party macro, which I myself do not know how to execute within CSS though

TL;DR: If you know of a way to program the source code of CSS it would be greatly appreciated if you would mind sharing :)

Sundayy
01-03-2017, 04:40 PM
It's just an autohotkey script whenever he press T (default key to open chat) he has a cmd which his colour to change and i think it would be sm_customtag "{XXXXXXX}checkmarkthing" like this with random hex colours
is not that hard..

Crayz
01-03-2017, 05:02 PM
Here's an idea. Write a program that modifies a .cfg file every few seconds with a randomized, formatted sm_customtag value. Rebind y to "exec yourconfig.cfg;default_y_bind", now whenever you press Y to chat it'll apply the randomized color

Goldace
01-03-2017, 05:20 PM
Oh, I see, thanks. welp.png I'll try that to, thanks for the idea Crayz

Spari
01-03-2017, 05:56 PM
edit: sunday posted it before me

Sundayy
01-03-2017, 06:16 PM
:fresh:

tflo
01-05-2017, 02:32 PM
.

Sundayy
01-05-2017, 05:05 PM
morning's script has 9999999999999999999999 colours , making a config with those cmds and with lots of colours will take you ages to write and it will not be random

Crayz
01-05-2017, 08:47 PM
I slapped together some shit for this, it only took a few minutes. I've never used AHK so I don't know if it would have been easier there, but this is probably more extensible. Source is included
https://dl.dropboxusercontent.com/u/96502721/Betashit/RandomConfig.zip

Instructions:
There's a config.txt in the zip. It comes with default values.

First line - Number of milliseconds between each update
Second line - Path to your .cfg file in Source Engine directory (this file wont be created for you, it must already exist)
Any additional lines will be added to a List in the program. The List is iterated each update and replaces occurrences of {rand} with:
{}XXXXXX - x's being a random hex color - then writes those lines to the .cfg file. This lets you do multiple lines like

sm_customtag {rand}SHIT
sm_customname {rand}Jake
Run the .exe
Bind Y to "messagemode; exec yourcfg"

I just realized if {rand} is used multiple times in a single line they will all result in the same color. I can fix it if anybody actually uses this. There's no exception/error catching while parsing the config.txt so modify it carefully. If you mess something up just delete it and restart the program, a new one will be generated.

I haven't even tested this, don't have VIP, so if you try it let me know how it goes

Spari
01-06-2017, 07:31 AM
oh

Sundayy
01-06-2017, 02:33 PM
someone test

Crayz
01-06-2017, 02:54 PM
It's not a gay porn virus, I promise

Sundayy
01-06-2017, 05:48 PM
-rep

Mooster Cow
01-07-2017, 07:18 PM
.

Morning
01-09-2017, 03:48 PM
My script doesn't generate colors. If it did that, 95% of the colors would look terrible.

I have a file containing a list of 100 colors. When the y-key is pressed, it choses a random line (color) from the file, and writes it to a cfg. It then execs the cfg which changes the color of the tag, and lastly it sends the keypress. The script is inactive during typing until enter is pressed.

That's it. It's extremely simple, and you will be able to make your own after like an hour of looking around ahk documentation. (https://autohotkey.com/docs/AutoHotkey.htm)

Goldace
01-21-2017, 10:57 AM
Ya I just friended you on steam but when i bind y it has issues. The program works perfect though thanks! I can manually do (in console): exec rnd (and it switches colors) then i can chat and it will work, but when I bind y "messagemode; exec rnd" it doesnt know what messagemode is and when I do bind y "messagemode";"exec rnd" it doesnt know what rnd is .-. I tried looking it up but found nothing