SRB2 Message Board  

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

Reply
 
Thread Tools
Sendcolor: Players pick their own skincolors! (v7) Details »»
Sendcolor: Players pick their own skincolors! (v7)
Version: 7, by Kaysakado Kaysakado is offline
Developer Last Online: Oct 2020

Version: SRB2 Rating: (2 votes - 3.60 average)
Released: 07-11-2020 Last Update: 10-18-2020 Favourites: 1
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
v7:
  • Tiny update for 2.2.8

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 sendcolor-v7.lua (15.1 KB, 64 views)

Screenshots

Click image for larger version

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

Name:	srb20234.gif
Views:	3500
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 08-13-2020   #22
Kaysakado
Default

Quote:
Originally Posted by blacc View Post
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?
Post your txt file, there's probably a missing or extra line in there
Kaysakado is offline   Reply With Quote
Old 08-27-2020   #23
RainbowTH
Your local lua dumbass
 
RainbowTH's Avatar
Default H

Quote:
Originally Posted by blacc View Post
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?
It could be the ramp (as the post above says) but I've gotten the same error when trying to send a color with metadata to a version of Sendcolor that doesn't have such feature in.

The version some servers have is version 2. Please make sure you know what version of sendcolor the server has added. If all else fails, make a copy of the color you wish to send, rid of the metadata, save the .txt (of course) and launch another instance of SRB2 to send it.
__________________
<Rainbow> REEEEEE
RainbowTH is offline   Reply With Quote
Old 09-24-2020   #24
Superjustinbros
AKA Superjustinbros
 
Superjustinbros's Avatar
Default

There have been a few cases lately where I try to send a color to a server only for the game to be unable to read it, and any other instances of me trying to send colors results in getting a "one color per player" error message even if the color would have otherwise worked and the color I sent doesn't appear in the server's list.
Superjustinbros is offline   Reply With Quote
Old 09-24-2020   #25
RainbowTH
Your local lua dumbass
 
RainbowTH's Avatar
Default

The post above yours (which is mine, how ironic) kinda already touched upon that. Try copying the color, getting rid of the metadata, save the txt, load up a second instance of SRB2 to connect there and send it.

"Easy peasy"
__________________
<Rainbow> REEEEEE
RainbowTH is offline   Reply With Quote
Old 3 Weeks Ago   #26
Superjustinbros
AKA Superjustinbros
 
Superjustinbros's Avatar
Default

Got it to work, turns out there was some info I forgot to specify in a color but it's still troublesome when you send an invalid color and you can't try again with another color you have saved.

Anyways I hear that as of 2.2.7, trying to use sendcolors results in the game freezing, thus no servers run it.

Last edited by Superjustinbros; 3 Weeks Ago at 05:09 AM. Reason: Turns out it still crashes in 2.2.8
Superjustinbros is offline   Reply With Quote
Old 3 Weeks Ago   #27
Frostiikin
Insert funny hahas here
 
Frostiikin's Avatar
Default

yeah, as of 2.2.7, trying to send a color causes the game to freeze.
__________________
"B-but I'm already taken, Gale-chan"
-Shine
Frostiikin is offline   Reply With Quote
Old 1 Week Ago   #28
Kaysakado
Default

Sorry for the delay in getting this out, v7 is a tiny one-line fix to make this compatible with 2.2.8 - hoping to get a proper update out with some more QoL stuff later but at least it's usable now!
Kaysakado 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 10:43 AM.


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