Jump to content
Delision

Difference between completeDialogueU and completeDialogue?

Recommended Posts

Looking at the API it looks like they're identical with the exception of completeDialogueU not throwing java.lang.InterruptedException. Is it recommended to use one over the other?

 

completeDialogueU

 
public boolean completeDialogueU(java.lang.String... options)

Completes the current dialogue using the specified options when available.

WARNING - This method loops until either the player is not in a dialogue, the "Select an Option" menu does not contain any of the specified options, or an option selection event failed.

Parameters:
    options - The options to choose while completing the dialogue.
Returns:
    True if the player completed the dialogue successfully.

 

completeDialogue

 
public boolean completeDialogue(java.lang.String... options)
                         throws java.lang.InterruptedException

Completes the current dialogue using the specified options when available.

WARNING - This method loops until either the player is not in a dialogue, the "Select an Option" menu does not contain any of the specified options, or an option selection event failed.

Parameters:
    options - The options to choose while completing the dialogue.
Returns:
    True if the player completed the dialogue successfully.
Throws:
    java.lang.InterruptedException
 
 
Link to post
Share on other sites

completeDialogU() does surround completeDialog() in a try/catch, but in doing so, consumes the current threads interrupted status, which is pretty bad programming practice. 

https://stackoverflow.com/questions/3976344/handling-interruptedexception-in-java

onLoop() throws InterruptedException for a reason. Use completeDialog().

Link to post
Share on other sites
7 hours ago, BravoTaco said:

I believe the difference is that completeDialogueU is surrounded in a try-catch, while the other is not.

So you can use completeDialogueU without having to catch the exception yourself.

 

54 minutes ago, Camaro said:

completeDialogU() does surround completeDialog() in a try/catch, but in doing so, consumes the current threads interrupted status, which is pretty bad programming practice. 

https://stackoverflow.com/questions/3976344/handling-interruptedexception-in-java

onLoop() throws InterruptedException for a reason. Use completeDialog().

 

Thanks for the responses! I appreciate the insight.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...