Some Dev Help Needed with Script issue


#1

I’ve been experimenting with making a illuminating flaregun as warm up for a worklist ticket ill be working on. Unfortunately, I’ve hit a sort of a brick wall. Please ignore the rotation direction as I have yet to work the attachment points

Basically, I borrowed alot from the createPopgun script and the fireworks script. However my main issue comes from the fact that suddenly the entity script cannot find any of the Global Instances like Vec3, Script of Controller.

Here are the scripts:

http://www.norteclabs.com/HF/scripts/flaregun/createFlareGun.js
http://www.norteclabs.com/HF/scripts/flaregun/flaregun.js

Any devs have a clue why this just doesnt work right now?


#2

CC: @Caitlyn for visibility as this sorta relates to the worklist ticket ill be working after this.

Edit: disregard @ctrlaltdavid to the rescue!


#3

flaregun.ks #226 missing semicolon
var IGNITE_SOUND_URL = “http://www.norteclabs.com/HF/resources/FlareExplosionAndFizz.mp3

Though I caught this by eyeball inspection, I recommend trying:
http://www.javascriptlint.com/download.htm


#4

JS is a tad bit too forgiving with semi colons. No error messages for it, and it is not the cause of the issue.

[UncaughtException] ReferenceError: Can't find variable: Controller in (EntityID:{ca7256b0-6ac4-427b-a038-afb080e7052b}, file:///c:/Users/Menithal/Documents/High Fidelity/Custom Scripts/flaregun/flaregun.js):234
[05/06 10:26:19] [WARNING] [Backtrace]
[05/06 10:26:19] [WARNING]     <anonymous>() at (EntityID:{ca7256b0-6ac4-427b-a038-afb080e7052b}, file:///c:/Users/Menithal/Documents/High Fidelity/Custom Scripts/flaregun/flaregun.js):234
[05/06 10:26:19] [WARNING]     <global>() at (EntityID:{ca7256b0-6ac4-427b-a038-afb080e7052b}, file:///c:/Users/Menithal/Documents/High Fidelity/Custom Scripts/flaregun/flaregun.js):374

Similar issues occur with Vec3, Entities, Avatar Globals for that specific script.

Infact, many lints do not like the prototypal javascript.


#5

Infact, even just this, causes it when added to an Entity via an Entity Rez script.

(function() {
  print(Controller.Standard.LT);
})();

on the console this works just fine, but immedietly when bundled with a just rezed object, it fails with the globals


#6

Comparing with pingPongGun.js … could it be the extra “()” before the final semicolon at the end of flaregun.js?


#7

DOH!

Its a function thats given to the entities, not called by entities!

Yep, that fixed it! thanks. I can get to finally figuring the rest out. Thanks!