Writing Random Sector Discovery Points

The place to discuss scripting and game modifications for X³: Farnham's Legacy

Moderators: Moderators for English X Forum, Scripting / Modding Moderators, Moderators for the X3:FL Forums

Post Reply
BrigandPhantos77
Posts: 536
Joined: Wed, 27. Dec 17, 05:47
x4

Writing Random Sector Discovery Points

Post by BrigandPhantos77 » Fri, 27. Oct 23, 19:26

Is there a way to write (script) the sectors that have random discovery points attached to the log book?

I need a simple solution if possible. I can find commands, but I get confused easily if there is too much involved. :D
Last edited by N8M4R3 on Sun, 29. Oct 23, 20:02, edited 1 time in total.
Reason: *Toppic Moved* Script & Modding relevant questions should be asked in the corresponding forum
Peace is a state of mind!
War is absolute!
~ Phantos ~

BrigandPhantos77
Posts: 536
Joined: Wed, 27. Dec 17, 05:47
x4

Re: Writing Random Sector Discovery Points

Post by BrigandPhantos77 » Thu, 2. Nov 23, 04:42

Can anyone tell me how to at least get the sector's with the random discovery points?

I can figure out the rest.

The reason is I use the "all seeing eye" script to find the spawned pandora's crates. That is easy. But the number of active ones seems to fluctuate between 12 at once to 7 at once. Most of the time it will stay at 7 at once. And only replace those 7. But every once in a while when I go all over the place, it will shoot back up to 12. I've had seta run for 2 hours before and never had the number of spawns exceed 7.

Do the scrips that generate these goodies lock up (like start idling like the special command software) over time? Or do the randomly generated sector points take the place of a randomly generated pandora crates?

Any help is welcome and appreciated. :mrgreen:
Peace is a state of mind!
War is absolute!
~ Phantos ~

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22230
Joined: Sun, 14. Nov 04, 23:26
x4

Re: Writing Random Sector Discovery Points

Post by Cycrow » Thu, 2. Nov 23, 13:16

Theres a script command available to set and get the discovery points of a object. Just use this on the sector.

so you just need to get all sectors and check how many points each one has

BrigandPhantos77
Posts: 536
Joined: Wed, 27. Dec 17, 05:47
x4

Re: Writing Random Sector Discovery Points

Post by BrigandPhantos77 » Sat, 4. Nov 23, 23:48

Cycrow wrote:
Thu, 2. Nov 23, 13:16
Theres a script command available to set and get the discovery points of a object. Just use this on the sector.

so you just need to get all sectors and check how many points each one has
Thanks for those guides / links. They are a big help.

Here is my first attempt. It doesn't return anything into the log. Does that mean no random points are being assigned? It does cause a slight stutter when you open the log after running it.
I wrote it from studying other scripts, hoping I got it right for the most part. Any and all critiques or suggestions welcome. I'm struggling a bit with how to get each sector.

https://drive.google.com/file/d/1atkhec ... drive_link

(Changed link as previous one has been removed and replaced with a working version.)

This is a fun process :mrgreen:
Last edited by BrigandPhantos77 on Tue, 7. Nov 23, 10:57, edited 2 times in total.
Peace is a state of mind!
War is absolute!
~ Phantos ~

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24965
Joined: Sun, 2. Apr 06, 16:38
x4

Re: Writing Random Sector Discovery Points

Post by X2-Illuminatus » Sun, 5. Nov 23, 11:15

The code looks correct. So yes, that suggests, that there are no Discovery Points currently assigned to any sector.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22230
Joined: Sun, 14. Nov 04, 23:26
x4

Re: Writing Random Sector Discovery Points

Post by Cycrow » Sun, 5. Nov 23, 12:00

A better way would be to use 2 whiles

Code: Select all

$x = get max sectors in x direction
while $x
  dec $x = 
  $y = get max sectors in y direction
  while $y
    dec $y = 
    $sector = get sector from universe index: x=$x, y=$y
    skip if $sector -> exists
      continue
      
      ... (rest of script)
  end
 end
 

BrigandPhantos77
Posts: 536
Joined: Wed, 27. Dec 17, 05:47
x4

Re: Writing Random Sector Discovery Points

Post by BrigandPhantos77 » Sun, 5. Nov 23, 13:41

Cycrow wrote:
Sun, 5. Nov 23, 12:00
A better way would be to use 2 whiles

Code: Select all

$x = get max sectors in x direction
while $x
  dec $x = 
  $y = get max sectors in y direction
  while $y
    dec $y = 
    $sector = get sector from universe index: x=$x, y=$y
    skip if $sector -> exists
      continue
      
      ... (rest of script)
  end
 end
 
I think I can wrap my brain on that. :D

