SRB2 Message Board  

Go Back   SRB2 Message Board > Sonic Robo Blast 2 > Releases > Skincolors

Reply
 
Thread Tools
Sendcolor: Players pick their own skincolors! (v6, now with authorship!) Details »»
Sendcolor: Players pick their own skincolors! (v6, now with authorship!)
Version: 6, by Kaysakado Kaysakado is offline
Developer Last Online: Sep 2020

Version: SRB2 Rating: (2 votes - 3.60 average)
Released: 07-11-2020 Last Update: 08-07-2020 Favourites: 0
Scripts Re-Useable Content



This script lets any player send a custom skincolor to the server by using the SENDCOLOR command in the console. You can also download the skincolors uploaded by other players! You can define this color in a text file: sendcolor.txt, placed in the luafiles/client folder in your SRB2 folder. At the bare minimum, the file could be just five lines like this:
Code:
City
48,218,51,221,33,203,203,185,185,185,186,186,186,186,187,187
SKINCOLOR_AZURE
6
V_ORANGEMAP
In order, that's equivalent to name, ramp, invcolor, invshade, and chatcolor, but without the additional syntax you'd use for a Lua or SOC definition. However, you can use those definitions as well, and even pack multiple colors into one file! Check under the spoiler for more detailed formatting information:

Known issue: using a number (possibly other special characters?) as the first character of your color name will cause SRB2 to hang. Until this is sorted out, best to stick to alphabetical characters only
Spoiler:
The sendcolor format boils down to nine lines in your text file:

-autosend
-metadata name
-metadata author
-metadata uploader
-color name
-color ramp
-color invcolor
-color invshade
-color chatcolor

These lines must be in this order, without extra lines in between, or any missing lines - aside from the autosend and metadata, which are optional. Anything after these nine lines (for example, ACCESSIBLE) is not read. You can include multiple colors in one file.

Including #AUTOSEND at the beginning of your definition serves two purposes. When you first join a game, the script will check to see if you have an autosend color in sendcolor.txt. If you do, it will be automatically sent. In addition, when you use the SENDCOLOR command without any arguments, or with the argument -auto, it will search for an autosend color.

Metadata is optional and consists of three lines. If metadata is used, all three lines must be present. All three lines are prepended with the #, used to indicate a SOC comment. The first line simply identifies the color:
Code:
#METADATA = City
You can use a different name than the actual color name, in which case you would use the metadata name rather than the actual name when you SENDCOLOR.

The second line is the author of the color. This will be broadcast when this color is uploaded and saved if another player SAVECOLORs that color. Spaces are allowed, but quotes should be used:
Code:
#AUTHOR = "Big Chungus"
Remember that this line must be accounted for when using metadata, even if there's no author - simply use an empty string:
Code:
#AUTHOR = ""
The third line is the uploader of the color - this is saved automatically when you use SAVECOLOR to save a color someone else uploaded. If you're writing your own metadata, you should leave this blank:
Code:
#UPLOADER = ""
The next five lines are the actual color data. You can generally just copy/paste a SOC or Lua definition in, but there are a few key differences. Most importantly, these five lines must be in the exact order shown in the examples below. For the invcolor and chatcolor fields, you can use either their respective constants, or actual numbers.

Full example, "SOC" style:
Code:
#AUTOSEND
#METADATA = City
#AUTHOR = "kays"
#UPLOADER = ""
NAME = City
RAMP = 48,218,51,221,33,203,203,185,185,185,186,186,186,186,187,187
INVCOLOR = SKINCOLOR_AZURE
INVSHADE = 6
CHATCOLOR = V_ORANGEMAP
ACCESSIBLE = TRUE
Bare bones definition:
Code:
City
48,218,51,221,33,203,203,185,185,185,186,186,186,186,187,187
SKINCOLOR_AZURE
6
V_ORANGEMAP
Using #AUTOSEND without metadata, "Lua" style:
Code:
#AUTOSEND
name = "City",
ramp = {48,218,51,221,33,203,203,185,185,185,186,186,186,186,187,187},
invcolor = SKINCOLOR_AZURE,
invshade = 6,
chatcolor = V_ORANGEMAP,
accessible = true


Check the info under the commands spoiler tag below for details on how to read from different files, choose specific colors, automatically send a color on join, etc.

Commands:
Spoiler:
Code:
********************************
SENDCOLOR [<colorname> [<file>]]
********************************
	Sends a color to the server for use. If used without arguments,
it will look in sendcolor.txt for a color marked with the line #AUTOSEND
above it. Failing that, it will attempt to read a color from the first line
of the file. Otherwise, it will look for the colorname you specify.

	You can specify a file to look in other than sendcolor.txt, but
it must still be in the luafiles/client folder. You can use
"SENDCOLOR -auto <file>" to use the #AUTOSEND behavior
with a specific filename.

	If the color is successfully sent, the script will attempt to
