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

Resolved Ads cause EmbeddableUI to not show on first load

Discussion in 'Developer Support' started by Party, Jun 5, 2016.

  1. Party

    Party Client Developer

    Joined:
    Oct 12, 2015
    Messages:
    3,708
    Likes Received:
    1,606
    When an ad plays, it causes the EmbeddableUI to null whilst the instance is technically running, meaning the bot crashes.

    Sorry if that's shitty English 8)

    Using following:
    Code (Text):
    1. setEmbeddableUI(() -> {
    2.             Future<InputStream> inputStream = getPlatform().invokeLater(() -> Resources.getAsStream("com/pBots/framework/userinterface/pInterface.fxml"));
    3.             FXMLLoader loader = new FXMLLoader();
    4.             loader.setController(uiController = new pInterfaceController(this));
    5.             return ui = loader.load(inputStream.get());
    6.         });
     
    AlexH666 likes this.
  2. AlexH666

    AlexH666 Χ Ξ Σ

    Joined:
    Apr 15, 2016
    Messages:
    379
    Likes Received:
    101
    Yes please I'm getting flooded with exception notifications :( :eek:

    Also can you just get rid of those client ads while we're at it? :/
     
  3. Party

    Party Client Developer

    Joined:
    Oct 12, 2015
    Messages:
    3,708
    Likes Received:
    1,606
    The client ads make sense, but I cannot think of any reason why they should be there in SDK mode.
     
  4. AlexH666

    AlexH666 Χ Ξ Σ

    Joined:
    Apr 15, 2016
    Messages:
    379
    Likes Received:
    101
    I don't know. But I'll not derail the thread further :p

    Are we supposed to delay loading the UI and starting the bot tasks now? As in is this our fault or the client? (UI exceptions because of these ads).
    I feel like I saw a snippet somewhere on here that had some thing to wait for the UI to be loaded before proceding in one the UI example bots.
     
  5. Party

    Party Client Developer

    Joined:
    Oct 12, 2015
    Messages:
    3,708
    Likes Received:
    1,606
    Really I feel like (if it's possible) the instances should be delayed until the ad has finished.
     
    AlexH666 likes this.
  6. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,198
    Likes Received:
    1,041
    I also feel like this should be the case. It seems like the call to botInterfaceProperty() happens after the ad, but onStart(String...) happens during the ad.
     
    Party likes this.
  7. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,937
    Likes Received:
    1,266
    This is not a client bug. This is an issue in your bot logic.

    The EmbeddableUI framework is completely asynchronous of your bot logic. Your bot logic should not depend on the botInterfaceProperty having been invoked. If it absolutely must then you will need to make your bot wait, i.e. using a looped Execution.delay, until it is loaded or invoke it yourself. To summarize, you cannot ever assume that the botInterfaceProperty method has been invoked for you.

    The reason that this issue did not come up before was because in the race condition that has always existed between the JFX platform and bot platform, the JFX Platform consistently won so the UI was initialized before the bot's onStart method was invoked. However, now with the introduction of ads we start the bot in the background, essentially giving it a headstart on the JFX platform. It simply revealed an existing issue with your code.

    tl;dr fix ur code
     
  8. Party

    Party Client Developer

    Joined:
    Oct 12, 2015
    Messages:
    3,708
    Likes Received:
    1,606
    ok b0ss code being fixed 8)
     
  9. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,198
    Likes Received:
    1,041
    Tfw it also breaks Development Toolkit.
     
    Twinki, AlexH666 and Party like this.
  10. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,937
    Likes Received:
    1,266
    Latest commit: Ensures that EmbeddableUI methods get invoked on the bot platform, so as to provide Bot Authors with a consistent experience even though they should be handling the possibility that it isn't invoked from the bot platform.

    The issue that DevKit had is distinct from the OP's issue. OP's issue was OP's fault, but you bringing up DevKit made me realize another potential issue as outlined above. Regardless, we should be all good once the next build goes out.
     
    AlexH666 likes this.
  11. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,937
    Likes Received:
    1,266
    The update is pushed btw.


    Sent from my iPhone using Tapatalk
     

Share This Page

Loading...