Sephiroth Posted April 29, 2016 Share Posted April 29, 2016 One of the most used lua plugin has to be the chatstyle for client side users. It's an awesome feature, but every time I update both OpenJK and JA++, I always can't restore my chatstyle. It's been over six months that I figured out how to fix it the last time this happened and this time I can't seem to get it working again. So here's everything I know plus, I'll add some screenshots at the end here. Good luck helping me figure this out. Unloaded, reloaded, loaded the lua plugin the first time and didn't work.Found out that there was a message on my console "failed to load "japp/Lua_constrants"Closed JKA for planning to replace core files.Went to the download page and replaced all JA++ files and the lua chatstyle as well.Went to OpenJK and replaced all those files.Deleted both "cg_prefix" and "cg_suffix" from my config and saved it.Opened back up JKA to test everything out.Executed saved configuration file with no issues.Loaded lua chatstyle getting a message that it was already loaded.Then used "lua chatstyle" and got the error provided in the screenshot at the end of the post. Link to comment
Futuza Posted April 29, 2016 Share Posted April 29, 2016 So the error your getting indicates that your chatstyle file has an error in it. It's near the end of the file and most likely you are just missing a brace or have an extra one. Try and open it in a text editor such as notepad++ and see if you can spot the error. Link to comment
Exmirai Posted April 29, 2016 Share Posted April 29, 2016 plugin has several bugs and not working yet :>. I will fix it... Link to comment
Sephiroth Posted April 29, 2016 Author Share Posted April 29, 2016 Thanks for the quick response. I hope fixing the plugin won't cause you too much trouble. I'll await EpicLoyd's fix for now. Link to comment
Raz0r Posted April 30, 2016 Share Posted April 30, 2016 Huh, I've been using chatstyles since its release, and haven't heard complaints from anyone.The issue with not being able to load constants.lua generally indicates you need to update sh_lua.pk3 and/or client binaries Note that chatstyles no longer uses cvars cg_chatPrefix/cg_chatSuffix, in order to support multiple chat styles and switching between them.The only cvar is cg_chatStyle which is a bit-value of chat modes to use a custom chatstyle for (so you can enable it for global chat, but still have regular team/whisper colours) - add together to values of 1, 2 and 4 to enable chatstyles on global, team and whisper chat respectively (so 1+2+4 enables chatstyles on all chat modes) There are a few commands for managing the available styles:chatstyle_create name prefix suffixchatstyle_remove namechatstyle_list You can also control it inline from the chatbox:!chatstyle list!chatstyle name -- use this to select the specified chatstyle!chatstyle -- show which chatstyle is currently being used The chatstyles are stored in <fs_homepath>/<fs_game>/lua/cl/chatstyle/chatstyles.json which is a text file that can give you an idea of what is being saved/loadedThe chatstyle is saved across sessions by storing it in a special case chatstyle named 'current' which simply points to another chatstyle.There is also a special case chatstyle named 'none' that is guaranteed to always exist.If this file becomes corrupt/malformed, it will be reset. The default 'current' chatstyle is 'none' Here is an example chatstyles.json with 3 custom chatstyles (raz, xsn, white) + the default 'none' chatstyle.The currently selected chatstyle is 'white'{ "chatstyles" : [{ "key_type" : 4, "key" : "current", "value_type" : 4, "value" : "white" }, { "key_type" : 4, "key" : "none", "value_type" : 5, "value" : [{ "key_type" : 4, "key" : "prefix", "value_type" : 4, "value" : "" }, { "key_type" : 4, "key" : "suffix", "value_type" : 4, "value" : "" }] }, { "key_type" : 4, "key" : "white", "value_type" : 5, "value" : [{ "key_type" : 4, "key" : "prefix", "value_type" : 4, "value" : "^7" }, { "key_type" : 4, "key" : "suffix", "value_type" : 4, "value" : "" }] }, { "key_type" : 4, "key" : "xsn", "value_type" : 5, "value" : [{ "key_type" : 4, "key" : "prefix", "value_type" : 4, "value" : "^7" }, { "key_type" : 4, "key" : "suffix", "value_type" : 4, "value" : "^0." }] }, { "key_type" : 4, "key" : "raz", "value_type" : 5, "value" : [{ "key_type" : 4, "key" : "prefix", "value_type" : 4, "value" : "^7" }, { "key_type" : 4, "key" : "suffix", "value_type" : 4, "value" : "^8." }] }] } Link to comment
Sephiroth Posted April 30, 2016 Author Share Posted April 30, 2016 Huh, I've been using chatstyles since its release, and haven't heard complaints from anyone.The issue with not being able to load constants.lua generally indicates you need to update sh_lua.pk3 and/or client binaries Note that chatstyles no longer uses cvars cg_chatPrefix/cg_chatSuffix, in order to support multiple chat styles and switching between them.The only cvar is cg_chatStyle which is a bit-value of chat modes to use a custom chatstyle for (so you can enable it for global chat, but still have regular team/whisper colours) - add together to values of 1, 2 and 4 to enable chatstyles on global, team and whisper chat respectively (so 1+2+4 enables chatstyles on all chat modes) There are a few commands for managing the available styles:chatstyle_create name prefix suffixchatstyle_remove namechatstyle_list You can also control it inline from the chatbox:!chatstyle list!chatstyle name -- use this to select the specified chatstyle!chatstyle -- show which chatstyle is currently being used The chatstyles are stored in <fs_homepath>/<fs_game>/lua/cl/chatstyle/chatstyles.json which is a text file that can give you an idea of what is being saved/loadedThe chatstyle is saved across sessions by storing it in a special case chatstyle named 'current' which simply points to another chatstyle.There is also a special case chatstyle named 'none' that is guaranteed to always exist.If this file becomes corrupt/malformed, it will be reset. The default 'current' chatstyle is 'none' Here is an example chatstyles.json with 3 custom chatstyles (raz, xsn, white) + the default 'none' chatstyle.The currently selected chatstyle is 'white' { "chatstyles" : [{ "key_type" : 4, "key" : "current", "value_type" : 4, "value" : "white" }, { "key_type" : 4, "key" : "none", "value_type" : 5, "value" : [{ "key_type" : 4, "key" : "prefix", "value_type" : 4, "value" : "" }, { "key_type" : 4, "key" : "suffix", "value_type" : 4, "value" : "" }] }, { "key_type" : 4, "key" : "white", "value_type" : 5, "value" : [{ "key_type" : 4, "key" : "prefix", "value_type" : 4, "value" : "^7" }, { "key_type" : 4, "key" : "suffix", "value_type" : 4, "value" : "" }] }, { "key_type" : 4, "key" : "xsn", "value_type" : 5, "value" : [{ "key_type" : 4, "key" : "prefix", "value_type" : 4, "value" : "^7" }, { "key_type" : 4, "key" : "suffix", "value_type" : 4, "value" : "^0." }] }, { "key_type" : 4, "key" : "raz", "value_type" : 5, "value" : [{ "key_type" : 4, "key" : "prefix", "value_type" : 4, "value" : "^7" }, { "key_type" : 4, "key" : "suffix", "value_type" : 4, "value" : "^8." }] }] }The "cg_chatstyle" and the "chatstyle_" commands work but, the "!chastyle" commands don't. I spent like two hours on a server trying to figure out how to actually execute the chatstyle once you have it created. I think I have the new chat box enabled if that means I can't access it with Y and use my "bind I messagemodeall" to access the the box near the top that you see in the screenshot that I sent to you when I visited KR through imgur. I still use that same set up but, I don't know if there's a reason why I can't use the chatbox commands that you listed. I sat there looking through the command list trying to see if there was a secret "chatstyle_use" or something like that. I'm very close but, I have no idea what I could be doing wrong to actually use the chatstyle I just created. Please help me. Link to comment
Raz0r Posted May 1, 2016 Share Posted May 1, 2016 cg_newChatbox 1 with bind x messageModeAll should work. Are there any messages that come up when you do /lua_reload? Might help if you show me your chatstyles.json and the exact text you're entering in the chatbox Link to comment
Sephiroth Posted May 1, 2016 Author Share Posted May 1, 2016 Well, I don't know what I did right but I tested it on the JP server and the server I normally go to and it worked. What I did was reloaded it once with no errors and did "!chatstyle name" and it started working just fine. So this topic has been solved. Thanks for your replies. Raz0r likes this Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now