Page 5 of 5

Re: Split: viewDirectionChanged woes

Posted: Sun Jun 21, 2015 4:21 am
by phkb
Is anything showing up in your "latest.log" file? If everything is working OK, you should see your OXP name in the list of loaded OXP's. If there's a problem you could see a Javascript error or a message indicating a problem reading a plist file.

Re: Split: viewDirectionChanged woes

Posted: Sun Jun 21, 2015 6:14 am
by BladeRunner
cheers, looking into it now.
10:34:31.967 [script.javaScript.exception.curlyAfterBody]: ***** JavaScript exception (view.myship.js.anon-script): SyntaxError: missing } after function body
10:34:31.968 [script.javaScript.load.failed]: ***** Error loading JavaScript script ../AddOns/myship.oxz/Scripts/view.myship.js -- compilation failed
10:34:31.968 [script.load.notFound]: ***** ERROR: Could not find script file view.myship.js.

Re: Split: viewDirectionChanged woes

Posted: Sun Jun 21, 2015 6:22 am
by BladeRunner
Fixed that last one...

now this:
14:19:39.664 [LogEvents]: Player launched from Coriolis Station 25176
14:19:39.672 [Total_patrol]: Adding additional police.
14:19:39.680 [Total_patrol]: Adding additional police.
14:19:40.976 [LogEvents]: Player VIEW_AFT
14:19:41.528 [script.javaScript.unrootedTimer]: ----- WARNING: Timer <OOJSTimer 0x251071b0>{nextTime: 9.075, one-shot, running, function: anonymous} is being garbage-collected while still running. You must keep a reference to all running timers, or they will stop unpredictably!
14:19:41.528 [script.javaScript.unrootedTimer]: ----- WARNING: Timer <OOJSTimer 0x25109f10>{nextTime: 9.075, one-shot, running, function: anonymous} is being garbage-collected while still running. You must keep a reference to all running timers, or they will stop unpredictably!
14:19:41.528 [script.javaScript.unrootedTimer]: ----- WARNING: Timer <OOJSTimer 0x251053b0>{nextTime: 9.075, one-shot, running, function: anonymous} is being garbage-collected while still running. You must keep a reference to all running timers, or they will stop unpredictably!
14:19:41.528 [script.javaScript.unrootedTimer]: ----- WARNING: Timer <OOJSTimer 0x3312aa70>{nextTime: 8.554, one-shot, running, function: anonymous} is being garbage-collected while still running. You must keep a reference to all running timers, or they will stop unpredictably!
14:19:41.528 [script.javaScript.unrootedTimer]: ----- WARNING: Timer <OOJSTimer 0x33127ef0>{nextTime: 8.554, one-shot, running, function: anonymous} is being garbage-collected while still running. You must keep a reference to all running timers, or they will stop unpredictably!
14:19:41.528 [script.javaScript.unrootedTimer]: ----- WARNING: Timer <OOJSTimer 0x33111930>{nextTime: 8.554, one-shot, running, function: anonymous} is being garbage-collected while still running. You must keep a reference to all running timers, or they will stop unpredictably!
14:19:41.863 [LogEvents]: Player VIEW_PORT
14:19:42.281 [LogEvents]: Player VIEW_STARBOARD
14:19:43.167 [LogEvents]: Player VIEW_FORWARD
Still no change in the views... grrrr.

should I try dumping all my extra addons and try with vanilla oolite?

Re: Split: viewDirectionChanged woes

Posted: Sun Jun 21, 2015 6:36 am
by spara
BladeRunner wrote:
should I try dumping all my extra addons and try with vanilla oolite?
Yes. And you might want to get the developer release. It gives more detailed error information.

Re: Split: viewDirectionChanged woes

Posted: Sun Jun 21, 2015 6:40 am
by BladeRunner
cool, will give it a go, thanks for the help...

Re: Split: viewDirectionChanged woes

Posted: Sun Jun 21, 2015 7:01 am
by spara
BladeRunner wrote:

Code: Select all

this.name	        = "view-myship";
this.author			= "BR";
this.copyright		= "Creative Commons: attribution, non-commercial, sharealike.";
this.description	= "Ship's HUD View";
this.version		= "1.0";

this.viewDirectionChanged = function(viewString)
  {
    if (viewString === "VIEW_CUSTOM")
    {
       var p = player.ship;
		   switch (viewString) {
				      case "VIEW_FORWARD":
					 p.hud = "myship-hud-fore.plist";
					 break;
				      case "VIEW_AFT":
					 p.hud = "myship-hud-aft.plist";
					 break;
				      case "VIEW_PORT":
					 p.hud = "myship-hud-port.plist";
					 break;
				      case "VIEW_STARBOARD":
					 p.hud = "myship-hud-star.plist";
					 break;
		   
    }
  }
Hmmm. This won't work. Apart from that missing, bracket you've corrected, you're first checking that viewString is "VIEW_CUSTOM" and then you're checking cases where viewString is "VIEW_FORWARD", "VIEW_AFT", "VIEW_PORT" or "VIEW_STARBOARD". That naturally does not work. Drop that "VIEW_CUSTOM" check and it should work.

Re: Split: viewDirectionChanged woes

Posted: Sun Jun 21, 2015 7:09 am
by BladeRunner
nailed it, thanks!

Re: Split: viewDirectionChanged woes

Posted: Mon Jun 22, 2015 1:26 am
by BladeRunner
If you could be so kind as to point me in the right direction for hiding the custom hud screens when viewing the manifest (etc) in flight and the fore hud when docked?

Cheers.

Re: Split: viewDirectionChanged woes

Posted: Mon Jun 22, 2015 1:47 am
by phkb
In your switch statement, add

Code: Select all

        case "VIEW_GUI_DISPLAY":
and then you can decide what you want to do, possibly switching to a another HUD that is designed for use with the GUI screens (like the manifest).

For the docked HUD, you can either add HUD elements with the "alertCondition" set to 1 (docked), and make sure all the other elements have their "alertCondition" set to 14 (status green, yellow and red); or you can create a docked HUD that just has the elements you want, and switch to it like you're doing with the other view directions.

Does that make sense?

Re: Split: viewDirectionChanged woes

Posted: Mon Jun 22, 2015 9:39 am
by BladeRunner
cheers, will look into it soon and get back if there are issues.

Again, thanks for your help with this.