1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Question Wait for UI to finalize loading

Discussion in 'Developer Support' started by borrie, Feb 16, 2021.

  1. borrie

    Joined:
    Feb 15, 2021
    Messages:
    1
    Likes Received:
    0
    I am creating a world hopper where I scout for other PK'ers. I am querying new players, and see if the result isEmpty or not. Then I'll hop to another world. Here comes the problem. Hopping sometimes takes a few seconds (in extreme cases 10 seconds). After hopping, the Worls.getCurrent(); returns the new world, but the UI hasn't updated yet showing us the players the bot saw before. I am wondering how to wait for the execution to finish.

    I was thinking about Execution.delayUntil however this doesn't seem to work.

    Code (Text):
    1.  
    2. Execution.delaysUntil(() -> WorldHop.hopToRandom(true));
    3.  
     
  2. generalsensei

    Joined:
    Apr 21, 2019
    Messages:
    43
    Likes Received:
    9
    Id probably try something as follows. Before hopping, save the current world number as an int. Whenever you attempt to hop worlds, ensure Worlds.getCurrent() is different than the saved int. If it is, ensure the local player is not null, THEN run the rest of your code.

    I believe this should work, but thats only if the local player actually returns null while hopping worlds, which im not certain is the case. But its worth investigating.
     

Share This Page

Loading...