Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text operations bug in 1.2.1 #99

Closed
strejda603 opened this issue Aug 15, 2023 · 7 comments
Closed

Text operations bug in 1.2.1 #99

strejda603 opened this issue Aug 15, 2023 · 7 comments
Labels
wontfix This will not be worked on

Comments

@strejda603
Copy link

Hello @x87,

I have noticed, that in 1.2.1 any "Text" operation (Text.PrintBig, Text.PrintHelp, Text.PrintNow...) from "CLEO_TEXT" (from .fxt files) doesn't work - maybe there is some problem with reading .fxt files...

If I use some text defined in main .gxt file, then it works.. Could you try to fix it? It worked good in 1.2.0

Thank you!

@x87
Copy link
Contributor

x87 commented Aug 15, 2023

Can you provide more details? What game? Show code and cleo_redux.log

@strejda603
Copy link
Author

strejda603 commented Aug 15, 2023

Can you provide more details? What game? Show code and cleo_redux.log

Sure, sorry, my bad... It's GTA Vice City (Classic) and I use CLEO Redux (v1.2.1) coexisting with Standard CLEO (v2.0.0.6).. My cleo_redux.log shows nothing wrong...

Here is my code:

/// <reference path=".config/vc.d.ts" />
/**
 *  AUTHOR: strejda603
 *  DATE: 19.07.2023
 */

import { KeyCode } from "./.config/enums";
import { atFeet } from "./includes/functions";

if (HOST !== "vc" && HOST !== "reVC") {
  exit("Sorry, this script is for GTA VC only");
}

let player = new Player(0);

/* Locations */
const oceanHotel = { x: 230.93, y: -1302.19, z: 10.0, r: 1.0 };
const malibu = { x: 498.33, y: -112.99, z: 10.0419, r: 1.0 };
const marina = { x: -173.788, y: -1431.45, z: 10.0419, r: 1.0 };
const washPetrolNext = { x: 73.7581, y: -1120.41, z: 10.0419, r: 1.0 };
const nbTools = { x: 209.124, y: -459.234, z: 11.2419, r: 1.0 };
const cherryPoppers = { x: -857.876, y: -526.834, z: 10.5419, r: 1.0 };
const haitiPnS = { x: -813.366, y: -23.8005, z: 10.2671, r: 1.0 };
const bikersBar = { x: -547.466, y: 679.4, z: 10.2671, r: 1.0 };
const crocsBar = { x: -1086.782, y: 127.561, z: 11.2731, r: 1.0 };
const washShop = { x: 139.7062, y: -904.8914, z: 10.556, r: 1.0 };
const washPetrolShop = {
  x: 48.523,
  y: -1078.4673,
  z: 10.4633,
  r: { x: 2.0, y: 2.0, z: 1.0 },
};

