Forum

Notifications
Clear all

MCPE/Bedrock Chat Emojis and Scripting CLI

McBedrock
(@mcbedrock1)
Illustrious Member Admin

Chat Emojis and Scripting CLI

 

This is an unofficial Minecraft Bedrock Edition chat emoji and gametest Command - Line Interface. This addon enables you to write Unicode emoji and execute JavaScript code in chat as you usually do in browser console. Keep in mind that this is first version of this pack, some bug may appear in any way.

Images Preview:

 

Emoji

There are 4 ways to write the emoji in a chat. First is to type it just like you usually do in casual chat, just insert the emoji to the text box. At first it may appear as question mark symbol (?), no problem, that's normal since Minecraft can't encode those emoji directly. But as soon as you broadcast / send the chat, those symbols will magically be converted to emoji. Keep in mind that this method only works on mobile phone, unless your computer keyboard has emoji button 😀

 

The second way is to write the emoji Unicode prefixed with backslash "u" without quote sign (\u...). You can check each emoji's Unicode by going to  https://unicode.org/emoji/charts/full-emoji-list.html . For example, if I wanna write 😅, then I'm gonna insert "\u1F605" in Minecraft chat textbox (It's case - insensitive by the way, so it doesn't matter if you write it in upper or lower case, it will just result the same). Then when I broadcast the chat, it will be converted to 😅.

The third way is probably the most human-readable way to write it. First you wanna type hash "#" without quote sign of course, followed by the short name of the emoji without space. You can find the short name on  https://unicode.org/emoji/charts/full-emoji-list.html . This one also case - insensitive, but I prefer to use camel case just for easier readability.

All those 3 methods are only for sending message in the chat. To write emoji in a sign, or name tag, or anything else, you have to type it explicitly with its code point. Read next section for more

This pack doesn't include all the Unicode emoji. But don't worry, as the update goes, I'll add more emoji to it. All from 1st to 106th emoji are listed, but some emojis are not listed there, you can check the table I provide in the next section. All emojis bellow 106th is not available yet. And I also provide emoji that I created myself (not listed in Unicode). below are the short names:

Remember to put hash (#) before the short name so that the script knows you decide to write emoji.

Explicitly insert the emoji (scripting)

The fourth method is quite tricky, this is used when you're not broadcasting message via chat. For example, if you're writing on a sign, changing nametag, or any way such that text won't be broadcasted anywhere, so it will not be able to be converted. The way you write it is to explicitly insert the String with code point in such way that resembles the emoji, and it's different from ordinary Unicode emoji code point, and of course keyboard doesn't provide the key for it. If you don't understand this, no problem, just skip this section and go to next method I've provided below :D. Ok first of all, let me show you the table of all the emoji available in this pack.

If you are familiar with programming and JavaScript you can call String.fromCodePoint(....), with that method, you'll get the string from the number you provide in the parameter. The way you specify the number is by using hex, that's why you wanna put "0x" before it, followed by emoji's prefix (check the table, upper left cell is the prefix), then followed by rows and column of the emoji that you wanna covert to. So, in that example, the typescript logo is located at row 1, and column 2, and is prefixed by e3. So, the code will be String.fromCodePoint(0xE312). This function will return string, and that returned string is one that you wanna copy to Minecraft, no matter what the result is. Even though it returns like unknown string (string with question mark symbol), if you code the function correctly, Minecraft should encode the string to emoji that you expect.

Explicitly insert the emoji (without code)

Another way of doing that is by going to  https://wiki.bedrock.dev/concepts/emojis.html#rp-font-glyph-e0-png  navigate to the bottom of the page, then you're gonna find two textboxes. Insert the emoji number that you wanna convert using hex value to the left textbox with the following format: (The table is provided above)

  • first two characters are Emoji prefix (check the table, upper left cell is the prefix)
  • Character in the 3rd position is the row of the table of where the emoji that you wanna encode
  • Character in the 4th position is the table's column

In that example, I wanna encode the emoji located at row 1 and column 2, and it's prefixed by E3. So, I put E312 to the textbox, then I press convert button. Just ignore that String.fromCodePoint if you can't understand. Then the result will be provided on the right textbox. The textbox may not display the emoji, don't worry, just copy the result to Minecraft, and it will be encoded automatically.

Command - Line Interface (CLI) (JavaScript only)

 

This is probably useful for debugging and doing some experiments with gametest. To start scripting mode, type "./gametest" in the chat without quote sign. By doing that, any message that you send will not be broadcasted to another player, it will be executed as JavaScript code. Guess what, you can try encode the emoji there 🙂

All variable you declare will not be saved in disk, so anytime you exit the world, or executing "/reload" command, or stopping the server, can cause all declaration to be lost.

If you write your own js file and wanna access the variables, functions, or objects you declared in there, you can't just access those with the CLI. You have to import your declaration to "packFolder_Behavior/scripts/global.js", then specify the variables that are gonna be accessed on the CLI global scope to the object I've provided there.

Since this is first version of this pack, I don't recommend you to declare variable in global scope using var, let, or const using CLI. Instead use "this" keyword. So, instead of writing "let a = 10", consider writing "this.a = 10". Declaring variable using keyword may work Tho, just in case it's not declared in global scope, try to use "this" keyword.

Declaring function in global scope won't work for time being, I'll try to fix that later. But you can instead declare it using function expression. Writing multiline is impossible since chat will be sent when you press enter. You can use semicolon to give such line break, but this is not recommended since it can cause a bug. Only write semicolon when it's necessary to write it, like if you want to define a function, a class, etc.

Don't ever try to run infinite loop such as while (true), or it might lag very bad and crash your world, I've tried it myself 😀

To end the execution mode, type "./exit" then enter. For that, all of your message you send, will be back to normal behavior.

Known bugs:

AD
  • Declaring function in global scope without using function expression will not work
  • Accessing variable declared in global scope out of this pack (in another pack) will not work
  • There are still many emojis are not added yet
  • Importing global object is required in order for it to be accessed in global scope of the CLI
  • Specifying emoji using Unicode or short name format is only available in chat
  • Writing emoji on a sign, nametag, book and quill will require explicit typing

 

# __ In order for this pack to work properly on your world, you have to turn on at least GameTest Framework experimental features. Other options are optional

# __ Any kinds of modification, re-uploading, changing author name, etc over this content is prohibited

# __ I would appreciate if you send this link instead of direct download link, it supports me to create more content 🙂

# __ Feel free to contact me if you have any problem with this pack (discord : HabibAnwash1447#7305)

AD
creator: Habib_Anwash

 
Quote
Topic starter Posted : 03/07/2022 8:25 pm
Share: