Resolved Ads cause EmbeddableUI to not show on first load

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

  1. 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. 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. The client ads make sense, but I cannot think of any reason why they should be there in SDK mode.
     
  4. 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. Really I feel like (if it's possible) the instances should be delayed until the ad has finished.
     
    AlexH666 likes this.
  6. 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. 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. ok b0ss code being fixed 8)
     
  9. Tfw it also breaks Development Toolkit.
     
    Twinki, AlexH666 and Party like this.
  10. 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. The update is pushed btw.


    Sent from my iPhone using Tapatalk
     

Share This Page

Loading...