Scripting requests

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

code request:

Post by Arexack_Heretic »

SetTargetAsMother

Makes the current target of the entity its Mother. (or Leader for that matter)

It would be usefull for non-standard escorting, guarding, etcetera.
Riding the Rocket!
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Again, much too specific and tied to the current scripting model.

Once the JavaScript object model is fleshed out, that’ll be something like “ship.target = ship.leader”. Specific methods for every possible combination of properties will no longer be needed.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

I understood you wanted specific requests...
:x
We can only reason from past experience.
I can't know how the Java-scripting is going to handle things.

But if as you say, methods can be specified on the fly, then many things will be possible. :D
Riding the Rocket!
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

I understood Ahruman in the same way as you did, A_H, so you're not the only one.

Anyway, a method for making an entity the mother of other entities (called by the respective daughter-entities) is exactly what I need for my sentinel asteroids-problem, I guess.

So I second the request.

And (as I don't know if that is self-evident) all entities tying themselves to the same mother via this method should also become a group and therefore get able to reply to groupAttackTarget etc.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Interesting. I intended to write “Post a description rather than desired method name” where it currently says “ Post a description of the desired method name”. I also vividly remember fixing this typo several days ago. Bah.

Anyway… a useful request discusses capabilities, rather than explicit code (in either the existing model or JS).
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

I always post requests as a

proposedMethodName
+
description of function in the game engine ( +subject and object ) as I percieve it to work.
Riding the Rocket!
User avatar
Flying_Circus
Dangerous
Dangerous
Posts: 118
Joined: Thu Dec 09, 2004 10:04 pm
Location: Hexham, UK

Post by Flying_Circus »

Wouldn't an 'ignore friendly fire' method be useful? For instance, if it could be tied to scan-class, it would prevent protracted Galcop-on-Galcop firefights developing, and if scan-class could be user-defined it would allow factional OXPs to be developed.

Let me know if you want me to ellucidate further, and feel free to contribute any of you own suggestions (if you've understood, this far, that is).
And so I gave myself to God. There was a pregnant pause before He said "OK"
Image
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Timers. Something like:

Code: Select all

RegisterTimer("Stuff I need to do", myCallback, 42.0);
where "Stuff I need to do" is a unique (to the script) identifier, myCallback is a JavaScript function, and 42.0 is a time in seconds (in play time; also need a clear discussion of real time vs. play time vs. clock time). Not in 1.68. (Motivation: this is both more efficient and more precise than running stuff off the tickle timer.)
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Ability to play “cabin sounds” (sounds with no spacial localization – not a meaningful distinction, yet) and music. Events for various things that make noise (weapons fire). Standard sound effects for these events being moved out into scripts, which can be overridden.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

JavaScript for non-player ships. This will take over the responsibilities of AIs, but also other stuff; for instance, spawn_actions and death_actions will be replaced with ship script events. I’m not sure how to replicate the ability to change AIs that’s currently in place, or whether that will be needed. Possibly ships will have a script and an AI as separate entities.

Ship scripts will look quite a lot like world scripts, only receiving events for their respective ships rather than the player.

Scripts should be able to send commands directly to any entity.
User avatar
Dr. Nil
---- E L I T E ----
---- E L I T E ----
Posts: 983
Joined: Thu Sep 28, 2006 5:11 pm
Location: Nearest Hoopy Casino
Contact:

Post by Dr. Nil »

Good job on updating Oolite.

Things I'd like to be able to control with an OXP:

Current system (to have a ship the player is docked with travel to a chosen system or interplanetary space between two chosen systems).

Player ship (I'd like to be able to control which ship and which equipment a player has and to be able to 'store' a ship and it's configuration in the save file for later retrieval).

Both would be necessary for Sidewinder Commander
Sidewinder Commander.

The commander is hired by the navy as a Sidewinder pilot. They store his ship while he works his way up in the navy ranks by completing missions from millitary bases and carriers in ever cooler naval ships.

Mostly very short intensely battle oriented missions like carrier defense or interstellar raid. The pay is lousy but there's lots of action and zero expenses.

Instead of paying for gear you are given equipment according to the mission and of course matching your expendability (rank) with the expendability of your gear to the navy.

I.e. you will only get a beam laser equipped sidewinder with nothing else to begin with and have to balance your play between letting others with better equipment take more of the heat in large battles, while still trying to grap some glory in order to advance in rank and get better equipped.
And there would probably be a lot of other cool uses for such features.
Image

300 billboards in Your Ad Here!
Astromines and more in Commies.
AVAILABLE HERE along with other Oolite eXpansion Packs.
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2882
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Post by LittleBear »

A death_by_player_action (as an alternative to death_actions) would be handy.

Oolite presumabley knows that the player rather than an NPC was responsible for a ships death as it awards a kill, but a way for the script to act on this would be useful in combat / escort missions.

EG: Death_actions can be used to advance a counter in a "defend the trade fleet" type mission where a certain number of deaths gives a "tried but failed" briefing. However, carless use of an e-bomb by the player could give a "what did you think you were doing, you were meant to be defending them!" briefing, possibley earning the employer's wrath!

Friendly Fire can be done with an AI that does not go to "Attack Ship" just because the ship has been attacked. EG:-

Code: Select all

"LOOK_FOR_TARGETS" = {
ENTER = (switchLightsOff, "scanForNearestShipWithRole: victim9");
        "ATTACKED" = ("setStateTo: LOOK_FOR_TARGETS"); 
        "INCOMING_MISSILE" = (fightOrFleeMissile, "setStateTo: LOOK_FOR_TARGETS"); 
		"TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: ATTACK_SHIP"); 
        	"NOTHING_FOUND" = ("setStateTo: LOOK_FOR_TARGETS2"); 
EXIT = ();
	UPDATE = ("scanForNearestShipWithRole: victim9");
	};

"LOOK_FOR_TARGETS2" = {
ENTER = (switchLightsOff, "scanForNearestShipWithRole: warfrigate");
        "ATTACKED" = ("setStateTo: LOOK_FOR_TARGETS"); 
        "INCOMING_MISSILE" = (fightOrFleeMissile, "setStateTo: LOOK_FOR_TARGETS"); 
		"TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: ATTACK_SHIP"); 
        	"NOTHING_FOUND" = ("setStateTo: LOOK_FOR_TARGETS"); 
EXIT = ();
	UPDATE = ("scanForNearestShipWithRole: warfrigate");
	};

