bodzio528 / FS22_CropRotation

mod for Farming Simulator 22
47 stars 15 forks source link

Ingame Help Menu not loading completely #37

Closed DreiFingerJoe closed 11 months ago

DreiFingerJoe commented 1 year ago

Hello, when crop rotation is in mod folder any ingame help menu after cr in alphabet will not be loaded.

Gordon-Dry commented 1 year ago

Oh, that is interesting. Testing this by changing the mod folder's name to FS22_zz4_CropRotation (I already got zz1 to zz3 over there) to check the issue with another mod's help menu not appearing.

Gordon-Dry commented 1 year ago

Yes, ^that fixes the issue.

DreiFingerJoe commented 1 year ago

Hi, thank you for that idea, it is working for all ingame help, except precision farming. Maybe PF has an error in it too. With my little knowledge about programming, I can see PF is the only mod loading helpLine.xml from its xml, all outher mods load from lua.

DreiFingerJoe commented 1 year ago

CP had this error last year. After comparing the old with the new version, I have fond a difference in how help menu was loaded and added this part to croprotation.lua. Now ingame help is working fine.

function loadCropRotationHelpLine(superFunc, ...) local ret = superFunc(self, ...) g_cropRotation.log:debug("loadCropRotationHelpLine()") if ret then self:loadFromXML(Utils.getFilename("gui/helpLine.xml", g_cropRotation.MOD_DIRECTORY)) return true return false end

Gordon-Dry commented 1 year ago

You closed this issue because you found a private solution? This issue should stay open until the mod is officially fixed, this is how Github works. You even should provide a pull request with the fix.

And you should use proper formatted code blocks for the convenience of any user.

And

return true
return false

does not make any sense.

Gordon-Dry commented 1 year ago

@DreiFingerJoe I guess your block should be

function loadCropRotationHelpLine(superFunc, ...)
    local ret = superFunc(self, ...)
    g_cropRotation.log:debug("loadCropRotationHelpLine()")
    if ret then
        self:loadFromXML(Utils.getFilename("gui/helpLine.xml", g_cropRotation.MOD_DIRECTORY))
        return true
    else
        return false
    end
end
DreiFingerJoe commented 1 year ago

As I am new to GitHub, could you please assist me with creating a proper pull request?

Gordon-Dry commented 1 year ago

Why me? I learned it for myself, I asked nobody. Read the docs: https://docs.github.com/en/pull-requests

Gordon-Dry commented 1 year ago

^btw the above fix may work for CP but not for the other mods mentioned above, so I have to go back to the solution by renaming the mod zip file.

Gordon-Dry commented 1 year ago

@DreiFingerJoe btw changing that function to a superFunc makes it throw an error:

2023-11-02 19:51 Error: Running LUA method 'update'.
G:/Admin/Documents/My Games/FarmingSimulator2022/mods/FS22_zz4_CropRotation/CropRotation.lua:661: attempt to call local 'superFunc' (a table value)
DreiFingerJoe commented 1 year ago

This is the code I am using and it works without errors

function loadCropRotationHelpLine(superFunc, ...)
    local ret = superFunc(self, ...)
        g_cropRotation.log:debug("loadCropRotationHelpLine()")
        if ret then
        self:loadFromXML(Utils.getFilename("gui/helpLine.xml", g_cropRotation.MOD_DIRECTORY))
        return true
    return false
end
HelpLineManager.loadMapData = Utils.overwrittenFunction(HelpLineManager.loadMapData, loadCropRotationHelpLine)
Gordon-Dry commented 1 year ago

Well, the line local ret = superFunc(self, ...) triggers the error on my side.

It is what it is.

lazarov27 commented 12 months ago

I had to make similar correction because I found out Crop Rotation was breaking Precision Farming's Help System (it disappears, and clicking on Help button in PF screen shows Crop Rotation help page). Here's what I'm using with no issues so far (borrowed from Courseplay's implemenation)

function CropRotation:loadMapDataHelpLineManager(superFunc, ...)
    local ret = superFunc(self, ...)
    if ret then
        self:loadFromXML(Utils.getFilename("gui/helpLine.xml", g_cropRotation.MOD_DIRECTORY))
        return true
    end
    return false
end
HelpLineManager.loadMapData = Utils.overwrittenFunction( HelpLineManager.loadMapData, CropRotation.loadMapDataHelpLineManager)

I've opened a PR with that change.

Gordon-Dry commented 12 months ago

I can confirm that this one works.

FirenzeIT commented 11 months ago

I had to make similar correction because I found out Crop Rotation was breaking Precision Farming's Help System (it disappears, and clicking on Help button in PF screen shows Crop Rotation help page). Here's what I'm using with no issues so far (borrowed from Courseplay's implemenation)

function CropRotation:loadMapDataHelpLineManager(superFunc, ...)
  local ret = superFunc(self, ...)
  if ret then
      self:loadFromXML(Utils.getFilename("gui/helpLine.xml", g_cropRotation.MOD_DIRECTORY))
      return true
  end
  return false
end
HelpLineManager.loadMapData = Utils.overwrittenFunction( HelpLineManager.loadMapData, CropRotation.loadMapDataHelpLineManager)

I've opened a PR with that change.

Hi @lazarov27, where are the location for change this strings??

FirenzeIT commented 11 months ago

It's all perfect with modifying of lazarov27 (and perfectly compatible with precisionFarming), obviously only with version 2.1.0.3, because 2.5.0.1 stuck at 95% in loading screen..

bodzio528 commented 11 months ago

Thank you for report and input. Indeed, crop rotation helpline loading function have had a bug that caused all subsequent help menu loading ineffective.

Should be fixed in 2.5.0.3

FirenzeIT commented 11 months ago

[image: d22eff6a371263cb88ddaf550a52683a644f0cec]​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​Hello, i opened another issue with v2.5.0.3 stuck load at 95%,but with 2.3.0.1 not having any issues (but it's missing a new culture obv), so if possible, it's need work to 2.3.0.1 and add here the new colture, my personal opinion)...

Il Gio 7 Dic 2023, 23:54 Bogumił Chojnowski @.***> ha scritto:

Closed #37 https://github.com/bodzio528/FS22_CropRotation/issues/37 as completed.

— Reply to this email directly, view it on GitHub https://github.com/bodzio528/FS22_CropRotation/issues/37#event-11187744628, or unsubscribe https://github.com/notifications/unsubscribe-auth/A27M5QY4BC3RZMLJZNQ566LYIJCJPAVCNFSM6AAAAAA6UHDYTOVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJRGE4DONZUGQ3DEOA . You are receiving this because you commented.Message ID: @.***>