Debugging JS for user interactions with entities


#1

Hifi has a neat little script editor, but obviously it can only debug scripts that are directly executed.

Is there a way to degug/get feedback from an entity during user interaction ? Print and console log do not seem to work. Actually the console remains empty no matter what. As i’m trying to figure out how Hifi handles user interaction and trying to make an object that remains exclusive to a user for a set amount of time it would be very helpful to get some sort of feedback, like testing if vars work correctly and so on.

Any ideas ?


#2

Hi Adin.
I will assume the console you refer to is blank because you refer to the console in the Tools menu?

If so I can help.
In the task bar where the hifi sits while running there is also an Interface CLI running, this is the console that you will get running debug info from, any print (""); statements from scripts running will be displayed in that console.

Further if you press Ctrl/L this will open the log to give you better view of the contents, and to go one step further, click “Reveal log file” to get a printout of the log to refer to in future or share for debugging.

The Console on the Tools menu is a separate testing console which is able to run scripts directly typed in, and get an immediate console output without needing to keep the cli visible.

As you noted the script editor in the file menu wont print an output to the Tools/menu console, it has a built in console but that wont show anything except what you run in there, and output will also go to the Interface console.

Hope this helps


#3

Thank you very much ! This really helped !