Entity scripts not working


#1

I dont know how long its been like this for, I havent used entity scripts for a while.
But I went to load a simple teleport script and it does nothing, so I loaded a few for testing and none of them work.

Any ideas why this might be so?

Thanks


#2

Click events only.

Further testing shows it is click events not working,
Mouse press and mouse release Entity scripts are working
enterEntity and leaveEntity are also working


#3

Can you post the script? Also what happens if you stop lookwithmouse.is?


#4

Any of the “click” scripts from this page http://docs.highfidelity.io/v1.0/docs/attaching-a-script-to-an-entity

lookwithMouse not running.
No other scripts running.

MousePress scripts work, onclick scripts dont work


#5

@Adrian I tried the script from this section http://docs.highfidelity.io/v1.0/docs/attaching-a-script-to-an-entity#example-connecting-to-a-webserver specifically this script: http://business.ozblog.me/scripts/changeColorOnClickDown.js on both OSX and PC and it worked.

Is there a different script I can try?

Here is the box I tested: hifi://hq/3293.94,800.022,2016.41/0,0.937306,0,0.348507


#6

Adrian, can you share the script you are testing with? The names of the methods we fire are: mousePressOnEntity, clickDownOnEntity, mouseReleaseOnEntity, clickReleaseOnEntity, mouseMoveEvent, mouseMoveOnEntity

The mousePressOnEntity and clickDownOnEntity code blocks are identical, so other than the difference in name they should act the same.


#7

I found the problem.
What I am now wondering is @chris where are you getting your scripts from? Because the scripts as listed (now) on that docs page are wrong, but they were right when I posted them, someone has changed them since.

Please look closely at these 2 scripts the first one is the official docs as they currently are, the second one is a snap from my original scripts. Thoys picked the problem in less than 3 seconds.

Current docs


My original

Might be hard to read but the difference is in the official docs the case has changed

These lines

this.clickDownOnentity = function(entityID, mouseEvent) { 
    if (clicked){
        Entities.editentity(entityID, { color: { red: 0, green: 255, blue: 255} });
        clicked = false;
    }else{
        Entities.editentity(entityID, { color: { red: 255, green: 255, blue: 0} });
        clicked = true;    

should be like this

this.clickDownOnEntity = function(entityID, mouseEvent) { 
    if (clicked){
        Entities.editEntity(entityID, { color: { red: 0, green: 255, blue: 255} });
        clicked = false;
    }else{
        Entities.editEntity(entityID, { color: { red: 255, green: 255, blue: 0} });
        clicked = true;    

Someone has changed the editEntity to editentity and clickDownOnEntity to clickDownOnentity.

I will change the doc back tomorrow, meantime this brings to note, any changes to docs containing scripts, the scripts need to be checked again ofter changes have been made to ensure scripts havent been broken.

@ZappoMan The entity functions are perfectly ok when scripted correctly.


#8

Turns out the entire doc was affected, every instance of editEntity was replaced with editentity.
All fixed now.
@chris I figured you used the URL script which was unaffected.


#9

Hi @Adrian

yes I used your URL