If the Gobal sets the state to look for targets, then this ship will only fire on or return fire to ships with the role victim9 or warfrigate. If a ship from its own side hits it, rather than switching to attack ship it attacks the nearest enemy ship.
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
docwild
Dangerous
Dangerous
Posts: 64
Joined: Thu Mar 29, 2007 1:36 pm

Post by docwild »

yoink
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

LittleBear wrote:
A death_by_player_action (as an alternative to death_actions) would be handy.
Hopefully it will be possible for ship-attached JavaScript scripts to get a “who killed me” parameter to their didBecomeDead() handler.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Ahruman wrote:
Hopefully it will be possible for ship-attached JavaScript scripts to get a “who killed me” parameter to their didBecomeDead() handler.
Update on this: the world script event for player deaths now has two paramaters, “whodunnit” and “context”, as in:

Code: Select all

this.didBecomeDead = function(whodunnit, context)
{
    Log("Gadzooks! Player was killed by " + whodunnit + " through " + context + ".");
}
Context can (currently) be one of:
  • “energy damage” (whodunnit is a ship)
  • “scrape damage” (whodunnit is a ship)
  • “heat damage” (whodunnit is null)
  • “hit a planet” (whodunnit is a planet)
There will be a similar takeDamage() event for energy, scrape, and possibly heat damage.

My intention is (still) to have NPC scripts look similar to world scripts, so the same principle will apply.

Oh, it’ll also be possible for NPC scripts to suppress explosions in their death handlers.
Post Reply