Scripting newbie question: how to open up a window with some content (possibly html formatted?)


#1

Is there any example script I can use as a starting point to open up on touch a window to user and presenting them some text possibly with html formatting?

I see that many scripts are doing something similar so I am almost sure that this is possible, but did not find any example in the forums or in the documentation, surely I missed them.

The logs are actually doing something similar for instance:

but they are interface scripts, can an entity script do the same or similar?

It would be enough to produce text with colors, but some buttons are welcome as well :slight_smile:


#2

This is the maximum that I was able to produce by myself, consulting the almost unexistent documentation…
This can also open the external browser with a specific link. I’m wondering if there is a better alternative. The window.alert seems not presenting a scroll bar and can’t specify its size for instance.

(function () {

this.clickDownOnEntity = function (entityID, mouseEvent) {
var userData = JSON.parse(Entities.getEntityProperties(entityID, [“position”, “userData”]).userData);
// userdata extraction
var text = userData.text;
var url = userData.url;

//
Window.alert(text.join("\n"));
Window.openUrl(url);
}

});