Oolite Bulletins

For information and discussion about Oolite.
It is currently Sun Dec 09, 2018 9:53 pm

All times are UTC




Post new topic  Reply to topic  [ 1443 posts ]  Go to page Previous 193 94 95 96 97 Next
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: 5304
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: 1054
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: 1054
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: 1054
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: 200
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: 1054
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: 200
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
Dangerous
Dangerous
User avatar

Joined: Sat Jan 20, 2018 4:08 pm
Posts: 80
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: 2543
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
   
 Post subject: Re: Scripters cove
PostPosted: Thu Oct 18, 2018 8:53 pm 
Offline
Dangerous
Dangerous
User avatar

Joined: Sat Jan 20, 2018 4:08 pm
Posts: 80
Location: In The Dark
Thank you spara. What you posted does make sense to me. Adapting it to my needs will be another story.

Fingers crossed that it will work out.

_________________
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: Fri Oct 19, 2018 12:36 am 
Offline
Dangerous
Dangerous
User avatar

Joined: Sat Jan 20, 2018 4:08 pm
Posts: 80
Location: In The Dark
No luck. Can get the gauge to appear where desired in the HUD but cannot get it to update at all. Not sure why. The combatSLBar does have its own data set as follows:
Code:
this.$setData("combatSLBar", (player.ship.serviceLevel-75)/25);
Perhaps Norby is the person to contact as he created the combatmfd.oxz and lent a hand to the Coluber HUD as well. PM on the way.

_________________
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: Fri Oct 19, 2018 2:41 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Wed Aug 15, 2012 4:19 am
Posts: 2543
Location: Finland
Quote:
No luck. Can get the gauge to appear where desired in the HUD but cannot get it to update at all. Not sure why. The combatSLBar does have its own data set as follows:
Code:
this.$setData("combatSLBar", (player.ship.serviceLevel-75)/25);
Perhaps Norby is the person to contact as he created the combatmfd.oxz and lent a hand to the Coluber HUD as well. PM on the way.
Let's hope that Norby answers your call. In the meantime, note that every time you want to change the gauge value, you need to call for
setCustomHUDDial. Don't know the exact pieces of your puzzle, but if that this.$setData... is a function that updates the gauge, check that it actually gets executed in a timer or in an event handler.


Top
   
 Post subject: Re: Scripters cove
PostPosted: Fri Oct 19, 2018 9:02 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Mon May 20, 2013 9:53 pm
Posts: 2541
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Hi Nite Owl,

CombatMFD contain a 0.25s timer which update the value of combatSLBar and Large HUD in HUDSelector display it below the scanner, labeled as Hull.
If you want an independent solution then just set one in a timer like this:
Code:
var p = player.ship; 
p.setCustomHUDDial("ColuberSLBar", (p.serviceLevel-75)/25);
Then place the selector into coluber_hud.plist, for example:
Code:
{     data_source = "ColuberSLBar"; selector = "drawCustomBar:"; draw_surround = yes;
      alert_conditions = 14; //do not show in the dock
      alpha = 1.0; height = 2; width = 35; x = -125; y = 23; y_origin = -1; },

_________________
OXPs by Norby


Top
   
 Post subject: Re: Scripters cove
PostPosted: Sat Oct 20, 2018 12:08 am 
Offline
Dangerous
Dangerous
User avatar

Joined: Sat Jan 20, 2018 4:08 pm
Posts: 80
Location: In The Dark
Thank you Norby.

The scripting details are starting to make sense to me but before the time is spent putting them into practice there is a bit of confusion on my part as to exactly which player ship status the Combat Service Level Bar is measuring.

Service Level Bar made me think (as stated in my original post on this) that the maintenance level of the player's ship was being measured. That is the number of, and/or damage from, Witchspace Jumps that the player's ship had taken until the next Maintenance Overhaul was needed.

Looking through the Wiki entries you linked to in your post, and with the "Hull" label on the Combat Service Level Bar in the Wiki's pictures, it appears that the incoming battle damage to the hull, from whatever source, is being measured.

Not 100% sure which one of these two is correct. A very useful gauge to have in either case. Although, truth be told, option one was what was hoped for.

Thank you both, once again, for you help with this. It is deeply appreciated. My brain hurts much less now. May actually get some sleep tonight without variables dancing on my pillow.

_________________
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: Sat Oct 20, 2018 1:05 am 
Offline
Commodore
Commodore
User avatar

Joined: Tue Jan 21, 2014 10:37 pm
Posts: 2222
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...
Quote:
Not 100% sure which one of these two is correct.
You're understanding of Service Level is correct in what it does from the game's perspective. However, that internal concept doesn't easily translate into a game-world concept. What Norby has done is given it a game-world frame of reference. It is not, in any way, related to the state of the hull, but the appearance of the hull would be a readily observable state someone in the game would be able to see. So Norby has drawn a line between the two.

It's worth noting that some properties of ships are not inherently designed to be displayed to the player, given the function they perform in the game (Service Level, AI states for NPC's, even roles sand role weights). They're used to maintain game state, but it doessn't always make sense to display them as-is.

_________________
My OXP's
YouTube: Oolite Teaser Trailer


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1443 posts ]  Go to page Previous 193 94 95 96 97 Next

All times are UTC


Who is online

Users browsing this forum: DavidG and 24 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