Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Split: viewDirectionChanged woes

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: another_commander, winston

User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2269
Joined: Tue Jan 02, 2007 12:38 pm

Re: Split: viewDirectionChanged woes

Post by Killer Wolf »

Thanks Common, i'll have a bit more fiddle over the weekend. JS has entirely far too many "="s in statements for me >:-/

Kaks, i have NOD32 running on the machine and SuperAntiSpyware, neither of which i would think should affect a game like Oolite running?
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

Re: Split: viewDirectionChanged woes

Post by Kaks »

The game itself won't have a problem either way, it only affects your ability to debug the game! :)

The second bunch of errors Oolite was giving you:

Code: Select all

17:42:24.529 [debugTCP.disconnect]: No connection to debug console: "Connection to debug console failed: 'No connection could be made because the target machine actively refused it.

' (outStream status: 7, inStream status: 7)."
17:42:24.529 [debugTCP.disconnect]: No connection to debug console: "Connection to debug console failed: 'unknown error.' (outStream status: 0, inStream status: 0)."
17:42:24.529 [debugTCP.connect.failed]: Failed to connect to debug console at address 127.0.0.1:8563.
means:

1) debug.oxp is installed, I assume you want to use the debug console.
2) I've tryed to find the debug console, but no joy.


It's only a 'real' error if you do have the debug console running when Oolite writes those lines to the log: if you do have the console running and Oolite can't find it, it normally means you need to tweak your firewall setting.

If the debug console isn't running, then of course Oolite can't find it... ;)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2269
Joined: Tue Jan 02, 2007 12:38 pm

Re: Split: viewDirectionChanged woes

Post by Killer Wolf »

oh. well i don't run the debug console, the oxp was included in trunk so i think i'll just remove it to tidy things up a bit.
ta
User avatar
CommonSenseOTB
---- E L I T E ----
---- E L I T E ----
Posts: 1397
Joined: Wed May 04, 2011 10:42 am
Location: Saskatchewan, Canada

Re: Split: viewDirectionChanged woes

Post by CommonSenseOTB »

Have a good weekend KW and good luck. :wink:
Take an idea from one person and twist or modify it in a different way as a return suggestion so another person can see a part of it that can apply to the oxp they are working on.


CommonSense 'Outside-the-Box' Design Studios Ltd.
WIKI+OXPs
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2269
Joined: Tue Jan 02, 2007 12:38 pm

Re: Split: viewDirectionChanged woes

Post by Killer Wolf »

>:-/
right. in an attempt to at least see if things were working, i chopped down the new stuff to this :

Code: Select all

   this.viewDirectionChanged = function(viewString)
   {
   if(viewString === "VIEW_GUI_DISPLAY")
         {
			log("GUI!!!!");
               player.ship.hud = "phantomGUI.plist";
		 }
//	else if(player.alertHostiles && player.ship.energy > 108 && viewString !== "VIEW_GUI_DISPLAY")
//		{
//			player.ship.hud = "phantomCombatHUD.plist";
//		}
//	else if(player.ship.energy < 109)
//		{
//		player.ship.hud = "phantomSnafuHUD.plist";
//		}
//	else
//		{
//		player.ship.hud = "phantomNormalHUD.plist";
//		}
	}
i figured that maybe bits of Thargoids stuff is overriding the GUI bit, but when i looked in the log after lots of toing and froing, there wasn't a single "GUI!!" message. is my syntax wrong, or is summat not firing properly?
ta!
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: Split: viewDirectionChanged woes

Post by Svengali »

Oolite passes two arguments to viewDirectionChanged. The first argument will never be "VIEW_GUI_DISPLAY" as the handler is fired for inflight views (F1-F4 or customviews). You'll have to combine it with guiScreenChanged to handle all cases.

To get a overview you could use

Code: Select all

this.viewDirectionChanged = function(to,from)
{
	log(this.name,"viewDirectionChanged: to:"+to+" from:"+from);
}
this.guiScreenWillChange = function(to,from)
{
	log(this.name,"guiScreenWillChange: to:"+to+" from:"+from);
}
this.guiScreenChanged = function(to,from)
{
	log(this.name,"guiScreenChanged: to:"+to+" from:"+from);
}
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2269
Joined: Tue Jan 02, 2007 12:38 pm

Re: Split: viewDirectionChanged woes

Post by Killer Wolf »

oh. well that seems a critical bit of info missed off the wiki :-/

cheers. back to the drawing board...
can i not just use "if (from ===" etc etc, in my above code?
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Re: Split: viewDirectionChanged woes

Post by Thargoid »

Yes you can. Svengali's code just logs when those events occur and with what parameters. So you can see what's triggering when.