main: while (true) {
  wait(100);

  let currentMoney = player.storeScore();
  let deposit = 0;

  /* I was testing to "inject" strings directly, but it doesn't work either */
  // FxtStore.insert(
  //   "atm1",
  //   "~h~Press the ~k~~PED_ANSWER_PHONE~ to deposit money in the bank."
  // );
  // FxtStore.insert("atm2", "Money is transfering. Please wait.");
  // FxtStore.insert(
  //   "atm3",
  //   "You have taken all the money from the bank, transaction costs have been decreased and interest is received."
  // );
  // FxtStore.insert(
  //   "atm4",
  //   "Money is in the bank. You can come and take it whenever you want."
  // );

  if (player.isPlaying() && !ONMISSION) {
    wait(50);

    if (
      (atFeet(player, oceanHotel) ||
        atFeet(player, malibu) ||
        atFeet(player, marina) ||
        atFeet(player, washPetrolNext) ||
        atFeet(player, nbTools) ||
        atFeet(player, cherryPoppers) ||
        atFeet(player, haitiPnS) ||
        atFeet(player, bikersBar) ||
        atFeet(player, crocsBar) ||
        atFeet(player, washShop) ||
        atFeet(player, washPetrolShop)) &&
      currentMoney > 19
    ) {
/*******************************************************************************/
      Text.PrintNow("bnkng1", 5000, 1); // doesn't show (used to work in 1.2.0) - depends on "banking.fxt", which loads fine according to logs
      // Text.PrintNow("atm1", 5000, 1); // doesn't show either
      // Text.PrintNow("ROCK_4", 5000, 1); // works
/*******************************************************************************/

      while (true) {
        wait(0);

        if (Pad.IsButtonPressed(0, 4)) {
          player.setControl(false);
          getHelp();

          while (true) {
            wait(50);

            // increase
            if (
              Pad.IsButtonPressed(0, 15) &&
              currentMoney > 19
              // && deposit < 99999
            ) {
              if (Pad.IsButtonPressed(0, 4)) {
                deposit += 1000;
                player.addScore(-1000);
              } else {
                deposit += 10;
                player.addScore(-10);
              }
            }

            // decrease
            if (Pad.IsButtonPressed(0, 16) && deposit > 19) {
              if (Pad.IsButtonPressed(0, 4)) {
                deposit -= 1000;
                player.addScore(1000);
              } else {
                deposit -= 10;
                player.addScore(-10);
              }
            }

            // help
            if (Pad.IsKeyPressed(KeyCode.H)) {
              getHelp();
            }

            // withdraw
            if (Pad.IsButtonPressed(0, 17) && deposit > 19) {
              player.addScore(deposit);
              Text.ClearHelp();
              Text.PrintNow("bnkng5", 10000, 1);
              // Text.PrintNow("atm2", 10000, 1);

              let account = IniFile.ReadInt("cleo/atm.ini", "INVEST", "Money"); // 2@
              IniFile.WriteInt(0, "cleo/atm.ini", "INVEST", "Money");
              player.addScore(account);

              wait(100);
              player.setControl(true);

              Text.PrintNow("bnkng4", 5000, 1);
              // Text.PrintNow("atm3", 5000, 1);
              showTextBox(
                `~w~Now you have ~b~$${money(
                  IniFile.ReadInt("cleo/atm.ini", "INVEST", "Money")
                )}~w~ on your account.`
              );

              deposit = 0;
              wait(5000);

              continue main;
            }

            // exit
            if (Pad.IsButtonPressed(0, 14)) {
              if (deposit > 19) {
                let account = IniFile.ReadInt(
                  "cleo/atm.ini",
                  "INVEST",
                  "Money"
                ); // 2@
                account += deposit;
                IniFile.WriteInt(account, "cleo/atm.ini", "INVEST", "Money");
              }
              wait(100);
              player.setControl(true);

              Text.ClearHelp();
              Text.PrintNow("bnkng3", 5000, 1);
              // Text.PrintNow("atm4", 5000, 1);
              showTextBox(
                `~w~Now you have ~b~$${money(
                  IniFile.ReadInt("cleo/atm.ini", "INVEST", "Money")
                )}~w~ on your account.`
              );

              deposit = 0;
              FxtStore.delete("atm1");
              FxtStore.delete("atm2");
              FxtStore.delete("atm3");
              FxtStore.delete("atm4");
              // wait(3000);

              continue main;
            }
          }
        }

        if (
          !atFeet(player, oceanHotel) ||
          !atFeet(player, malibu) ||
          !atFeet(player, marina) ||
          !atFeet(player, washPetrolNext) ||
          !atFeet(player, nbTools) ||
          !atFeet(player, cherryPoppers) ||
          !atFeet(player, haitiPnS) ||
          !atFeet(player, bikersBar) ||
          !atFeet(player, crocsBar) ||
          !atFeet(player, washShop) ||
          !atFeet(player, washPetrolShop)
        ) {
          // Text.ClearHelp();
          // Text.ClearPrints();
          // FxtStore.delete("atm1");
          // FxtStore.delete("atm2");
          // FxtStore.delete("atm3");
          // FxtStore.delete("atm4");

          continue main;
        }
      }
    }
  }
}

// Functions
/**
 * @param {number} x
 * @returns {string}
 */
function money(x) {
  return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}

/** Show text box with help */
function getHelp() {
  return showTextBox(
    `~h~Press ~k~~VEHICLE_ENTER_EXIT~ to ~t~increase~h~, ~k~~PED_SPRINT~ to ~y~decrease~h~, ~k~~PED_FIREWEAPON~ to ~b~get all~h~ your money from the bank, ~k~~PED_JUMPING~ to ~o~exit~h~. To show this message press ~p~H~h~.`
  );
}

@x87
Copy link
Contributor

x87 commented Aug 16, 2023

I cannot reproduce this issue. I took fresh GTA VC from steam, downgraded to 1.0, installed VC.CLEO 2.0.0.6, CLEO Redux 1.2.1 and SilentPatch.

This is my test script:

Text.PrintNow("TEST", 5000, 1);

this is my FXT (CLEO_TEXT\1.fxt)

TEST This is a test message

I can see "This is a test message" when I run the game.

Try disabling ALL scripts and FXT files, and test with a single JS script & single FXT file. Would it work?

@x87
Copy link
Contributor

x87 commented Aug 16, 2023

Also question: does it work with this build #98 (comment) ?

@strejda603
Copy link
Author

Honestly, I have no clue, what is wrong... It used to work, I did nothing (just played the game, and updated CLEO Redux from 1.2.0 to 1.2.1), and it just stopped working.. I tried to disable all scripts, modloader, etc. and left just VC.CLEO 2.0.0.6, CLEO Redux 1.2.1 and SilentPatch on, even start new game: no luck...

Also question: does it work with this build #98 (comment) ?

No, it doesn't. And now, even v1.2.0 doesn't work..

It's strange, everything other work just fine, and only displaying text from FXT files doesn't...

I'm trying to combine Ultra Mod with Extended Features Mod. Here is my whole Vice City folder (and a save file). If you have some time, could you please try to look at it? Maybe you'll notice something I won't..

Thank you very much!

@x87
Copy link
Contributor

x87 commented Aug 23, 2023

Delete ZMenuVC or make it so its ASI file loads BEFORE cleo_redux.asi. ZMenu overwrites hooks in CText::Get and does not call them back

@x87 x87 added the wontfix This will not be worked on label Aug 23, 2023
@strejda603
Copy link
Author

Thank you for your help! I renamed "ZMenuVC.asi" to "1ZMenuVC.asi" to load before CLEO Redux, and it works great.

@x87 x87 closed this as completed Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants