Page 5 of 6
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
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.
Re: Split: viewDirectionChanged woes
Posted: Thu May 22, 2025 6:02 pm
by Wildeblood
phkb wrote: ↑Sat Jun 20, 2015 2:19 am
Your probably want this:
viewDirectionChanged
The viewDirectionChanged handler is called when the player view changes, with a string to indicate which view the player is facing. Amongst its possible values are "VIEW_FORWARD", "VIEW_AFT", "VIEW_PORT", "VIEW_STARBOARD", "VIEW_CUSTOM", "VIEW_GUI_DISPLAY".
Code: Select all
this.viewDirectionChanged = function(viewString)
{
if (viewString == "VIEW_PORT")
{
// Your code here
}
}
Nick was quoting the wiki there, and it still says exactly the same thing today,
but...
Sometime between June, 2015, and May, 2025, "VIEW_GUI_DISPLAY" has disappeared from the implementation. Was this an intentional decision, or an accident?
https://wiki.alioth.net/index.php/Oolit ... ionChanged
Re: Split: viewDirectionChanged woes
Posted: Fri May 23, 2025 12:56 pm
by phkb
Wildeblood wrote: ↑Thu May 22, 2025 6:02 pm
Was this an intentional decision, or an accident?
Not sure! My quick search for answers hasn't turned up anything straight away. I'll have another look tomorrow to see if I can find out what's going on. But I can confirm "VIEW_GUI_SCREEN" is not getting reported.
Re: Split: viewDirectionChanged woes
Posted: Fri May 23, 2025 4:06 pm
by Cholmondely
Wildeblood - if you can find the phrase in the vanilla game code disabling it, you might be able to search GitHub to find when it was first introduced (and maybe even why).
Re: Split: viewDirectionChanged woes
Posted: Fri May 23, 2025 5:58 pm
by Wildeblood
Cholmondely wrote: ↑Fri May 23, 2025 4:06 pm
... if you can find the phrase in the vanilla game code disabling it...
What, you mean like this sort of thing in Universe.h? Can you decode this?
624 - (OOViewID) viewDirection;
625 - (void) setViewDirection:(OOViewID)vd;
626 - (void) enterGUIViewModeWithMouseInteraction:(BOOL)mouseInteraction; // Use instead of setViewDirection:VIEW_GUI_DISPLAY
Re: Split: viewDirectionChanged woes
Posted: Fri May 23, 2025 6:49 pm
by Cholmondely
Wildeblood wrote: ↑Fri May 23, 2025 5:58 pm
What, you mean like this sort of thing in Universe.h? Can you decode this?
624 - (OOViewID) viewDirection;
625 - (void) setViewDirection:(OOViewID)vd;
626 - (void) enterGUIViewModeWithMouseInteraction:(BOOL)mouseInteraction; // Use instead of setViewDirection:VIEW_GUI_DISPLAY
Make pteridomania great again!