JS 1.70: missing javascript: ship.energy, mission.setMusic

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

JS 1.70: missing javascript: ship.energy, mission.setMusic

Post by Kaks »

I can read both myship.energy and myship.maxEnergy. However, when I try to set the energy (as per wiki) using
myship.energy=somevalue;
I get the following error on the log:

Code: Select all

[script.javaScript.exception.206]: ***** JavaScript exception: Error: Internal error: bad property identifier 8 in property accessor for class Entity.

mission.setMusic('something.ogg'); & its predecessor, musicFileName ='something.ogg'; don't generate any errors, but the sound 'something.ogg' refuses to play.
That sound plays ok if you use player.call("playSound:", 'something.ogg');

Cheers,

Kaks
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

hmm, a wild foray into the source code for OOJSEntity.m
reveals:

Code: Select all

		case kEntity_energy:
			if (JS_ValueToNumber(context, *value, &fValue))
			{
				fValue == OOClamp_0_max_d(fValue, [entity maxEnergy]);
				[entity setEnergy:fValue];
			}
where it should have just one equal sign, & a break at the end....

Code: Select all

		case kEntity_energy:
			if (JS_ValueToNumber(context, *value, &fValue))
			{
				fValue = OOClamp_0_max_d(fValue, [entity maxEnergy]);
				[entity setEnergy:fValue];
			}
			break;
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Mission music only works under OS X in all releases. This is an old porting mistake that should have been fixed in revision 1343 yesterday.

Thanks for the energy fix.
Post Reply