Scripters cove

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Old Murgh
Wiki Wizard
Wiki Wizard
Posts: 640
Joined: Sat Dec 04, 2021 11:01 pm

Re: Scripters cove

Post by Old Murgh »

phkb wrote: Thu Jul 21, 2022 10:07 pm
You'd need to use (1, 1). But in that case, there is no need to call the function at all, because it would only ever return 1.
Thank you.
I was young, I was naïve. [EliteWiki] Jonny Cuba made me do it!
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

Old Murgh wrote: Thu Jul 21, 2022 9:57 pm
// spawns 1 - 3 ships with role scrub
The random function would return a number between and 1 and 2, not 1 and 3.
User avatar
Old Murgh
Wiki Wizard
Wiki Wizard
Posts: 640
Joined: Sat Dec 04, 2021 11:01 pm

Re: Scripters cove

Post by Old Murgh »

phkb wrote: Thu Jul 21, 2022 10:14 pm
Old Murgh wrote: Thu Jul 21, 2022 9:57 pm
// spawns 1 - 3 ships with role scrub
The random function would return a number between and 1 and 2, not 1 and 3.
Thanks for pointing out. Probably an old comment not kept up with a change.
I was young, I was naïve. [EliteWiki] Jonny Cuba made me do it!
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

Slartibartfast wrote: Thu Jul 21, 2022 1:53 pm
--> equipment.plist / TL99

hmmm

a "condition-script " as solution
for me that seems to be more a "workaround"


==> for the next time i stay with "99"

and :wink:
( linux/bash)

Code: Select all

grep -v deprecated Latest.log > Last.log
TL99 was used to restrict access to equipment, if, for example, you wanted to hide the equipment generally, and then programmatically give the equipment to the player. But there are limits: using TL99 means there is no where in the galaxy you can go to fix it if it's damaged, and you wouldn't be able to easily repair it. TL99 also means it will *never* appear on the F3 screen, and the only way to get it is programmatically.

A condition script gives you full control over the equipment item, allowing you to accurately define it's TL, so it can fit into the standard repair mechanisms, while still limiting if and when the equipment item is offered for sale. You could limit by station type, or government, or economy, or anything else.

So, not really a "workaround". A condition_script gives you full control, and better integration with the core game mechanics.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Re: Scripters cove

Post by another_commander »

What phkb said. In fact, TL 99 has always been a hack and the condition script is the proper way to do it. But, as long as the hack is still present, one can use whatever feels easier and simpler for them.
User avatar
Slartibartfast
Deadly
Deadly
Posts: 175
Joined: Mon Jan 21, 2008 3:54 pm

Re: Scripters cove

Post by Slartibartfast »

Hello

O.K.

i understand
the condition script is the "Bentley"

but i only need a backpack

Code: Select all

