Oolite Bulletins

For information and discussion about Oolite.
It is currently Thu Oct 18, 2018 8:13 pm

All times are UTC




Post new topic  Reply to topic  [ 1434 posts ]  Go to page Previous 192 93 94 95 96
Author Message
 Post subject: Re: Scripters cove
PostPosted: Tue Aug 21, 2018 5:59 am 
Offline
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral

Joined: Wed Feb 28, 2007 7:54 am
Posts: 5259
Quote:
I am also looking at the Javascript function addCollisionException, but I am confused by it. For one thing, the name seems odd. For, the documentation seems to say that one uses it to prevent ships colliding. Also, how does that prevention work? Are the ships allowed to occupy the same space, but without taking damage? I presume that rather the ships are prevented from occupying the same space. How, though? Is it that, if the ship to which one adds the exception is powered, it will be made to try to avoid the other ship?
addCollisionException disables collision detection between the object it is applied on and the target object given by the function's argument. That's it, nothing special about it, really. When collision detection is disabled, stuff goes through other stuff. Here is a screenie of a Cobra which has its collision checks with the Coriolis disabled:
Image


Top
   
 Post subject: Re: Scripters cove
PostPosted: Tue Aug 21, 2018 6:26 am 
Offline
---- E L I T E ----
---- E L I T E ----

Joined: Sat Sep 12, 2009 11:58 pm
Posts: 1035
Location: Essex (mainly industrial and occasionally anarchic)
Hello a.n.

Ah, now I understand. Thanks. That routine is useless for my current purpose, but it should be good for the Hijacked Generation Ship (tm) in my Interstellar Tweaks, because ships launched from that do sometimes end up in the entrails of their mothership . .


Top
   
 Post subject: Re: Scripters cove
PostPosted: Mon Oct 01, 2018 6:46 pm 
Offline
---- E L I T E ----
---- E L I T E ----

Joined: Sat Sep 12, 2009 11:58 pm
Posts: 1035
Location: Essex (mainly industrial and occasionally anarchic)
Hey guys

How does the heat shield equipment work, programmatically? If I have a script increase the player ship's temperature, will the resulting temperature of that ship differ depending on whether the ship has a heat shield or not? Thanks. (I couldn't seem to find the answer in the docs.)


Top
   
 Post subject: Re: Scripters cove
PostPosted: Fri Oct 12, 2018 11:22 pm 
Offline
---- E L I T E ----
---- E L I T E ----

Joined: Sat Sep 12, 2009 11:58 pm
Posts: 1035
Location: Essex (mainly industrial and occasionally anarchic)
Also ('also' because: see my post above) I have the following problem.

I have this in a ship script:
Code:
this.$_fireQuirium = function() {
	log("ExtraThargoids", "OK 123." );
	this.ship.awardEquipment("EQ_QC_MINE");
	this.ship.commsMessage("We boom your bases!");
	this.ship.fireMissile("EQ_QC_MINE");
	this.$_deleteTimers();
};

And I get this in the log:
Code:
00:08:08.621 [ExtraThargoids]: OK 123.
00:08:08.959 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (Oolite Q-bomb AI 1.87): TypeError: this.explosion is undefined
00:08:08.959 [script.javaScript.exception.unexpectedType]:       Resources/AIs/oolite-qbombAI.js, line 40.
Oolite development version 1.87.0.7085-180729-89d301b (x86-64 test release) under Windows 6.3.9600.19155 64-bit.


Top
   
 Post subject: Re: Scripters cove
PostPosted: Sat Oct 13, 2018 4:20 am 
Offline
Deadly
Deadly
User avatar

Joined: Mon May 30, 2016 3:54 am
Posts: 179
Rustem had a new AI for the Q-Bomb: viewtopic.php?f=4&t=19298

Personally I use a very simple one which (most of the time) is actually working:
Code:
{
	GLOBAL = 
	{
		//ENTER = ("commsMessageByUnpiloted: [CWC_explosion_01]", "pauseAI: 5.0");
		ENTER = ("pauseAI: 5.0");
		UPDATE = ("setStateTo: DETONATE"); 
   };

	DETONATE = 
	{
		ENTER = (becomeEnergyBlast);
	};
}

_________________
Trying to survive behind the controls of a Caduceus Psi XT in Alpha test :lol:


Top
   
 Post subject: Re: Scripters cove
PostPosted: Sat Oct 13, 2018 3:32 pm 
Offline
---- E L I T E ----
---- E L I T E ----

