Some Suggestions from a New Scriptor


#1

I’m still new to scripting in HF and already having a difficult time transitioning into it. I’ve ran into some issues during scripting that I think could be improved on for new users…

  • When debugging using the HMD-supported Debug window, at one point an entity would generate multiple print statements on a single entity click. But after I came back later and started up the server, it finally generated a single print statement as expected. A confusing experience.
  • A script will work and then all the sudden not work. No errors are reported either to indicate an issue. Again, a confusing experience.
  • Copying code from the wiki doesn’t guarantee it will work as-is and this could be better documented. I’ll see if I can get in touch with someone in-world who spoke to me about that. Not very helpful in getting new users going with results. Yes, I know it’s beta and things are a development in process.
  • Tutorials and documentation (where appropriate) could be cross-device (HMD, mouse, keyboard) supported. It doesn’t help when I go to learn a tutorial and I find out that you can’t make it work as-is for mouse.
  • Please consider making a better in-world script editor. I use an external editor because the in-world editor just feels lacking. I would prefer to use an in-world editor for most cases. Large scale projects may be a different case. For me, working in-world feels more productive than switching back and forth between windows.

I apologize in advance. Not trying to be bitter here. Just throwing out suggestions here for a possible better user entry experience.


#2

We definitely appreciate the feedback, keep it coming!

We’re working on improving our documentation, and can definitely update the tutorials to include any specific peripheral requirements (e.g. hand controllers). Do you happen to remember which code from the wiki didn’t work as-is? I’d like to go in and fix it.

Also, if you can share more about what you find lacking in the in-world script editor, that’d be helpful too as I file some suggestions around improving the experience.


#3

An example of a issue where code doesn’t work as-is, is at the following link…
https://wiki.highfidelity.com/wiki/MousePressEvent()

It contains the following code, with a test message added in to verify it loaded…

Controller.mousePressEvent.connect(function(event) {
	print ("The mouse button has been pressed.");
});
print("mouseEvent.js loaded");

It works if it’s loaded from disk via Ctrl+J Script window. But, if I put this same script inside of an entity, it doesn’t appear to print the test message to screen. Instead, I have to do the following for it to work inside of an entity, which someone who is new wouldn’t know that if they simply started making a script to attach to an entity.

(function() {
	Controller.mousePressEvent.connect(function(event) {
		print ("The mouse button has been pressed.");
	});
	print("mouseEvent.js loaded");
});

As for the code editor, here are some suggestions…

  • I think the open file tabs should be at the top of the interface, rather than the side by default. There could be an option to allow people to dock the tabs to the side. Traditionally, IDE’s and text editors put tabs at the top. Even Web browsers. It’s easier to scan/read tabs horizontally.
  • Font family and styling could be customizable. The current editor text lacks the modernized monospaced type fonts. For example, Consolas on Windows. Just an example, not to say it’s a favorite of mine.
  • Overall user interface modernization. Examples are Atom, Visual Studio Code, and Visual Studio IDE. Theme support allows for people who prefer light versus dark themes.
  • Loading scripts is really annoying. It keeps asking me to save scripts anytime I load a script. Not sure what I’m doing wrong, but it could be easier to work with instead of it always asking to save. If I choose a specific script from the Load drop-down menu, it should just load. Especially, if it’s one of my own scripts in my own directory.
  • Maybe the ability to dock the script editor within the HF Interface. Such as docking it to the right side.
  • Ability to work within project folders and see all the files related to the project
  • Code hints to hint to the HF API. I’m not talking IntelliSense-like. Something more like code hints in Second Life.

Ok, that’s probably getting far fetched. Sorry! Some are just hopeful wishing, but maybe you guys have already considered some of the suggestions. Some people would just tell me to use an external editor, but I prefer to work in-world as much as possible since it feels more productive for a lot of the experimental/prototype work.

On a side note about scripting, it would be great if the Script URL field in Entity Properties allowed you the ability to browse to a “local file” and have it automatically insert the correctly formatted File URI path for you. Some people have no idea what a File URI is supposed to look like. It’s mentioned in the Wiki, but it would be great if the system just handled that for you. Or, even nicer looking, is to populate the Windows/Mac/Linux based path, but let the back-end handle the conversion of the path.

By the way, if you’re the same Livi who posted the Shortbow tutorial on the blog, I want to thank you and others involved for putting that together. Having practical examples like that makes for a great jump start into scripting to understand the concepts of HF’s scripting system. It’s just that I didn’t have a HMD and was totally bummed out on that because I really wanted to learn it since it was fairly easy to follow. Once I get a better understanding of HF’s scripting workflow, I would be happy to contribute and improve on it.


#4

Something else I was wondering about with Entity scripts… Would it be possible for the back-end system to automatically make Entity scripts anonymous functions? Is there any purpose (within the HF system), beyond the standard definition (function() { … }), for scriptors to explicitly write the anonymous function for every Entity script?


#5

This is all really great feedback and I’m going through filing bugs and drafting out specs to make sure that this is being captured on our end. I’ve also added just a bit more clarity to that example in the wiki to make sure that we better capture the information about how to use examples in entity scripts. We’re working on a documentation overhaul, but in the meantime, I’ll keep an eye here for other feedback around scripting that you may have as you continue to work with the system and provide updates. Feel free to keep us looped in on your progress and any other ideas that you have!

Also, glad that the Shortbow tutorial was helpful! If you have other topics that you’d like to see us go more in-depth with, definitely let us know how we can help. :slight_smile:


#6

The thing is that there are similar calls/events that would have the same issue of not explaining the anonymous function setup for entities. Copying/pasting this into all the needed places would be overkill.

This is where I think having the back-end HF system automatically handle entity code as anonymous functions, so that one doesn’t have to think about it. It just magically happens. Then the Wiki could be cleaned up a bit.

If Entities have to be manually setup like this, then I’m not sure how to best approach explaining that in the Wiki without being excessive. The intro pages will probably just have to do as they are. I made the mistake of getting ahead of myself and skipping some steps wanting to get right into the logic of things and not have to think about how to prep an entity. :disappointed: