cleolibrary / CLEO-Redux

Experimental JavaScript runtime for GTA 3D era games/GTA IV/Bully
https://re.cleo.li
Other
213 stars 20 forks source link

[Redux SA:DE] - Using Text class has some bugs! #19

Closed nonunknown closed 2 years ago

nonunknown commented 2 years ago

PS: Using javascript

First bug is, every time you call any method from the class Text which creates a text on screen the word missing! appears in front of it:

image

Secong bug is, if your string is too big, the game closes without any crash message:


//Key 117 is F6
var player = new Player(0);
var playerHasControl = player.isControlOn();
var isMenuActive = false;
var CM = {
    showText: function (msg) {
        Text.Print(msg, 500, 0);
    }
};
while (true) {
    if (Pad.IsKeyPressed(117)) {
        if (!isMenuActive) {
            isMenuActive = true;
            CM.showText("hi\0");
            player.setControl(false);
            var i = 0;
            var msg = "";
            while (i < 10) {
                msg += String(i) + " ";
                i++;
                CM.showText(msg);
                wait(500);
            }
        }
        else {
            isMenuActive = false;
            player.setControl(true);
        }
        log("player is being controlled: " + String(player.isControlOn()));
    }
    wait(100);
}

Third bug: Using Text.Display() has no method to clear it() like Help and Print

I took some reading about menus in CLEO and seems you need to create GXT in order to show strings in-game, and to solve that maybe a GXT class should exists? like Text.Print(GXT("any string here"),500,0)

XMDS commented 2 years ago
  1. Use text commands to display "missing" at the end of the string:

All built-in commands of the game cannot directly output strings. It uses the call text to display the string, the parameter of the command is actually the "Key Name" of the string:

03E5  Text.PrintHelp(key: gxt_key)

Key  string
CLEO1  Hello GTA

Text.PrintHelp('CLEO1')

It will display "hello GTA" correctly

If you are a player of the classic GTA trilogy, you should know how to use fxt files to customize text in CLEO. Unfortunately, currently CLEO Redux does not support custom text, so it has this problem. It may take a long time to support.

2.The length of "key name" is too long, causing the game to crash and report an error?

Same as above. "key name" is a short string. It certainly has a length limit.Because it only serves as a name

3.Turn off the subtitles displayed by the DISPLAY_TEXT command?

03F0 USE_TEXT_COMMANDS

Text.UseCommands(state: bool)

1=enable 0=Disable

There are many types of TEXT commands in the game, and they have independent close commands. All text commands with coordinates are closed with 03F0. In addition, when calling the texture command, you need to turn on

GouLiGuoJiaNaive commented 2 years ago

I have a similar problem, SA:DE supports Chinese, but I don’t know what encoding it is, so every time I try to use them, I always get garbled characters.

XMDS commented 2 years ago

I have a similar problem, SA:DE supports Chinese, but I don’t know what encoding it is, so every time I try to use them, I always get garbled characters.

In fact, you cannot use Chinese. Because the name of the current Text command output is "key name", the game only uses English "key name". There is currently no command to directly display custom strings.

The fxt text of the classic GTA is currently not supported. Even if it supports, it is impossible to fill in Chinese directly. As you said, they have different encodings. But I don’t think it is necessary to support Chinese

x87 commented 2 years ago

CLEO 0.8.5 supports FXT for custom text content https://github.com/cleolibrary/CLEO-Redux/blob/master/using-fxt.md