Script is hanging

There is a player who's got an inventory with a lot of items and allegedly a computer that is a bit slow.
Each tone he tries to open his inventory, he gets the "script is hanging" message. I can however open his inventory just fine.
Any clue on how to fix this?
As far as I know, you'll only get that error if your comp is too slow, or if you have too many things running on your comp while running the game. I've never personally seen it, but I've read about it and that always seems to be the case.

On your end, this could mean that there's too many things like parallel processes or graphical stuff slowing things up.

It could also mean their comp is just too slow or running too many things. I wonder do they have problems running any modern programs?
Kinda weird though that the problem shows up on inventory. I think there are lot of other scenes using more processing power.
Could it be because of some poorly optimised script?
For my own project, I got "Script is hanging" when the game didn't update its graphic for 10 seconds. It was the fault of funky scripting on my part, but it sounds like that's not the case for you. Several questions: is this "inventory" the default XP item menu? How many items do you have? Does your player tell you how the game screen look like last before the message shows up--if it froze for a bit or some such?
That annoying error occurs when Graphics.update wasn't called for roughly 10 seconds. Usually the script/process doesn't even truly hang but something just takes too much time and afterwards you could've continued without any issues. That's likely why it was removed in later RGSS versions.

You don't mention any item menu related scripts but even with the default one not only any text (names, separators, counts, description) but also icons need to be drawn. While drawing icons should be comparatively fast the fact that in XP icons aren't organized as a 'set' (another VX improvement) means likely a large amount of small files have to be read first. Caching all icons at program start might help in this case. However if the error happens even during that I'd definitely recommend checking the hard disk health and any activity (overzealous anti-virus software, malware, etc.). It's weird everything else is (mostly) fine except the item menu.

Also does the error occur when using the in-battle item menu?
Thanks for the feedback everyone, many questions, with some I cannot really answer.

Could it be because of some poorly optimised plugin ?

Not that I'm aware of. He's the only person to report this in 10 years of existence of the game.

is this "inventory" the default XP item menu?

Yup

How many items do you have?

Quite a lot I'd say, enough to make it freeze on their PC. I think he's collecting absolutely all of them.

Does your player tell you how the game screen look like last before the message shows up--if it froze for a bit or some such?

I think it just gives the error msg "script is hanging".

Also does the error occur when using the in-battle item menu?
+
I wonder do they have problems running any modern programs?

Dunno, I'll ask them.
Lol! Sounds like a good and dedicated player xD

My suspicion is that the game probably took a loooong time when drawing all items, long enough that it would cause the game to throw up the Script is hanging message. I got a VX project with 350+ items, armors and weapons combined and I had a few seconds of delay when I opened the item menu with all of them in inventory. My computer has 2GB RAM, never tested it anywhere else. I'm thinking this delay might be the culprit.

Unfortunately if it really was the drawing process taking too long, I have no idea how to fix it. cremnophobia's suggestion about caching sounds good to me. I don't have a whole lotta knowledge when it comes to that stuff myself though orz.

EDIT: Hello @Indinera, sorry for the extra ping (does this mention ping?). I got very curious and decided to take a closer look.

Try putting this script above Main:
Code:
class Window_Item < Window_Selectable

  FORCE_UPDATE_ITEM_DRAW = 150

  alias crudehangpreventor_wdwitem_init initialize
  def initialize(*args)
    @itemdrw_count = 0
    crudehangpreventor_wdwitem_init(*args)
  end

  alias crudehangpreventor_wdwitem_drwitem draw_item
  def draw_item(*args)
    @itemdrw_count += 1
    crudehangpreventor_wdwitem_drwitem(*args)
    if @itemdrw_count == FORCE_UPDATE_ITEM_DRAW
      Graphics.update
      @itemdrw_count = 0
    end
  end
end
It's a rather crude attempt but what this does is force the game to call Graphics.update for each 150 items drawn. If the game still says Script is hanging (or you don't have that many items), you can try changing the number in FORCE_UPDATE_ITEM_DRAW to something lower. The downside though is that if the number is too low, there will be delay when opening the item menu.

Original thread: https://forums.rpgmakerweb.com/threads/script-is-hanging.122985/