change your color - but only if you're allowed (e.g., not while
moving or in a team game).

******************************
SAVECOLOR <colorname> [<file>]
******************************
	Appends a SOC definition for color <colorname> into your
sendcolor.txt or other specified file. You can use this on any color,
even standard colors or custom colors not loaded through this script.

****************************
SETAUTO <colorname> [<file>]
****************************
	Modifies sendcolor.txt or other specified file to set color <colorname>
as your AUTOSEND. This color should already exist in this file.


Admin commands/variables:
Spoiler:
Code:
*****************************
ALLOWRESEND <-1, 0, or 1-300>
*****************************
	-1: Each player can only send a color once, until ALLOWRESENDPLAYER
or CLEARCOLORS is used. Set by default.

	0: Each player can send a color once per map, unless ALLOWRESENDPLAYER
or CLEARCOLORS is used.

	1-300: Cooldown in seconds between a player sending a color and being
able to send another.

	Note that the server and admins are unaffected by this setting, and
can always send a new color.

******************************
ALLOWRESENDPLAYER <playername>
******************************
	Removes any ban or cooldown on this player, allowing them to send
another color (unless COLORLOCK is enabled).

******************
COLORLOCK <on/off>
******************
	When on, players cannot send colors. The server and admins are
unaffected.

**********************
COLORBAN <player name>
**********************
	Removes the color sent by this player, and prevents them from
sending colors until access is regranted through ALLOWRESENDPLAYER

*******************************
REMOVEPLAYERCOLOR <player name>
*******************************
	Removes the color sent by this player, without explicitly
banning them from sending. Note that depending on your ALLOWRESEND
setting they may still be unable to send another color.

***********
CLEARCOLORS
***********
	Removes all sent colors from the server, and resets all
players' cooldowns, except for those who have been COLORBAN'd.




You are welcome to modify this, pack into other addons, etc.

Spoiler: changelogs
v6:
  • Bug fixes
  • Add metadata for author/uploader

v5:
  • Store multiple colors in one file
  • Specify choice of file
  • Basic SOC/Lua parsing
  • Autosend colors
  • Save colors to text
  • Refactor admin tools
  • Various error catching and optimizations

v4:
  • Sorted out bug where dummy colors would become accessible
  • Added COLORCOOLDOWN
  • "Player added color Color!" message now shows the chatcolor.
  • Freeslot names are more descriptive (SKINCOLOR_SEND0 through SKINCOLOR_SEND31)
  • Better accounting for color name conflicts
  • Removed 0-15 restriction on invshade, since Lua already does modulo on this internally.
  • Accounted for script being loaded multiple times.

Download Now

File Type: lua VL_sendcolor-v6.lua (15.3 KB, 174 views)

Screenshots

Click image for larger version

Name:	srb20233.gif
Views:	2667
Size:	1.28 MB
ID:	34600   Click image for larger version

Name:	srb20234.gif
Views:	2720
Size:	1.37 MB
ID:	34601  

Show Your Support

  • The author of this addon has given explicit permission for its content to be re-used and/or reproduced.

Comments
Old 07-11-2020   #2
D00D64
Probably Responsible
Moderator
 
D00D64's Avatar
Default

It can go into releases, but I would very much like to have a GIF of another player adding their color and it appearing for you. Its strange not having any visual example of the functionality, like other releases.
D00D64 is offline   Reply With Quote
Old 07-11-2020   #3
Kaysakado
Default

GIFs added!
Kaysakado is offline   Reply With Quote
Old 07-12-2020   #4
MellowJacket
The unreliable judge
Judge
 
MellowJacket's Avatar
Default

This is technically a lua file, but with the new skincolor sub-forum I think it makes more sense for this to be in there. So I'll just go ahead and move this over.
__________________
Meanwhile in Aerial Garden Zone
MellowJacket is offline   Reply With Quote
Old 07-12-2020   #5
Kaysakado
Default

Good timing, I was gonna ask if it should be moved here! Anyways, v3 v4 is out:
Spoiler: v4 changelog
  • Sorted out bug where dummy colors would become accessible
  • Added COLORCOOLDOWN
  • "Player added color Color!" message now shows the chatcolor.
  • Freeslot names are more descriptive (SKINCOLOR_SEND0 through SKINCOLOR_SEND31)
  • Better accounting for color name conflicts
  • Removed 0-15 restriction on invshade, since Lua already does modulo on this internally.
  • Accounted for script being loaded multiple times.

Last edited by Kaysakado; 07-12-2020 at 07:59 PM.
Kaysakado is offline   Reply With Quote
Old 07-12-2020   #6
Kaysakado
Default

Sorry for the quick bump - fixed a typo that broke some edge cases with names, so v3 has been retconned to v4.
Kaysakado is offline   Reply With Quote
Old 07-14-2020   #7
Krabs
 
