Split: viewDirectionChanged woes
Moderators: winston, another_commander
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
Re: Split: viewDirectionChanged woes
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?
Kaks, i have NOD32 running on the machine and SuperAntiSpyware, neither of which i would think should affect a game like Oolite running?
Re: Split: viewDirectionChanged woes
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:
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...
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.
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)
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
Re: Split: viewDirectionChanged woes
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
ta
- CommonSenseOTB
- ---- E L I T E ----
- Posts: 1397
- Joined: Wed May 04, 2011 10:42 am
- Location: Saskatchewan, Canada
Re: Split: viewDirectionChanged woes
Have a good weekend KW and good luck.
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
CommonSense 'Outside-the-Box' Design Studios Ltd.
WIKI+OXPs
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
Re: Split: viewDirectionChanged woes
>:-/
right. in an attempt to at least see if things were working, i chopped down the new stuff to this :
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!
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";
// }
}
ta!
Re: Split: viewDirectionChanged woes
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
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);
}
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
Re: Split: viewDirectionChanged woes
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?
cheers. back to the drawing board...
can i not just use "if (from ===" etc etc, in my above code?
Re: Split: viewDirectionChanged woes
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.
The next step will be to replace the logging with the actual code for swapping HUDS etc (your if statements) based on those parameters.
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- CommonSenseOTB
- ---- E L I T E ----
- Posts: 1397
- Joined: Wed May 04, 2011 10:42 am
- Location: Saskatchewan, Canada
Re: Split: viewDirectionChanged woes
KW, have you tried this?Killer Wolf wrote:>:-/
right. in an attempt to at least see if things were working, i chopped down the new stuff to this :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?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"; // } }
ta!
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";
}
}
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
CommonSense 'Outside-the-Box' Design Studios Ltd.
WIKI+OXPs
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
Re: Split: viewDirectionChanged woes
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
i'll cobble something using the stuff Svengali mentioned. think it's going to bea right effing bodged job tho
Re: Split: viewDirectionChanged woes
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 .-)Killer Wolf wrote:think it's going to bea right effing bodged job tho
- CommonSenseOTB
- ---- E L I T E ----
- Posts: 1397
- Joined: Wed May 04, 2011 10:42 am
- Location: Saskatchewan, Canada
Re: Split: viewDirectionChanged woes
I have a question: How many "elses" can follow an "if"?Svengali wrote: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 .-)Killer Wolf wrote:think it's going to bea right effing bodged job tho
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
CommonSense 'Outside-the-Box' Design Studios Ltd.
WIKI+OXPs
- Mauiby de Fug
- ---- E L I T E ----
- Posts: 847
- Joined: Tue Sep 07, 2010 2:23 pm
Re: Split: viewDirectionChanged woes
One, but by coupling that else with an if, as many as you like!CommonSenseOTB wrote:I have a question: How many "elses" can follow an "if"?
-
- ---- E L I T E ----
- Posts: 503
- Joined: Sat Jun 11, 2011 7:46 pm
Re: Split: viewDirectionChanged woes
The only thing I miss from Visual Basic is the Select Case construct...Mauiby de Fug wrote:One, but by coupling that else with an if, as many as you like!CommonSenseOTB wrote:I have a question: How many "elses" can follow an "if"?
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
Re: Split: viewDirectionChanged woes
lol, translates as : as soon as i've spent hours getting it to work, they'll change it!Svengali wrote: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 .-)Killer Wolf wrote:think it's going to bea right effing bodged job tho