Comments (5)
Have you tried editing the .ini file with a text editor capable of inserting ASCII control characters ?
You could give a try with Notepad++.
B3 also understand plugin config files expressed as XML files like the two equivalent examples below
[settings]
minplayers: 3
suicide_penalty_percent: 0.05
<configuration>
<settings name="settings">
<set name="minplayers">3</set>
<set name="suicide_penalty_percent">0.05</set>
</settings>
</configuration>
But that won't be a solution in your case as the XML spec forbid the use of ASCII control characters.
Another solution might be modify the CS:GO B3 parser to convert Quake3 color codes into CS:GO color codes.
For reference:
#define S_COLOR_BLACK "^0"
#define S_COLOR_RED "^1"
#define S_COLOR_GREEN "^2"
#define S_COLOR_YELLOW "^3"
#define S_COLOR_BLUE "^4"
#define S_COLOR_CYAN "^5"
#define S_COLOR_MAGENTA "^6"
#define S_COLOR_WHITE "^7"
as found at https://github.com/ioquake/ioq3/blob/master/code/qcommon/q_shared.h#L408
from big-brother-bot.
I propose this patch :
--- csgo.py.org 2014-01-10 20:53:08.960555829 +0100
+++ csgo.py 2014-01-10 20:58:30.340569128 +0100
@@ -591,12 +591,16 @@
return mlist
+ def colorMessage(self, m):
+ return chr(int(m.group(1)))
+
def say(self, msg):
"""\
broadcast a message to all players
"""
if msg and len(msg.strip()):
template = 'sm_say %s'
+ msg = re.sub('\^([2-9])', self.colorMessage, msg)
if "B3 Say" in self.sm_plugins:
template = 'b3_say %s'
else:
@@ -611,6 +615,7 @@
"""
if msg and len(msg.strip()):
template = 'sm_hsay %s'
+ msg = re.sub('\^([2-9])', self.colorMessage, msg)
if "B3 Say" in self.sm_plugins:
template = 'b3_hsay %s'
else:
@@ -626,6 +631,7 @@
if not client.hide: # do not talk to bots
if msg and len(msg.strip()):
template = 'sm_psay #%(guid)s "%(msg)s"'
+ msg = re.sub('\^([2-9])', self.colorMessage, msg)
if "B3 Say" in self.sm_plugins:
template = 'b3_psay #%(guid)s "%(msg)s"'
else:
@@ -1105,4 +1111,4 @@
return matches[0]
else:
# multiple matches, provide suggestions
- return matches
\ No newline at end of file
+ return matches
from big-brother-bot.
can't you make this a pull request against BigbrotherBot/[email protected] ?
from big-brother-bot.
a more DRY implementation would be
@staticmethod
def colorMessage(msg):
return re.sub("\^([2-9)])", lambda m: chr(int(m.group(1))), msg)
then its usage would just be
msg = self.colorMessage(msg)
Is there a reason why you don't convert ^0
and ^1
?
also \x09
is the same as \t
or the horizontal tab character. Is this an issue with CS:GO ?
finally, according to this document the color character needs to be preceded by a space, in that case shouldn't the be
def colorMessage(msg):
return re.sub(" ?\^([2-9])", lambda m: " " + chr(int(m.group(1))), msg)
from big-brother-bot.
Color codes have been removed from the CS:GO parser in this commit: a6cd5cb
I guess we can close this issue as well.
from big-brother-bot.
Related Issues (20)
- B3 Source Mod Plugin is back HOT 3
- redirect stdout crash with KeyError: \'admin\'\\n"' HOT 1
- DB conntion ERROR HOT 10
- Error: Could not parse line no such group HOT 13
- Changing colors HOT 4
- XLRStats Webfront V3 tab-content not loading HOT 1
- Not parsing dark blue (the ";" color code) in MW3
- DB connecting failed HOT 19
- ERROR 'Query failed [SELECT clients.time_edit, MAX(xlr_playerstats.skill) HOT 2
- No error but not working HOT 2
- XLRStats Webfront v3 issue HOT 2
- banlist_v2.dat HOT 1
- B3 on rented gameserver HOT 4
- b3.distribution.ini is the name of config file but b3 expects b3.ini by default HOT 3
- [WOP] Could not parse line no such group
- plugins not working for cod4x HOT 1
- b3 not working
- 'STDERR "ValueError: invalid literal for int() with base 10: \'senioradmin\'\\n"' HOT 1
- B3 Sending multiple messages HOT 4
- B3 Config Generator Web Files - Latest Hosted Somewhere?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from big-brother-bot.