Page 1 of 1

[S] Library for Border - Core Sector - Security Level

Posted: Sun, 20. Jan 08, 00:20
by Gazz
My script was trying to find out if XYZ was a core sector.
Alas, there is no (working) script command for that and other than a fixed lookup table, noone had a solid solution for how to find out.
So I had to write my own.

Code: Select all

@ $Test = [THIS] -> call script 'lib.gz.is.a.core.sector' :  Sector=$sector
Script function returns
1 . . . if the provided sector is a CORE sector
null . . . if it's not
null . . . if the sector does not exist.

Unknown or pirate sectors all follow the same rules as border sectors so my script can not tell the difference.

If a sector is given to the player with the set owner instruction, the library will return the same result as before.
If Argon Prime is player owned it is still a core sector, Ore Belt is not.

Tested with X3 v2.5. Results were 100 % on target.
It will work with other versions but I have no idea if the results will be correct.

Download

This is freeware for all I care.
Everyone has my permission to use it and include it in script packages.

Posted: Sun, 20. Jan 08, 02:13
by Lancefighter
question - does it actually figure out if the sector is core/not somehow, or does it rather just look at a list?

Posted: Sun, 20. Jan 08, 03:21
by Gazz
Lancefighter wrote:question - does it actually figure out if the sector is core/not somehow, or does it rather just look at a list?
The script is 26 lines total so there definitely is no list.
I use a formula and it should work with every kind of mod and galaxy.

Heh. I just saw that Cycrow put this function on the wishlist in 2006. =)

Come to think of it... there is one thing I still want to improve.
There will be an update...

EDIT: There has been an update.
The script can cause an unavoidable hickup if run In Sector so now it remembers the results and subsequent queries on the same sector are super fast.

I want to use this function on a possibly large number of scripts so it had better be fast.
Okay, so it got a few more lines now but I figure that's acceptable for being 100x as fast.

Posted: Mon, 11. Feb 08, 17:05
by ninjitsumonk
hi gazz, this is an interesting take on how to check whether a sector is a core or border one. wouldn't have though of this myself, i've been trying to play with the find random sector..... secturity... but I can't quite work out how the command works yet, so I figured this script may be useful.

Just a some questions;

1-how does the notoriety of the buster in question and whether its allowed to dock or not define whether a sector is border or core?

2-am I allowed to completely tear apart your script for my needs? and if so, do you want credit(for the concept if nothing else)

Cheers

Posted: Mon, 11. Feb 08, 17:43
by nirwin
Oooh, this could prove very useful to me sometime in the future. Bookmarking now.

Good work.

Posted: Mon, 11. Feb 08, 18:37
by Gazz
ninjitsumonk wrote:i've been trying to play with the find random sector..... secturity... but I can't quite work out how the command works yet
That's because it does not work at all - in regards to "security".
You can set that flag value to 1, 0, "Heinz Helmschtucker" or whatever you feel like.
1-how does the notoriety of the buster in question and whether its allowed to dock or not define whether a sector is border or core?
Remember how you were allowed to dock in some sectors but not in others at the game start? That rule applies to all ships.
2-am I allowed to completely tear apart your script for my needs? and if so, do you want credit(for the concept if nothing else)
I don't see how that would help. It can be used as a simple library and it can not find out any more than it already does.

It's easy enough for your script to check if this is a "race" sector with one or 2 lines (checking if race X is in the array of races that interest you) so I intentionally did not include this in the library to keep it flexible.

Posted: Mon, 11. Feb 08, 19:47
by ninjitsumonk
Ah, I didn't want to find anything else out, just do a quick re-write to include it in one of my scripts, so as I'm making an array of all the sectors, I can make an array of their security levels aswel so that later ingame the check is ready and everything is already calculated.

Posted: Sat, 8. Mar 08, 02:56
by shilhi
So, basically when I conquer an Argon sector, I can actually set the sectors security? Also, dont think of me as a noob(not too much of a noob anyway :wink: ) but how do I install this?

Posted: Sat, 8. Mar 08, 15:32
by Gazz
This is a library function for other scripters. It has no direct use for a player.