The Feudal States

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

Moderators: another_commander, winston

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 »

That is pretty odd… I would have expected an anarchy symbol.

No, really.

User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Ramirez wrote:Now, using the ship's own ship script, with an appropriate trigger I can record some of its details as a mission variable. The bit I particularly need is the [house]-knight part. As the ship was created using a primary role of 'feudal-knight' I need to use the this.ship.roles function to pick up the other role. I can select the bit I need using code like this
I am not sure but do you mean something like this: this.array=system.shipsWithRole("myRole")
You can also give a range to limit the search range. In contrast to shipsWithPrimaryRole() this one evaluates all roles.

User avatar
Ramirez
---- E L I T E ----
---- E L I T E ----
Posts: 628
Joined: Mon Nov 07, 2005 9:52 am
Location: London, UK

Post by Ramirez »

I've been trying to use system.shipsWithRole but I'm having trouble making use of the results. To explain, I've set up a buoy that scans for ships in the area, and I've been testing it by having it send a comms message to me containing the results of the search. I can get the buoy to do system.shipsWithRole and I get an array that contains the full entity details of relevant ships, e.g:

Code: Select all

Ship "Feudal Knight (Gelaed)" ID: 212 position (xxx,yyy,zzz,) ScanClass: CLASS_NEUTRAL status: STATUS_IN_FLIGHT
What I then want to do is for each element in the array, search for certain strings, e.g. a certain feudal house or ship type.

I looked around for help on javascript functions and came across indexOf, which looked as if it would do the job. However, while I can use it to search the results of this.ship.roles, it doesn't seem to work with the results of system.allShips or system.shipWithRole, even when looking at just one element in the array.

For example, the tournament buoy has roles of 'feudal-buoy' and 'testrole'. I put this in its ship script:

Code: Select all

this.logDetails = function()
{
  var list = this.ship.roles
  var details = list.indexOf("testrole")
  this.ship.commsMessage(details)}
This worked, correctly finding testrole as the second element in the array. As I also wanted to be able to do partial matches within arrays I came up with this bit of code that seemed to work:

Code: Select all

this.logDetails = function()
{
  var list = this.ship.roles
  var list2 = list[1]
  var details = list2.indexOf("test")
  this.ship.commsMessage(list2)}
This was able to pick out any text contained in the string 'testrole'. Given that both this.ship.role and system.shipsWithRole both return results as arrays, I thought I could use the same technique, e.g:

Code: Select all

this.logDetails = function()
{
  var list = system.allShips
  var list2 = list[1]
  var details = list2.indexOf("Coriolis")
  this.ship.commsMessage(details)}
When I try this though, I get an error saying 'list2.indexOf' isn't a function. If I remove the list2 = list[1] step, the indexOf function runs but returns a negative result as it can't do a partial match against the entity data.

A possible way to get around this is if the buoy could somehow run the ship.roles on the entities it identifies as having a certain primary role, as it seems I can search the results of ship.roles with no trouble.
Download Resistance Commander plus many other exciting OXPs HERE

User avatar
Svengali
---- E L I T E ----
---- E L I T E ----
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Post by Svengali »

indexOf returns only the position where the entry is found in the array. If not found it returns -1. What you're looking for is more .match('test').

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 »

Ramirez wrote:

Code: Select all

this.logDetails = function()
{
  var list = this.ship.roles
  var list2 = list[1]
  var details = list2.indexOf("test")
  this.ship.commsMessage(list2)}
Since roles is an array of strings, list2 is a string rather than an array. indexOf is defined for strings, but it could be that list2 is undefined because list[1] is the second element of the list – list[0] is the first.

User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

One thing I'd do is to find out exactly what list2 is ...

If in doubt, just add something like

Code: Select all

log('list2 = [['+list2+']]');
just after the line where you define list2.

In normal js usage, string.indexOf(substring) should return the (first matching) substring's position within string, or -1 if not found.

I thought ship.roles was actually just a string containing the names of all possible roles.
If that's the case, I would expect the first list2 to just contain the second character of the ship.roles string.

edit:
assuming that the second entry of the allShips array actually contains the station, I would expect this to produce what you're actually looking for...

Code: Select all

this.logDetails = function()
{
  var list = system.allShips
  var list2 = list[1].roles
  var details = list2.indexOf("Coriolis")
  this.ship.commsMessage(details)}
But then again, I'm not really sure about what you're looking for!
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)

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 »

Kaks wrote:I thought ship.roles was actually just a string containing the names of all possible roles.
It’s documented, you know. And the documentation happens to be right:

Code: Select all

    case kShip_roles:
        result = [[entity roleSet] sortedRoles];
        break;
-[OORoleSet sortedRoles] returns an array of strings.

