Scripting requests

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 5389
Joined: Wed Feb 28, 2007 7:54 am

Re: Scripting requests

Post by another_commander » Mon Dec 16, 2013 1:11 pm

Zireael wrote:2) Guuys, there's 4 more function keys after F8, they could be used for something useful in the future.
Ehm, actually 3. F12 on the Win/Linux builds (not sure about Mac) toggles full screen on/off.

User avatar
Commander McLane
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: Scripting requests

Post by Commander McLane » Mon Dec 16, 2013 9:53 pm

Zireael wrote:2) Have a key for console message log just like there's ~ for comms log.
Console messages are not logged. That's what distinguishes them from comms messages. If you want a message to be logged, use a comms message.

Zireael
---- E L I T E ----
---- E L I T E ----
Posts: 1396
Joined: Tue Nov 09, 2010 1:44 pm

Re: Scripting requests

Post by Zireael » Wed Dec 18, 2013 8:14 am

One more thing I just remembered:
I thought I saw it mentioned somewhere in the vast Progress thread that 1-8 keys have been decoupled from F1-F8. I thought that we could bind 1-8 instead to the primable equipment in order of the player acquiring them. Equipment granted automatically (such as Chupa missile ID) would be on 1, Dock Assist I bought first would be on 2 and Telescope would be at 3. I could have up to 8 such pieces of equipment and I wouldn't have to worry about cycling through them...
This would save players a lot of hassle with Shift+N cycling.

User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4018
Joined: Fri Nov 11, 2011 6:19 pm

Re: Scripting requests

Post by cim » Wed Dec 18, 2013 8:51 am

1.79 has two fast activation keys for primable equipment, plus you can have a third item on 'n' as usual. Do many people really have that much equipment on board their ships that they need instant access to four or more primable items?

Another thing that might be useful if you do have that much - you can customise your HUD to include a "drawPrimedEquipment:" dial with "n_bars" > 1

The other thing is that not every keyboard gives particularly easy access to the Fn keys, so we'd prefer to keep the default bindings for 1-8 as they are.

Zireael
---- E L I T E ----
---- E L I T E ----
Posts: 1396
Joined: Tue Nov 09, 2010 1:44 pm

Re: Scripting requests

Post by Zireael » Wed Dec 18, 2013 2:07 pm

another_commander wrote:
Zireael wrote:2) Guuys, there's 4 more function keys after F8, they could be used for something useful in the future.
Ehm, actually 3. F12 on the Win/Linux builds (not sure about Mac) toggles full screen on/off.
*slaps forehead* Right.

And expanding on the idea of using F9-F11, I just thought we could slap some sort of in-game Ooniverse info under F10, coded similar to the F4 menu, and just kept separately to avoid undue clutter in F4. Thoughts.

User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 884
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: Scripting requests

Post by Pleb » Wed Mar 05, 2014 9:16 pm

I'm sure this is possible but I can't find any mention of it anywhere. Is there a way of making a carrier/station refuse docking clearance by script? For example, make a station/carrier refuse docking clearance to player unless a specific variable was enabled?

User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4018
Joined: Fri Nov 11, 2011 6:19 pm

Re: Scripting requests

Post by cim » Wed Mar 05, 2014 11:40 pm

The [url=http://wiki.alioth.net/index.php/Oolite_JavaScript_Reference:_ship_script_event_handlers#Docks_Only]acceptDockingRequestFrom[/url] event is probably what you're looking for, if you want to refuse docking clearance to some ships but not others.

If you just want to enable and disable the dock, the various dock properties are probably sufficient. Note that if you really want to keep the player out - not just fine them for docking without clearance - disallowedDockingCollides is needed.

User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 884
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: Scripting requests

Post by Pleb » Fri Mar 07, 2014 10:32 pm

I can't seem to get the acceptDockingRequestFrom function to work. I have the following:

Code: Select all

this.acceptDockingRequestFrom = function(ship)
{
	if (ship.scanClass == "CLASS_PLAYER")
	{
		return false;
	}
}
But doesn't seem to make a difference... :(

User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4018
Joined: Fri Nov 11, 2011 6:19 pm

Re: Scripting requests

Post by cim » Fri Mar 07, 2014 10:58 pm

Pleb wrote:I can't seem to get the acceptDockingRequestFrom function to work. I have the following:

Code: Select all

this.acceptDockingRequestFrom = function(ship)
{
	if (ship.scanClass == "CLASS_PLAYER")
	{
		return false;
	}
}
But doesn't seem to make a difference... :(
You probably want to return true if the ship is not the player, and ship.isPlayer is a more reliable test. Still, that should be denying docking to the player - unless you've placed it in the wrong script: it needs to be in the dock's ship script, not the station's (because you might have multiple docks with different rules)

User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 884
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: Scripting requests

Post by Pleb » Sat Mar 08, 2014 8:36 pm

Still isn't working, this is the whole script:

Code: Select all

"use strict";

this.name 			= "himsn_carrier_dock.js";
this.author         = "Pleb";
this.copyright      = "(C) 2014 Pleb.";
this.licence        = "CC-NC-by-SA 2.0";
this.version 		= "0.6";

this.shipSpawned = function ()
{
	this.ship.allowsDocking = true;
}

this.acceptDockingRequestFrom = function(ship)
{
	if (ship.isPlayer)
	{
		return false;
	}
	else
	{
		return true;
	}
}

User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4018
Joined: Fri Nov 11, 2011 6:19 pm

Re: Scripting requests

Post by cim » Sat Mar 08, 2014 8:58 pm

Should be fixed in commit e57bac0

It should also work now if you use the docking computer.

Thanks for the report

User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 884
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: Scripting requests

Post by Pleb » Sun Mar 09, 2014 11:39 am

Yay! This works now, thanks cim! :mrgreen:

User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 884
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: Scripting requests

Post by Pleb » Sat Mar 15, 2014 10:13 am

Just another quick one regarding docks, if the disallowedDockingCollides is read-only, as specified on the wiki, how would I set this to true to ensure that it is impossible to dock?

User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4018
Joined: Fri Nov 11, 2011 6:19 pm

Re: Scripting requests

Post by cim » Sat Mar 15, 2014 10:23 am

Documentation fixed. (It's been read/write all along...)

Thanks for testing out all these new features.

User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 884
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: Scripting requests

Post by Pleb » Sat Mar 15, 2014 10:51 am

I'm not sure whether it's me missing something or this particular function not working the way it's supposed to (but I'm guessing it's probably the first one), but I'm still able to dock. I can disallow docking clearance but I can still dock:

Code: Select all

"use strict";

this.name 			= "himsn_station_dock.js";
this.author         = "Pleb";
this.copyright      = "(C) 2014 Pleb.";
this.licence        = "CC-NC-by-SA 2.0";
this.version 		= "0.7";

this.shipSpawned = function ()
{
	this.ship.allowsDocking = false;
	this.ship.disallowedDockingCollides = true;
}

this.acceptDockingRequestFrom = function(ship)
{
	return false;
}
This is a more simplified version of the actual script but even this will not work... :(

And thank you for all the new features, I wouldn't be able to implement Gimi's ideas for the HIMSN OXZ without them! :D

Post Reply