Jump to content

ItsJiminy

Member
  • Posts

    2
  • Joined

  • Last visited

Everything posted by ItsJiminy

  1. Sorry for the second message to show the screenshot, and both need to be approved still, but this is the evidence of the options being displayed, and the time it takes, which given the player can't scroll through the context options in 1 second, no issue arises from the options taking a moment to fill.
  2. This isn't something that will fix the overall issue that Lua has not like, wait functionality, and every single file is required to implement it directly itself if it needs something like it, but. This handle of ontick, along with your iteration over the required number of options, removes any freezing. local testFunc = {starttime = false, totalOptionsToAdd = 300, optionsAdded = 0, context = false} testFunc.doTestMenu = function(player, context) testFunc.optionsAdded = 0 testFunc.context = context testFunc.starttime = os.time() end testFunc.doTestTick = function() if testFunc.starttime then if testFunc.optionsAdded ~= testFunc.totalOptionsToAdd then local maxVal = math.min(testFunc.optionsAdded+10, testFunc.totalOptionsToAdd) for i=testFunc.optionsAdded+1,maxVal do local firstMenu = testFunc.context:addOption("test" .. i, nil, nil) local secondMenu = ISContextMenu:getNew(testFunc.context) testFunc.context:addSubMenu(firstMenu, secondMenu) testFunc.optionsAdded = testFunc.optionsAdded + 1 end else local endtime = os.time() print(string.format("cost time: %.4f", endtime - testFunc.starttime)) -- cost time: 0.2440 testFunc.starttime = false testFunc.context = false end end end Events.OnTick.Add(testFunc.doTestTick) Events.OnFillWorldObjectContextMenu.Add(testFunc.doTestMenu)
×
×
  • Create New...