Cyrillic characters(Eventscripts Emulator)

All other Source.Python topics and issues.
lphsqr
Junior Member
Posts: 1
Joined: Tue May 08, 2018 9:36 pm

Cyrillic characters(Eventscripts Emulator)

Postby lphsqr » Tue May 08, 2018 9:54 pm

Hello friends. My server has the latest SP. Also set Eventscripts Emulator and WCS mod.
The whole problem I have with the withdrawal of the Russian text to the user.
Example:

Code: Select all

es_centertell event_var(attacker) Высосано server_var(wcs_addhealth) здоровья!
everything is perfectly displayed

Code: Select all

es_tell event_var(userid) #multi #green[WCS]#lightgreenВаша скорость увеличена на: server_var(wcs_speed_var)%

displays: *empty* 65%
I tried all encodings that are only possible (notepad +)


but if I put "text"

Code: Select all

es_tell event_var(userid) #multi "#green[WCS]#lightgreenВаша скорость увеличена на: server_var(wcs_speed_var)%"

Russian text is displayed, 1 problem
displays: Ваша скорость увеличена на: server_var(wcs_speed_var)


that's what I found in the emulator file

Code: Select all

def centertell(argv):
    """Sends a centered HUD message to all players."""
    str_userid = argv[1]
    userid = atoi(str_userid)
    msg = argv.arg_string[len(str_userid)+1:]
    if userid > 0:
        try:
            index = index_from_userid(userid)
        except ValueError:
            return

        TextMsg(msg).send(index)
    else:
        centermsg(msg)


he normally perceives the Cyrillic alphabet

Code: Select all

def tell(argv):
    """Sends HUD message to one player. If the first word of the message is '#green', or '#lightgreen' then the message is displayed in that color. Supports '#multi' also for embedded #green/#lightgreen in the message."""
    try:
        index = index_from_userid(atoi(argv[1]))
    except ValueError:
        return

    SayText2(_prepare_msg(argv, 2, 1)).send(index)

Cyrillic is not displayed here

digging deeper(SP packages files/messages)

Code: Select all

class SayText2(UserMessageCreator):
    """Create a SayText2."""

    message_name = 'SayText2'
    translatable_fields = ['message', 'param1', 'param2', 'param3', 'param4']

    def __init__(
            self, message, index=0, chat=False,
            param1='', param2='', param3='', param4=''):
        """Initialize the SayText2 instance."""
        super().__init__(
            message=message, index=index, chat=chat,
            param1=param1, param2=param2, param3=param3, param4=param4)

    def protobuf(self, buffer, kwargs):
        """Send the SayText2 with protobuf."""
        buffer.set_string('msg_name', ' \x01' + kwargs.message)
        buffer.set_bool('chat', kwargs.chat)
        buffer.set_int32('ent_idx', kwargs.index)
        buffer.add_string('params', kwargs.param1)
        buffer.add_string('params', kwargs.param2)
        buffer.add_string('params', kwargs.param3)
        buffer.add_string('params', kwargs.param4)
        # TODO: Handle textchatall

    def bitbuf(self, buffer, kwargs):
        """Send the SayText2 with bitbuf."""
        buffer.write_byte(kwargs.index)
        buffer.write_byte(kwargs.chat)
        buffer.write_string('\x01' + kwargs.message)
        buffer.write_string(kwargs.param1)
        buffer.write_string(kwargs.param2)
        buffer.write_string(kwargs.param3)
        buffer.write_string(kwargs.param4)

Code: Select all

class TextMsg(UserMessageCreator):
    """Create a TextMsg."""

    message_name = 'TextMsg'
    translatable_fields = ['message', 'param1', 'param2', 'param3', 'param4']

    def __init__(
            self, message, destination=HudDestination.CENTER,
            param1='', param2='', param3='', param4=''):
        """Initialize the TextMsg instance."""
        super().__init__(
            message=message, destination=destination, param1=param1,
            param2=param2, param3=param3, param4=param4)

    def protobuf(self, buffer, kwargs):
        """Send the TextMsg with protobuf."""
        buffer.set_int32('msg_dst', kwargs.destination)
        buffer.add_string('params', kwargs.message)
        buffer.add_string('params', kwargs.param1)
        buffer.add_string('params', kwargs.param2)
        buffer.add_string('params', kwargs.param3)
        buffer.add_string('params', kwargs.param4)

    def bitbuf(self, buffer, kwargs):
        """Send the TextMsg with bitbuf."""
        buffer.write_byte(kwargs.destination)
        buffer.write_string(kwargs.message)
        buffer.write_string(kwargs.param1)
        buffer.write_string(kwargs.param2)
        buffer.write_string(kwargs.param3)
        buffer.write_string(kwargs.param4)


what is the problem? I do not know what to do. Help
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Cyrillic characters(Eventscripts Emulator)

Postby Ayuto » Thu May 17, 2018 7:23 pm

Should be fixed now:
https://github.com/Ayuto/EventScripts-E ... bbee5bf091

Next time please search for an existing issue at first:
https://github.com/Ayuto/EventScripts-Emulator/issues

After you created a new issue for that, I linked it to the original report. But you still continued to report it at 5 or 6 more places. I absolutely hate that...

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 18 guests