Joined: Sat Sep 12, 2009 11:58 pm
Posts: 1035
Location: Essex (mainly industrial and occasionally anarchic)
Montana: ah, I see from that link that the Q-bomb has indeed been banned! Ha!

OK, this is working:
Code:
this.$_fireQuirium = function() {
	var qbomb = ship.spawnOne("extraThargoids_qmine"); 	 // inbuilt qmine AI is buggy.
	this.ship.commsMessage("We boom your bases!");
};
with this in shipdata:
Code:
	"extraThargoids_qmine" =
	{
		like_ship = "qbomb";
		ai_type = "extraThargoids_qMineAI.plist";
		roles = "energy-bomb(0) EQ_QC_MINE(0) extraThargoids_qmine";
		"script_info" = {"npc_shields" = no;};
	};
and the AI provided by Montana. Thanks!

EDITED.


Top
   
 Post subject: Re: Scripters cove
PostPosted: Sun Oct 14, 2018 3:41 am 
Offline
Deadly
Deadly
User avatar

Joined: Mon May 30, 2016 3:54 am
Posts: 179
Quote:
and the AI provided by Montana. Thanks!
Glad to help, I forgot to mention that you need to create your own Q-Weapon in order to make it work but you figured it out already. :)

_________________
Trying to survive behind the controls of a Caduceus Psi XT in Alpha test :lol:


Top
   
 Post subject: Re: Scripters cove
PostPosted: Thu Oct 18, 2018 4:49 pm 
Offline
Competent
Competent
User avatar

Joined: Sat Jan 20, 2018 4:08 pm
Posts: 61
Location: In The Dark
While doing some minor tweaking to the CombatMFD.oxz found a reference to the combatSLBar which allows your HUD to show a gauge that displays the service level (when the next maintenance overhaul is needed) for your ship. Got my head around how to make the actual gauge and put it into my Coluber HUD (position, size, colors, etc.) but cannot figure out how to get the hud.plist and the script.js to recognize one another and talk back and forth to actually get the gauge working and updating itself. Always wanted a status update on my ship's service level. Found it odd that Maintenance Overhauls come as a surprise when you dock given the technical sophistication of the ships in the game.

Went through the function setCustomHUDDial(key : String, value : Value) for the script.js and the drawCustomBar: - a number between 0 and 1 for the hud.plist but any combination of things tried did not work.

In the script.js is the function setCustomHUDDial(key : String, value : Value) a this., a var., an if., or just a function? The (key : String, value : Value) part made some sense with the key being a number between 0 and 1 and the string referencing combatSLBar but what are the entries for (..., value : Value)?

My other guess for the hud.plist drawCustomBar: - a number between 0 and 1 is that this entry would reference whatever number between 0 and 1 was entered for the key value in the JavaScript string. Where exactly though does this entry go in hud.plist? Understood that it must go with the other entries for the specific gauge in question but does it go left or right? Does it look like this:
Code:
 drawCustomBar: = <key#>;
or like this:
Code:
<?something?> = drawCustomBar: <key#>;
Surely this is an easy one for you JavaScript / .plist pros out there and specific answers to help this scripting newcomer would be greatly appreciated. Thank you for your time and effort.

_________________
Humor is the second most subjective thing on the planet

Brevity is the soul of wit and vulgarity is wit's downfall

Good Night and Good Luck - Read You Soon


Top
   
 Post subject: Re: Scripters cove
PostPosted: Thu Oct 18, 2018 7:19 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Wed Aug 15, 2012 4:19 am
Posts: 2531
Location: Finland
Let's see if I can be of some assistance. First you need to define the custom dial in hud.plist. Something like this in the dials section:
Code:
		{
			...
			"selector" = "drawCustomBar:";
			"data_source" = "customDialExample";
			...
		}
Then you need to define that custom dial value (the one referenced with data_source) in a world script. And if you want it to change, you need to use a timer or some event trigger. For example something like this:
Code:
this.shipLaunchedFromStation = function() {
	this.$customDialValue = 0;
	this.$customDialTimer = new Timer(this, this.$customDialUpdate, 0, 0.1);
}

this.$customDialUpdate = function() {
	this.$customDialValue = this.$customDialValue + 0.1;
	if (this.$customDialValue > 1) {
		this.$customDialValue = 0;
	}
	player.ship.setCustomHUDDial("customDialExample", this.$customDialValue);
}
Hope that makes some sense. It's been a while.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1434 posts ]  Go to page Previous 192 93 94 95 96

All times are UTC


Who is online

Users browsing this forum: Bing [Bot], Prester John and 29 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited