Cant execute JavaScripts

I'm doing a game and trying to add a dice whit JavaScript, all works fine but the JavaScript command dont executes when the dice is clicked.

I downloaded a project of the comunity forum where it have a dice and its suposed to work reading the coments but when i publish that project it dont executes the comands too. So, i dont know if im skiping something when publishing the project or something.

This is the code that im using:

var number = Math.floor(Math.random()*6);

Here is the file of my project.

19 Replies
jorge calderon

I tried uploading the game to dropbox and testing it on Chrome, mozilla and Explorer 11. And the game launches fine but the "execute Javascript" trigger dont works, the command dont executes. I leave here the project and this is the published one

Russell Still

Did you ever get your JS to execute? Here we are, four years later, but my execute JS function has just stopped working for no obvious reason. I've rebooted. I've updated SL360. Nothing seems to work. There is clearly some oddball situation that renders the JS execute function inoperable in SL.

Russell Still

The console complained of a syntax error, in particular, a colon instead of a semicolon on one of lines. I have the JS on every slide so I went through and sure enough, one had a colon. I corrected that, and retested. The same problem and now it says I still have one more. I'm looking for it now. It is odd (or is it?) that one syntax error would make all the JS in the project inoperable. I suppose if it does the equivalent of a compile it might act that way. Anyway, I'll report back shortly.


Russell Still

It says the nasty colon is in line 18. There are 16 slides and the last slide has two JS calls in it. Is it possible user.js has gotten corrupted and has an extra, unreferenced line of code?

I'm considering just deleting the final/bad window.history.back(); from user.js and giving it a try, What you think?