Question2 music when entering system or undocking

General discussion for players of Oolite.

Moderators: winston, another_commander

User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

...

Post by Lestradae »

pagroove wrote:
On a side note: I also made a new breakpattern.ogg
You hear the tunnel and it's quite cool. If anyone wants to have then let me know.
Hi pagroove :D

I would like to have it!
User avatar
pagroove
---- E L I T E ----
---- E L I T E ----
Posts: 3035
Joined: Wed Feb 21, 2007 11:52 pm
Location: On a famous planet

Post by pagroove »

I'il give you the link this weekend. This evening I get visitors. (no not the Abba LP) 8)
For P.A. Groove's music check
https://soundcloud.com/p-a-groove
Famous Planets v 2.7. (for Povray)
Image
https://bb.oolite.space/viewtopic.php?f=4&t=13709
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

As promised, a proposal for a v0.2 script below. This one should be fully compatible with OXPConfig too. Here I've given examples of each functionality as detailed in the script header.

At the moment the logging just lists where the player witchspaces into (galaxy, planet name and number) and when music is played. Again it should give you an idea of code lay-out, but by all means change or remove the switches ;)

I've tested it as far as I can, but of course I don't have the music. As it's not yet built into OXPConfig (talk to Svengali about that), my tests were via the JS console and the worldScripts command (worldScripts ["Famous Planets Launch Script"].logging = true and variations thereon).

Code: Select all

this.name = "Famous Planets Launch Script"; 
this.author = "PAGroove and Thargoid"; 
this.copyright = "© 2008 the Oolite team."; 
this.description = "Play selected music files and displays greetings when the player witchspaces into or undocks from the main station in a Famous Planet system."; 
this.version = "0.2"; 

/* this.logging, this.audio, this.extraA and this.extraB are for compatability with OXPConfig.oxp.

	this.logging - turns logging to stderr.txt and JSConsole on and off (off by default).
	this.audio - turns the tunes at witchspace entry and undocking from the main station in FP locations on and off (on by default).
	this.extraA - turns on/off welcome console messages after witchspace arrival in FP location (on by default).
	this.extraB - turns on/off departure console messages main station undocking in FP location (on by default).
*/

this.startUp = function()
{
	this.logging = false; this.audio = true; this.extraA = true; this.extraB = true;
}

this.shipExitedWitchspace = function() 
	{ 
	if(this.logging) {log("Player in galaxy " + (galaxyNumber+1) + "  at " + system.name + " (" + system.ID + ")."); };
	if(galaxyNumber == 0) 
		{ 
		switch(system.ID) 
			{ 
			case 7: 
				{ 
				if(this.audio) {Sound.playMusic('LaveWitch.ogg'); } else {Sound.stopMusic(); };
				if(this.logging && this.audio) {log("Playing Lave witchspace music."); };
				if(this.extraA) {player.consoleMessage("Welcome to " + system.name + " Commander " + player.name) };
				break; 
				} 
			case 147: 
				{ 
				if(this.audio) {Sound.playMusic('DisoWitch.ogg'); } else {Sound.stopMusic(); };
				if(this.logging && this.audio) {log("Playing Diso witchspace music."); };
				if(this.extraA) {player.consoleMessage("Welcome to " + system.name + " Commander " + player.name) };
				break; 
				} 
			case 246: 
				{ 
				if(this.audio) {Sound.playMusic('TianveWitch.ogg'); } else {Sound.stopMusic(); };
				if(this.logging && this.audio) {log("Playing Tianve witchspace music."); };
				if(this.extraA) {player.consoleMessage("Welcome to " + system.name + " Commander " + player.name) };
				break; 
				} 
			} 
		} 
	} 

this.shipLaunchedFromStation = function() 
	{ 
	if(galaxyNumber == 0 && system.mainStation) 
		{ 
		switch(system.ID) 
			{ 
					case 7: 
				{ 
				if(this.audio) {Sound.playMusic('LaveLaunch.ogg'); } else {Sound.stopMusic(); };
				if(this.logging && this.audio) {log("Playing Lave launch music."); };
				if(this.extraB) {player.consoleMessage("We hope you enjoyed " + system.name + " station Commander " + player.name) };
				break; 
				} 
			case 147: 
				{ 
				if(this.audio) {Sound.playMusic('DisoLaunch.ogg'); } else {Sound.stopMusic(); };
				if(this.logging && this.audio) {log("Playing Diso launch music."); };
				if(this.extraB) {player.consoleMessage("We hope you enjoyed " + system.name + " station Commander " + player.name) };
				break; 
				} 
			case 246: 
				{ 
				if(this.audio) {Sound.playMusic('TianveLaunch.ogg'); } else {Sound.stopMusic(); };
				if(this.logging && this.audio) {log("Playing Tianve launch music."); };
				if(this.extraB) {player.consoleMessage("We hope you enjoyed " + system.name + " station Commander " + player.name) };
				break; 
				} 
			} 
		} 
	} 
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Post by Svengali »

Thargoid wrote:
I've tested it as far as I can, but of course I don't have the music. As it's not yet built into OXPConfig (talk to Svengali about that), my tests were via the JS console and the worldScripts command (worldScripts ["Famous Planets Launch Script"].logging = true and variations thereon).
For adding it into OXPConfig I need a fixed script-name (e.g. this.name = "Famous Planets") and a short description for the switches. Then it's done within 3 minutes :-) I'm already planning the next version, so it is better to wait till pagroove has released his next version.

But if you want to test it with your script, just open decriptions.plist and set OXPCONFIG_OVERALLB to 3

Code: Select all

OXPCONFIG_OVERALLB = "3";
add

Code: Select all

	OXPCONFIG2_INFO0 = "Famous Planets Launch Script";
	OXPCONFIG2_INFO1 = "15";
	OXPCONFIG2_INFO2 = "Audio - Switch on/off music in FP systems\nExtraA - Switch on/off exiting witchspace message in FP systems\nExtraB - Switch on/off launching message in FP systems";
In missiontext.plist add Famous Planets to line 23

Code: Select all

OXPCONFIG_PAGEA2 = "Configure Famous Planets";
That's it. And you don't have to use all switches to be fully compatible :-) The script checks if a switch is declared or not, even if the database says that all switches should be used.
Post Reply