Krabs's Avatar
Default

Incredible work - despite some minor errors, this works perfectly. Honestly invalidates this entire releases category, sans the animated stuff.
__________________
Twitter
Krabs's 24/7 BattleMod: 8.9.30.119
Krabs is offline   Reply With Quote
Old 07-14-2020   #8
PencilVoid
Circuit Enthusiast
 
PencilVoid's Avatar
Default

Would it be possible to have the player automatically send their colour to the server upon joining?
__________________
Discord: PencilVoid#4223; Twitter: @pencilvoid / @pencilvoid_art; Pillowfort: PencilVoid
PSO2 ID: 14909977; Username: PencilVoid

May I interest you in the Church of Audie?
PencilVoid is offline   Reply With Quote
Old 07-15-2020   #9
Kaysakado
Default

Version 5! Check OP for changelog. Attachments still broken, so have a mirror for now: Attachment is up.

Last edited by Kaysakado; 07-16-2020 at 05:15 PM.
Kaysakado is offline   Reply With Quote
Old 07-19-2020   #10
Superjustinbros
AKA Superjustinbros
 
Superjustinbros's Avatar
Default

Would there be a way to increase the number of colors each player could send while still keeping it a relatively low number? I was thinking about four or five colors per player would be useful to help showcase one's roster of colors.
Superjustinbros is online now   Reply With Quote
Old 07-21-2020   #11
Simon100yt
SimonSTHF
Default

Is it possible to send animated colors?
Simon100yt is offline   Reply With Quote
Old 07-21-2020   #12
Krabs
 
Krabs's Avatar
Default

Quote:
Originally Posted by Simon100yt View Post
Is it possible to send animated colors?
No. It's better that way, in my opinion, since there are some memory leak issues with animated colors.
__________________
Twitter
Krabs's 24/7 BattleMod: 8.9.30.119
Krabs is offline   Reply With Quote
Old 07-21-2020   #13
Simon100yt
SimonSTHF
Default

Quote:
Originally Posted by Krabs View Post
No. It's better that way, in my opinion, since there are some memory leak issues with animated colors.
You're right, fair enough.
Simon100yt is offline   Reply With Quote
Old 08-07-2020   #14
Kaysakado
Default

v6 is up! This has various bug-fixes, and adds options for saving the author and uploader of a color. This will probably be the last update, aside from some small adjustments that need to be made when .2.7 drops.
Kaysakado is offline   Reply With Quote
Old 08-07-2020   #15
TehPuertoRicanSpartan
 
TehPuertoRicanSpartan's Avatar
Default

Why does my game freeze everytime I put "sendcolor" on console?
__________________
Quote:
Originally Posted by Silver Sonic View Post
Rude. You could at least use the releases thread and cut the cursing...
Quote:
Originally Posted by Icarus View Post
I agree with Silver on this one, could you please refrain from using cuss words?
TehPuertoRicanSpartan is offline   Reply With Quote
Old 08-07-2020   #16
Kaysakado
Default

Quote:
Originally Posted by TehPuertoRicanSpartan View Post
Why does my game freeze everytime I put "sendcolor" on console?
No clue. Is this only happening with the new version? do you have sendcolor.txt set up?
Kaysakado is offline   Reply With Quote
Old 08-08-2020   #17
SSNCaleb
Hey kid, want some milk?
 
SSNCaleb's Avatar
Default

I guess this can be used to make people see your new skincolors you made.
__________________
Quote:
Venza: why is kitcat there
Tinfoilbot65: good question
SSNCaleb is offline   Reply With Quote
Old 08-10-2020   #18
Lamibe
Default

So it seems that it is possible to freeze the game(SRB2 stopped responding) with this mod with incorrectly formated file(which seems correct).


The cause from it seems to have been found : Actually if the first character of the name is a digit SRB2 stop responding.

Last edited by Lamibe; 08-10-2020 at 09:41 PM.
Lamibe is offline   Reply With Quote
Old 08-11-2020   #19
Kaysakado
Default

Quote:
Originally Posted by Lamibe View Post
So it seems that it is possible to freeze the game(SRB2 stopped responding) with this mod with incorrectly formated file(which seems correct).


The cause from it seems to have been found : Actually if the first character of the name is a digit SRB2 stop responding.
Huh, super weird. Thanks for bringing this to my attention. When I get some free time I'll see if I can sort this out, but for now I'll just make a note not to use special characters as the first character in the OP.
Kaysakado is offline   Reply With Quote
Old 08-12-2020   #20
blacc
 
blacc's Avatar
Default

I keep getting this error message "Invalid value for field ramp" when trying to make a .txt file to send a color to servers. Does anyone know a fix for this?
__________________
sonic you forgot your axe
blacc is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:48 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.