色つきのメッセージ:
Discordは現在自由に色がつけられるコードブロックをロールアルトしています。ANSIカラーコードを使っているため、ターミナルに色つき文字を出力しようとしたことがある人は簡単にできるでしょう。
色つきのメッセージを送るには、コードブロックの言語をansi
にしてこのようなプレフィックスを前につける必要があります:
\u001b[{設定}m
{設定}
には変更する{スタイル}
、{文字色}
、{背景色}
を;
区切りで指定できます。
例:
ReadValue<T>
,ReadString
,ReadPointer
: https://github.com/LiveSplit/LiveSplit/blob/master/LiveSplit/LiveSplit.Core/ComponentUtil/ProcessExtensions.cs
// "address" is an IntPtr to an int value
int intValue = game.ReadValue<int>(address);
// "address" is an IntPtr to a string, "64" is the maximum amount of bytes to read
string strValue = game.ReadString(address, 64);
// "address" is an IntPtr to another address (for example a class)
IntPtr ptrValue = game.ReadPointer(address);
Discord is now slowly rolling out the ability to send colored messages within code blocks. It uses the ANSI color codes, so if you've tried to print colored text in your terminal or console with Python or other languages then it will be easy for you.
To be able to send a colored text, you need to use the ansi
language for your code block and provide a prefix of this format before writing your text:
\u001b[{format};{color}m
Since LiveSplit's official documentation is a work in progress, and I couldn't find another guide for this anywhere else, I decided I would write my own. This will hopefully act as a good reference for getting started and making simple components, de-mystifying the process.
Things you will learn:
- How to set up your Visual Studio project
- How to set up the code structure of your component
- How to create a simple InfoTextComponent (which displays a label on the left, and some text on the right)
#include <stdio.h> | |
#include <string.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <arpa/inet.h> | |
void ping(int s, char *message) | |
{ | |
char buf[8192]; |
the | |
of | |
to | |
and | |
a | |
in | |
is | |
it | |
you | |
that |