User avatar
Ramirez
---- E L I T E ----
---- E L I T E ----
Posts: 628
Joined: Mon Nov 07, 2005 9:52 am
Location: London, UK

Post by Ramirez »

Thanks Kaks, I think you've solved my problem - the key was the getting the list of roles after the system.allShips function.

I've set up the system so 5 feudal knights are created at random. Then I get the buoy to run something like this:

Code: Select all

var list = system.shipsWithRole("feudal-knight")

for (var i=0; i<list.length; i++)
 
{
var list2 = list[i].roles
var details = list2.indexOf("Aronar-knight")
this.ship.commsMessage(details)}
I'll get 5 results that indicate whether each of the ships meets the criteria. Having established the house I can then generate names and ranks for the pilots. Now I can get the role information, rather than all that entity data, I don't need to worry so much about partial matches.
Download Resistance Commander plus many other exciting OXPs HERE

User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Glad to be of assistance!

...and I'll check the wiki more often too! :oops:
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)

Chaky
Deadly
Deadly
Posts: 213
Joined: Sat Aug 15, 2009 6:15 am

Post by Chaky »

(Feudal states WIP v0.2)
There's a typo in shipdata.plist that logs as

Code: Select all

[shipData.load.badEntry]: ***** ERROR: the shipdata.plist entry "weapon_position_forward" is not a dictionary.
The problem is with lines 450-453. Simple switch from this

Code: Select all

</dict>
<key>weapon_position_forward</key>
<string>0.0 -0.18 27.06</string>
to this

Code: Select all

<key>weapon_position_forward</key>
<string>0.0 -0.18 27.06</string>
</dict>
does the trick.


.. had to use process of elimination to deduct from 100 or so oxps...


P.S.

Any plans of updating Trident down for 1.73? Makes a lot of

Code: Select all

[script.unpermittedMethod]: ***** SCRIPT ERROR: in trident_down, method 'clearMissionDescription:' not allowed.

User avatar
Ramirez
---- E L I T E ----
---- E L I T E ----
Posts: 628
Joined: Mon Nov 07, 2005 9:52 am
Location: London, UK

Post by Ramirez »

I might revisit Trident Down sometime - if I do I'l be aiming to rewrite it using javascript. Also I'd want to wait until 1.73 is finalised and released.

For Feudal States I've rewritten the shipdata to cope with shaders so this error should be resolved in v0.3, which I hope to upload soon.

I've been doing some more tweaks on the decals as well as having one or two fights with some nobles, so here are some more screenshots.

Image Image

On the left is the shield model I had ages ago, and consists of a specific model that uses a 512x512 texture for the coat of arms. Note this shot was was taken in Drydock rather than in-game. On the right is a shield of the same size (around 100m high) that uses a generic model with the coat of arms painted on using the same decal as used for the ships. It's slightly less detailed because the decal texture is currently only about 250px high. As with the ships, it means only needing to have one .dat file and and using the shipdata/shader combo to paint on the details.

Here a couple of ships in action, a Freiherr-class Jäger of the House of Gelaed, and a Prinz-class Zerstörer from the house of Tibecea:

Image Image

And finally, I was thinking about the photo-recon mission idea and thought I could do with some new and unusual targets for it. How about a massive space defence cannon (borrowing heavily from the prevous comms satellite in Trident Down)?

Image

Any other things people can think of that might be the subject of a sneaky recon mission?
Download Resistance Commander plus many other exciting OXPs HERE

User avatar
Svengali
---- E L I T E ----
---- E L I T E ----
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Post by Svengali »

Wow, pretty stuff ...eem astounding, Sire!

User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6402
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

Post by Disembodied »

Ramirez wrote:Any other things people can think of that might be the subject of a sneaky recon mission?
A partially-completed space station or megaship hull ... maybe a stripped-out dredger being refitted as a Behemoth?

User avatar
Cmd. Cheyd
---- E L I T E ----
---- E L I T E ----
Posts: 928
Joined: Tue Dec 16, 2008 2:52 pm
Location: Deep Horizon Industries Manufacturing & Research Site somewhere in G8...

Post by Cmd. Cheyd »

Raw materials (asteroid) Refining Facility
Weapons Manufacturing Facility
Follow the "Insert Court Official Here" who is believed to be secretly in league with another house
Pictures of the "Princess" who is secretly meeting with another House's Prince in a secret tryst. BLACKMAIL!!!!

That's a few quick ideas that just jumped into my head....

User avatar
DaddyHoggy
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 8501
Joined: Tue Dec 05, 2006 9:43 pm
Location: Newbury, UK
Contact:

Post by DaddyHoggy »

Disembodied wrote:
Ramirez wrote:Any other things people can think of that might be the subject of a sneaky recon mission?
A partially-completed space station <snip>
Just where do you get your ideas from?

:wink:

Image
Selezen wrote:Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here

Post Reply