Jump to content
×
×
  • Create New...

.interact() returns false when using an item on a gameobject using the full menu information


Joonks
 Share

Recommended Posts

If using ("Use") as the .interact argument it will return true/false, but often selects the wrong menuitem if there are multiple to choose from.

Expected behavior is being able to pass in "Use" and it should validate the gameobject that .interact() is being called on in the menuitem and return whether or not the correct menuitem was selected.

Link to post
Share on other sites

  • Moderators

Using an item on another entity is a single click option and will therefore return false.
For example 

if(Inventory.stream().name("Knife").first().interact("Use")){

	if(Inventory.stream().name("Log").first().interact("Use")){
     		System.out.println("This won't return true"); 
        } else {
		System.out.println("This will always return false"); 
        }

}
/////////// VS

if(Inventory.stream().name("Knife").first().interact("Use")){
	if(Inventory.stream().name("Log").first().interact("Use", false)){
     		System.out.println("This should return true"); 
    } 
}

the second example passes useMenu = false, meaning you're telling interact() that what you're about to do, will have no menu to verify the correct option was selected.

Unlike desktop, there's no 'uptext' or whatever it was called upon hovering over and item etc in the top left. Therefore without using the menu, we can't verify what entity was tapped on.

Link to post
Share on other sites

2 hours ago, Dan said:

Using an item on another entity is a single click option and will therefore return false.
For example 

if(Inventory.stream().name("Knife").first().interact("Use")){

	if(Inventory.stream().name("Log").first().interact("Use")){
     		System.out.println("This won't return true"); 
        } else {
		System.out.println("This will always return false"); 
        }

}
/////////// VS

if(Inventory.stream().name("Knife").first().interact("Use")){
	if(Inventory.stream().name("Log").first().interact("Use", false)){
     		System.out.println("This should return true"); 
    } 
}

the second example passes useMenu = false, meaning you're telling interact() that what you're about to do, will have no menu to verify the correct option was selected.

Unlike desktop, there's no 'uptext' or whatever it was called upon hovering over and item etc in the top left. Therefore without using the menu, we can't verify what entity was tapped on.

When the camera is positioned in such a way where entities overlap, using an item on an entity produces multiple menu items to select from. In this scenario the client does not validate the entity in the menu items when it should be doing so. 

Link to post
Share on other sites

  • const_ locked this topic
Guest
This topic is now closed to further replies.
 Share