Thanks! :mrgreen:
X2-Illuminatus wrote:
Sun, 5. Nov 23, 11:15
The code looks correct. So yes, that suggests, that there are no Discovery Points currently assigned to any sector.
The amount bounces back and forth between 12 and 7. After reading the handbook it can have up to 5? Which is oddly the amount that vanishes. So maybe when 5 vanishes again I'll try it again. :lol:

Thanks guys! This points me in the right direction and I can try bigger and bigger things going forward. "Baby steps though for me. :D "
Peace is a state of mind!
War is absolute!
~ Phantos ~

BrigandPhantos77
Posts: 536
Joined: Wed, 27. Dec 17, 05:47
x4

Re: Writing Random Sector Discovery Points

Post by BrigandPhantos77 » Sun, 5. Nov 23, 22:40

:lol:

Froze the game 12 times now trying to test. lol....

I'll keep trying though. I'll get it right eventually. :mrgreen: :gruebel:
Peace is a state of mind!
War is absolute!
~ Phantos ~

User avatar
N8M4R3
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 401
Joined: Fri, 24. Nov 06, 15:48
x4

Re: Writing Random Sector Discovery Points

Post by N8M4R3 » Mon, 6. Nov 23, 00:22

This reminds me of when I first started scripting. I don't know how many times it didn't work and how many times the game began to freeze but it was many, many times :mrgreen: But with every try, change and retry it comes clearer and clearer to you what you do and suddenly it also won't freeze anymore. Just don't give up :wink:
Neue Erweiterung für X3 verfügbar: Farnham's Legacy | +Optional: weitere Verbesserungen im inoffiziellen Patch v1.3.14 *** Modified*** :khaak: :thumb_up:
Diese Woche im Angebot: HUD-GUI-Mix (FL) | Text-DB 0001-L049 (FL) | Textkorrekturen & Verbesserungen (FL)
Weitere Veröffentlichungen hier: N8workX
Nützliches Tool für nicht mehr vorhandene Downloads: web.archive.org
Externes Archiv für MOD/SCR Ressourcen: xdownloads.co.uk | code.google.com/archive/p/x3tcscripts/

BrigandPhantos77
Posts: 536
Joined: Wed, 27. Dec 17, 05:47
x4

Re: Writing Random Sector Discovery Points

Post by BrigandPhantos77 » Mon, 6. Nov 23, 01:55

N8M4R3 wrote:
Mon, 6. Nov 23, 00:22
This reminds me of when I first started scripting. I don't know how many times it didn't work and how many times the game began to freeze but it was many, many times :mrgreen: But with every try, change and retry it comes clearer and clearer to you what you do and suddenly it also won't freeze anymore. Just don't give up :wink:
I definitely don't plan to give up. It might suck the first couple of screw ups you make.... but when you get it right, that's about the most exciting part. And sometimes a screw up can show you something else unintended, make you think and go hmmmm, then redo and suddenly.... "shock" and so that's how that works. :mrgreen:
Peace is a state of mind!
War is absolute!
~ Phantos ~

BrigandPhantos77
Posts: 536
Joined: Wed, 27. Dec 17, 05:47
x4

Re: Writing Random Sector Discovery Points

Post by BrigandPhantos77 » Tue, 7. Nov 23, 04:16

I finagled, finessed, sweat talked, argued with, and even yelled at the dang thing. It even froze my game a few times. Guess I shouldn't yell at it. :lol:

In the end, here is what I came up with.
Spoiler
Show

Code: Select all

$X = 0
$Y = 0
$X2 = get max sectors in x direction
$Y2 = get max sectors in y direction

$ssector = get sector from universe index: x=$X, y=$Y
if $ssector-> exists
$MessageStart = 'I have begun working on your request! ' + $ssector + ' is where we will start'
write to player logbook $MessageStart
else
$MessageStart2 = 'Lets begin the work!'
write to player logbook $MessageStart2
end

while $Y < $Y2 + 1
$ssector = get sector from universe index: x=$X, y=$Y
if $ssector-> exists

* This asks for discovery points.
$spoints = $ssector-> get discovery points
if $spoints >= 1
$Message = 'Here is your sector containing some random points - ' + $ssector
write to player logbook $Message
end
end
if $X == $X2 + 1
$X = 0
inc $Y
else
inc $X
end
end
if $Y == $Y2 + 1
$MessageEnd = 'Your request has been completed! Have a wonderful day!'
write to player logbook $MessageEnd
end


return null
It's in spoilers so you can minimize it. From what I can tell it works completely now. Only thing is, at the end it won't grab the last sector name and just ends with null. So statement 2 executes instead of the first.

Here is a link> https://drive.google.com/file/d/1atkhec ... sp=sharing

Feel free to use as you see fit in anything you want. This has been a bit of a learning curve for me. I plan to do more in the future as I get more comfortable with this.

Additional edit*** Broke it again trying to mess with and tweak some more.
Peace is a state of mind!
War is absolute!
~ Phantos ~

Post Reply

Return to “X³: Farnham's Legacy - Scripts and Modding”