The next step will be to replace the logging with the actual code for swapping HUDS etc (your if statements) based on those parameters.
User avatar
CommonSenseOTB
---- E L I T E ----
---- E L I T E ----
Posts: 1397
Joined: Wed May 04, 2011 10:42 am
Location: Saskatchewan, Canada

Re: Split: viewDirectionChanged woes

Post by CommonSenseOTB »

Killer Wolf wrote:
>:-/
right. in an attempt to at least see if things were working, i chopped down the new stuff to this :

Code: Select all

   this.viewDirectionChanged = function(viewString)
   {
   if(viewString === "VIEW_GUI_DISPLAY")
         {
			log("GUI!!!!");
               player.ship.hud = "phantomGUI.plist";
		 }
//	else if(player.alertHostiles && player.ship.energy > 108 && viewString !== "VIEW_GUI_DISPLAY")
//		{
//			player.ship.hud = "phantomCombatHUD.plist";
//		}
//	else if(player.ship.energy < 109)
//		{
//		player.ship.hud = "phantomSnafuHUD.plist";
//		}
//	else
//		{
//		player.ship.hud = "phantomNormalHUD.plist";
//		}
	}
i figured that maybe bits of Thargoids stuff is overriding the GUI bit, but when i looked in the log after lots of toing and froing, there wasn't a single "GUI!!" message. is my syntax wrong, or is summat not firing properly?
ta!
KW, have you tried this?

Code: Select all

   this.viewDirectionChanged = function()
   {
   if(player.ship.viewDirection === "VIEW_GUI_DISPLAY")
         {
			log("GUI!!!!");
               player.ship.hud = "phantomGUI.plist";
		 }
	else if((player.alertHostiles) && (player.ship.energy > 108) && (player.ship.viewDirection !== "VIEW_GUI_DISPLAY"))
)
		{
			player.ship.hud = "phantomCombatHUD.plist";
		}
	else if(player.ship.energy < 109)
		{
		player.ship.hud = "phantomSnafuHUD.plist";
		}
	else
		{
		player.ship.hud = "phantomNormalHUD.plist";
		}
	}
This sort of thing works in the numeric hud using a !== so should work here as well. :)
Take an idea from one person and twist or modify it in a different way as a return suggestion so another person can see a part of it that can apply to the oxp they are working on.


CommonSense 'Outside-the-Box' Design Studios Ltd.
WIKI+OXPs
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2269
Joined: Tue Jan 02, 2007 12:38 pm

Re: Split: viewDirectionChanged woes

Post by Killer Wolf »

just tried, doesn't work.
i'll cobble something using the stuff Svengali mentioned. think it's going to bea right effing bodged job tho :-D
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: Split: viewDirectionChanged woes

Post by Svengali »

Killer Wolf wrote:
think it's going to bea right effing bodged job tho :-D
He, that's the fun of scripting (and coding) I'd think. And we really shouldn't forget that viewDirectionChanged is under development and more or less a moving target .-)
User avatar
CommonSenseOTB
---- E L I T E ----
---- E L I T E ----
Posts: 1397
Joined: Wed May 04, 2011 10:42 am
Location: Saskatchewan, Canada

Re: Split: viewDirectionChanged woes

Post by CommonSenseOTB »

Svengali wrote:
Killer Wolf wrote:
think it's going to bea right effing bodged job tho :-D
He, that's the fun of scripting (and coding) I'd think. And we really shouldn't forget that viewDirectionChanged is under development and more or less a moving target .-)
I have a question: How many "elses" can follow an "if"?
Take an idea from one person and twist or modify it in a different way as a return suggestion so another person can see a part of it that can apply to the oxp they are working on.


CommonSense 'Outside-the-Box' Design Studios Ltd.
WIKI+OXPs
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Re: Split: viewDirectionChanged woes

Post by Mauiby de Fug »

CommonSenseOTB wrote:
I have a question: How many "elses" can follow an "if"?
One, but by coupling that else with an if, as many as you like!
Dragonfire
---- E L I T E ----
---- E L I T E ----
Posts: 503
Joined: Sat Jun 11, 2011 7:46 pm

Re: Split: viewDirectionChanged woes

Post by Dragonfire »

Mauiby de Fug wrote:
CommonSenseOTB wrote:
I have a question: How many "elses" can follow an "if"?
One, but by coupling that else with an if, as many as you like!
The only thing I miss from Visual Basic is the Select Case construct...
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2269
Joined: Tue Jan 02, 2007 12:38 pm

Re: Split: viewDirectionChanged woes

Post by Killer Wolf »

Svengali wrote:
Killer Wolf wrote:
think it's going to bea right effing bodged job tho :-D
He, that's the fun of scripting (and coding) I'd think. And we really shouldn't forget that viewDirectionChanged is under development and more or less a moving target .-)
lol, translates as : as soon as i've spent hours getting it to work, they'll change it!
Post Reply