(99,0,"Remaining Module-Rackspace","EQ_RACKSPACE","Rackspace bla bla bla",
		{
			"available_to_all" = yes;
			"requires_equipment" = "EQ_Q_BASE_SYSTEM";
			"requires_cargo_space" = 0;
			"display_color" = "blueColor";  //  only for testing 
			"visible" = yes; 
			"can_carry_multiple" = yes;
			"damage_probability" = 0;
			"installation_time" = 0;
			"can_carry_multiple" = yes;
			"portable_between_ships" = no;
		}
!! its a placeholder - in two ways
------- programming / easy to handle
------ gameplay - its a part of the base_system and holds place for modules

matthias
Oolite 1.91 / Imp. Trader ( slighly modified :wink: ) on Lubuntu 22.04 LTS on AMD64 2x 3800+ ,
ATI Radeon R7240 XFS / Samsung TV 40" 1080p
C-Media CMI8738 / Yamaha RX-V575 / DIY-Speaker
Logitech Attack3 & standard german keyboard
User avatar
montana05
---- E L I T E ----
---- E L I T E ----
Posts: 1166
Joined: Mon May 30, 2016 3:54 am
Location: lurking in The Devils Triangle (G1)

Re: Scripters cove

Post by montana05 »

Slartibartfast wrote: Fri Jul 22, 2022 10:49 am
Hello

O.K.

i understand
the condition script is the "Bentley"

but i only need a backpack

Not exactly, as 3 persons tried to tell you, a condition script is standard while TL 99 is a hack.
Scars remind us where we've been. They don't have to dictate where we're going.
User avatar
Slartibartfast
Deadly
Deadly
Posts: 175
Joined: Mon Jan 21, 2008 3:54 pm

Re: Scripters cove

Post by Slartibartfast »

hi

Code: Select all

a condition script is standard while TL 99 is a hack.
yes yes -- i already understood

but no matter....

--------------------
i have tried to find an example with the same properties, that i need, in different oxp/oxz
---> no success

btw.
i have problems to understand the information in some wiki pages and
the "names" of a some functions etc.
f.x. "allowAwardEquipment" -- for me it sounds like " allow to award equipment"
--- therefore -i thought - "this must be a condition for ships / not for equipment"

please
can someone post a fitting example ( i wanna do it right )

thx
matthias
Oolite 1.91 / Imp. Trader ( slighly modified :wink: ) on Lubuntu 22.04 LTS on AMD64 2x 3800+ ,
ATI Radeon R7240 XFS / Samsung TV 40" 1080p
C-Media CMI8738 / Yamaha RX-V575 / DIY-Speaker
Logitech Attack3 & standard german keyboard
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

Slartibartfast wrote: Fri Jul 22, 2022 8:32 pm
can someone post a fitting example ( i wanna do it right )
In it's most simplest form, using a condition script would look like this:
equipment.plist

Code: Select all

(
	(
		5, 1000, "Remaining Module-Rackspace","EQ_RACKSPACE","Rackspace bla bla bla",
		{
			"available_to_all" = yes;
			"condition_script" = "myequipment_conditions.js";
			"requires_equipment" = "EQ_Q_BASE_SYSTEM";
			"requires_cargo_space" = 0;
			"display_color" = "blueColor";  //  only for testing 
			"visible" = yes; 
			"can_carry_multiple" = yes;
			"damage_probability" = 0;
			"installation_time" = 0;
			"can_carry_multiple" = yes;
			"portable_between_ships" = no;
		}
	),
)
Then, create a file called "myequipment_conditions.js" in the "Scripts" folder

Code: Select all

"use strict";
this.name = "MyEquipment_Conditions";

this.allowAwardEquipment = function (equipment, ship, context) {
	if (context == "scripted") return true;
	return false;
}
And that's it. Your equipment won't be offered for sale anywhere, but it can be awarded programmatically.
Slartibartfast wrote: Fri Jul 22, 2022 8:32 pm
"allowAwardEquipment" -- for me it sounds like " allow to award equipment"
I think the name comes from the function you execute to give equipment to a ship: ship.awardEquipment. So, what "allowAwardEquipment" is saying is "Allow the 'awardEquipment' function".
User avatar
Slartibartfast
Deadly
Deadly
Posts: 175
Joined: Mon Jan 21, 2008 3:54 pm

Re: Scripters cove

Post by Slartibartfast »

thx


==> code
i`ll try now

----------------------------------------

Code: Select all

I think the name comes from the function you execute to give equipment to a ship: ship.awardEquipment. So, what "allowAwardEquipment" is saying is "Allow the 'awardEquipment' function"
such explanations i miss in the wiki // maybe for experienced developers this is not necessary
-- - but that would help (and did not frustrate newbies like me. )
Oolite 1.91 / Imp. Trader ( slighly modified :wink: ) on Lubuntu 22.04 LTS on AMD64 2x 3800+ ,
ATI Radeon R7240 XFS / Samsung TV 40" 1080p
C-Media CMI8738 / Yamaha RX-V575 / DIY-Speaker
Logitech Attack3 & standard german keyboard
User avatar
Slartibartfast
Deadly
Deadly
Posts: 175
Joined: Mon Jan 21, 2008 3:54 pm

Re: Scripters cove

Post by Slartibartfast »

Hi

this seems to work: :D

Code: Select all

//  test
"use strict";
this.name = "QVE_Rackspace_Conditions";

var context = "scripted";   //  added

this.allowAwardEquipment = function (equipment, ship, context) {
	if (context == "scripted") return true;
	return false;
}
but i did not understand the description in the wiki so far :(

good night
Slartibartfast
Oolite 1.91 / Imp. Trader ( slighly modified :wink: ) on Lubuntu 22.04 LTS on AMD64 2x 3800+ ,
ATI Radeon R7240 XFS / Samsung TV 40" 1080p
C-Media CMI8738 / Yamaha RX-V575 / DIY-Speaker
Logitech Attack3 & standard german keyboard
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Scripters cove

Post by Switeck »

I'm having problems getting the desired escorts for a Boa 2...

Which one of these should work:

"escort_role" = "navy-asp";
"escort-role" = "navy-asp";
"escort-ships" = "navy-asp";
"escort-ship" = "navy-asp";
"escort_ship" = "navy-asp";
"escort_ships" = "navy-asp";
User avatar
montana05
---- E L I T E ----
---- E L I T E ----
Posts: 1166
Joined: Mon May 30, 2016 3:54 am
Location: lurking in The Devils Triangle (G1)

Re: Scripters cove

Post by montana05 »

Switeck wrote: Sat Jul 23, 2022 2:27 am
I'm having problems getting the desired escorts for a Boa 2...

Which one of these should work:

"escort_role" = "navy-asp";
"escort-role" = "navy-asp";
"escort-ships" = "navy-asp";
"escort-ship" = "navy-asp";
"escort_ship" = "navy-asp";
"escort_ships" = "navy-asp";
For simple escorts you can use

escort_role (the role of the ship) or
escort_ship (the key of the ship).

Combining it with escorts and a number might be useful.

escort_roles offers you a variable number of escorts, you can assign only 1 ship (role) with min and max so that in more dangerous systems more escorts will be assigned.
Scars remind us where we've been. They don't have to dictate where we're going.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

Slartibartfast wrote: Sat Jul 23, 2022 2:01 am

Code: Select all

var context = "scripted";   //  added
That line is unnecessary. "context" is passed into the function by the core code when it's checking the equipment item. If you were encountering situations that made that line of code necessary, then something else is happening, and we'd need a bit of context to help out.
Slartibartfast wrote: Sat Jul 23, 2022 2:01 am
but i did not understand the description in the wiki so far
I've updated the wiki a bit to hopefully explain things a bit more. It's a bit tricky: as you say earlier, I find it easy to understand, but I'm a programmer. It's hard to know where exactly to add descriptions, without writing an OXP for every function! (Although, perhaps, in fairness, an OXP for every function is what is needed for non-programmers to get their heads around it).
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Scripters cove

Post by Switeck »

montana05 wrote: Sat Jul 23, 2022 4:34 am
Switeck wrote: Sat Jul 23, 2022 2:27 am
I'm having problems getting the desired escorts for a Boa 2...
For simple escorts you can use

escort_role (the role of the ship) or
escort_ship (the key of the ship).

Combining it with escorts and a number might be useful.

escort_roles offers you a variable number of escorts, you can assign only 1 ship (role) with min and max so that in more dangerous systems more escorts will be assigned.
Neither
escort_role (the role of the ship) nor
escort_ship (the key of the ship)
...seem to work.

Where there is supposed to be 1 escort ship-type, I'm seeing Geckos, Mambas, Sidewinders, Cobra 1's and 3's, etc!

I am using a separate line of:
escorts = 4;
...To define how many escorts to have.

The ships I'm trying to make escorts exist, as I can spawn them separately using this line:

Code: Select all

system.addGroup("navy-asp", 4, [0,0,0], 30E3);
Post Reply