[SCRIPT] Satalite Early Warning Network V1.20 : Updated 09/03/2007

The place to discuss scripting and game modifications for X³: Reunion.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

ACrazyGerman
Posts: 99
Joined: Thu, 6. Mar 08, 08:26

Post by ACrazyGerman » Wed, 26. Mar 08, 00:31

Is there a mirror for this the download won't load.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 20543
Joined: Mon, 15. Nov 04, 00:26

Post by Cycrow » Wed, 26. Mar 08, 00:49

first page has been updated with working links

Pogi
Posts: 521
Joined: Thu, 13. Apr 06, 12:35

Post by Pogi » Fri, 28. Mar 08, 04:44

@Cycrow...Just an inquiry as to if you are still going to or interested in making a modified version or extention of this script to detect bailed ships...Thanks
X3..The most fun a man can have...With his clothes on.

spoidz
Posts: 607
Joined: Sat, 6. Mar 04, 21:43

Post by spoidz » Sat, 29. Mar 08, 08:09

Okay, I am just not smart enough to figure out some of this scripting. I've tried reading the MSCI and then manually tried diff combos with the ingame MSCI.

I "can" get the plugin.sewn.running to ID Xenon Stations and Pirate Bases, but I can't figure out how to get it to use a diff warning message for each.

I copied the sendWarning code and then just relabeled the two sections and added two new text IDs to the 447545.xml.

But it will only send the first original warning. (....detected an enemy ships). I can make the first sendWarning use the new text Id by just changing the number but that's it. It won't skip that one and use the other two.

Basically I don't know enough to get multiple GoSub to execute separately when called within the same script. Probably my bad End, EndSub and Return Nulls but I'm not getting anywhere by tinkering.


Anyone kindly put me out of my misery?

Thanks

Pogi
Posts: 521
Joined: Thu, 13. Apr 06, 12:35

Post by Pogi » Sat, 29. Mar 08, 11:41

Sewn was designed to identify enemy ships entering a sector..I don't understand why you would want it to identify enemy stations?..If you have a sat there already you can already see them.. :?
X3..The most fun a man can have...With his clothes on.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 20543
Joined: Mon, 15. Nov 04, 00:26

Post by Cycrow » Sat, 29. Mar 08, 14:32

there are 2 warnings, once is text to the logbook and the other is a voice.

you can change the voice by simply adding new entries into the text file.

if all your doing is changing the log entry, then u will still get the voice warning a bout the ships.

also, remember that stations dont move, so they will always be in range of the satalites, so u'll end up getting continous warnings about them

spoidz
Posts: 607
Joined: Sat, 6. Mar 04, 21:43

Post by spoidz » Sat, 29. Mar 08, 15:52

Well I didn't want to bother you with reviewing my noobish attempt at code but I guess I'll have to to explain what I'm doing.

I'm getting SEWN to do two things,

1) Announce the respawn of the two Xenon Stations that XTM keeps running at all times.

2) Announce the respawn of a Pirate station after I kill/push-it to another sector.

To try to get there I simply copied the code block for ID a ship and changed it to ID a station.


Code: Select all

021    $stations =  find station: sector=$sector class or type=Xenon Station race=Xenon flags=[Find.Multiple] refobj=[THIS] maxdist=1000 maxnum=5 refpos=null
022 @  skip if not [THIS] -> call script 'plugin.sewn.validship' :  Ship Array=$ships
023     gosub sendWarningXenon
024    
025    $stations =  find station: sector=$sector class or type=Pirate Base race=Pirates flags=[Find.Multiple] refobj=[THIS] maxdist=1000 maxnum=5 refpos=null
026 @  skip if not [THIS] -> call script 'plugin.sewn.validship' :  Ship Array=$ships
027     gosub SendWarningPirates
I didn't know about the "station always visible" so I figured to just max the distance since the Xenon stations and Pirate bases are often way out from center. I left the plugin.sewn.validship call but I guess it may not be needed.

I changed the gosub for each to try to make it use a diff text file only.

Code: Select all

048   sendWarningXenon:
049   $time = playing time
050   if $time > $last.send
051    $sector = [THIS] -> get sector
052    write to player logbook: printf: pageid=7545 textid=29, $sector, null, null, null, null
053    $last.send = $time + 300
054    = speak text: page=13 id=1276 priority=100
055 @  $sound.num = [THIS] -> call script 'lib.cycrow.getsoundnum' :  Sector=$sector
056    = speak text: page=7 id=$sound.num priority=99
057    
058   
061   
062   SendWarningPirates:
063   $time = playing time
064   if $time > $last.send
065    $sector = [THIS] -> get sector
066    write to player logbook: printf: pageid=7545 textid=30, $sector, null, null, null, null
067    $last.send = $time + 300
068    = speak text: page=13 id=1276 priority=100
069 @  $sound.num = [THIS] -> call script 'lib.cycrow.getsoundnum' :  Sector=$sector
070    = speak text: page=7 id=$sound.num priority=99

I know the if in the warning code needs an end but I probably don't have an endsub and a return null in the right places to allow the two new warning to be accessed properly.

Unless you are going to tell me this would require some more detailed branching code, I assumed I could simply offer it more "choices" and it would adhere to the diff gosub calls.


By placing the sats in all the sectors there shouldn't be a Station/Base, I'll get an immediate signal as soon as they respawn and I can chase them around.

Pogi
Posts: 521
Joined: Thu, 13. Apr 06, 12:35

Post by Pogi » Sun, 30. Mar 08, 03:12

@spoidz...I see...Well if that is what you are trying to do, in my opinion, you are tinkering with the wrong script...A much better one to do what you are wanting would be this:

http://forum.egosoft.com/viewtopic.php?t=147822

But, you know what opinions are like... :D
X3..The most fun a man can have...With his clothes on.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 20543
Joined: Mon, 15. Nov 04, 00:26

Post by Cycrow » Sun, 30. Mar 08, 04:30

spoidz wrote:

Code: Select all

021    $stations =  find station: sector=$sector class or type=Xenon Station race=Xenon flags=[Find.Multiple] refobj=[THIS] maxdist=1000 maxnum=5 refpos=null
022 @  skip if not [THIS] -> call script 'plugin.sewn.validship' :  Ship Array=$ships
023     gosub sendWarningXenon
024    
025    $stations =  find station: sector=$sector class or type=Pirate Base race=Pirates flags=[Find.Multiple] refobj=[THIS] maxdist=1000 maxnum=5 refpos=null
026 @  skip if not [THIS] -> call script 'plugin.sewn.validship' :  Ship Array=$ships
027     gosub SendWarningPirates
theres your first problem right there.
your calling the check script for ships, and sending in the ship array, not the station array.

set the ship array to $station.

althou it might be best to clone the validship and edit it for stations, althou not much editing should be needed

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 20543
Joined: Mon, 15. Nov 04, 00:26

Post by Cycrow » Sun, 30. Mar 08, 04:35

Next, the max dist is wrong, its a low value for a start, also, the script uses the scanner range for the max dist.

the scanner range is longer than the 1000, as thats only 1km away, the station would have to be very close


only the gosubs, did you paste everything ? it jumps from line 58 to 61.

your missing the end in the block and your missing the endsub

the endsub is what returns it back. Without it, it will first do whats in sendWarningXenon then do whats in SendWarningPirates then continue to whats after that.

each sub block needs an endsub before the next one starts, in general

spoidz
Posts: 607
Joined: Sat, 6. Mar 04, 21:43

Post by spoidz » Sun, 30. Mar 08, 07:24

Cycrow,

Sorry for causing you more work,

Yes I didn't paste all, just wanted to show you what I cloned. It was the endsub locations I couldn't figure, one for each or one single after the last sub.

I didn't figure the distance until I found an example to know it was in meters. I'll set it back to $range or bump it up if it can't see the stations/bases.

For Pogi, yes that would work but then you have to remember to keep running it and it won't find Xenon. SEWN looked easier for me to understand/clone and it will be an automated system with recurring prompts.


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

So basically I should have:

find
gosub sendwarning

find
gosub sendwarningxenon

find
gosub sendwarningpirates

sendwarning
end
endsub

sendwarningxenon
end
endsub

sendwarningpirates
end
endsub

return null

-----------????


As far as the Ship Array=$stations ....... entire line

Do I even have to use it if the "find" has already run against class and race?? All I care is if it sees a Xenon station or a Pirate Base. Will those two new find blocks simply run as long as plugin.sewn.running is active on a SAT? Without having to check it against validship?

Sorry, it will take some more learning before I can "read" validship to understand how to edit/clone it properly. I'm really trying to do as much of this by learning before I bug you guys.

Feel free to hit me in the head with the noob stick.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 20543
Joined: Mon, 15. Nov 04, 00:26

Post by Cycrow » Sun, 30. Mar 08, 09:27

the validship is to check ship types againsts the filter settings, and wont be needed. you just need to check that the station array has stations in

Code: Select all

skip if not $stations
  gosub ...

as for the end/endsub. You only need end for an if block or a while block.

end is used to "end" that block you opened previously.

endsub is to end the sub call and return it

Buck_Rogers
Posts: 1462
Joined: Tue, 21. Dec 04, 00:23

Post by Buck_Rogers » Thu, 1. May 08, 12:48

Hi Cycrow. Sorry to bug you (Again!) :D

Just a question:

I have placed an Advance Sat. in Paranid Prime and have signed the SEWN contract on the BBS. However it has since been destroyed by some mauruding Kha'ak! :evil:

How long does i take for the contract peeps to replace it? I lost the sat. when I left the game running overnight (WITHOUT SETA) and there has been no replacement done, so far.

I have also checked the maintenance contracts screen just to make sure I had one for Paranid Prime. Which I do.
Buck Rogers

Vice Admiral of Shadows Haven Alliance (SHA) visit us at:
SHA Forum
Feel free to join my DID
Too often we lose sight of life's simple pleasures. Remember, when someone annoys you, it takes 42 muscles in your face to frown. But only 4 to extend your arm and slap the bugger!

jumbled
Posts: 318
Joined: Mon, 28. Jun 04, 08:22

Post by jumbled » Tue, 22. Jul 08, 12:05

I have just come up on a most curious problem, and wanted to share my findings with you.

I want the replacement service in every sector where I put a sat (well, almost every sector...those that I use for trade and need to keep tabs on, which is just about every sector except for Khaak, Xenon and unknown sectors). So I've been systematically moving from one sector to another and visiting every station, multiple times, until that blasted BBS message eventually pops up offering me the contract.

So far, so good, I have a couple sections of the galaxy covered, but still a long way to go.

However, my problem now is if I visit a sector and hit the hotkey to check if the contract is active in that area, I get the message with the listing of sectors and only part of the question at the bottom on whether or not to keep the service in my current sector. The clickable buttons don't show up, only an 'ok' button.

After studying the script, and scratching my head several times, I finally figured out what happened, but only thanks to a recent experience from another script I've been writing where I had a similar "problem" come up.

I have so many sectors covered now that the list is too long for the data space in the message variable to hold it, so the bottom portion of the string (the part holding the question prompt) is getting cut off. And therefore I don't see the "do you want to keep it" buttons for 'yes' or 'no'.

Not that it matters, so long as I get coverage, I'm not cancelling anything, but I thought I'd let you know in case it hasn't happened to you yet.

I don't know how many people try to cover the whole galaxy with replacement services, but I, for one, am thoroughly tired of losing sats in all odd places around the galaxy and having to send out ships to replace them manually.

If it was only a handful of specific sectors that suffered, I could set it up in only those areas and leave it be, but it isn't, and I get messages of losing sats in MANY places, some of which are far from "danger zones" and shouldn't otherwise be an issue of concern, all because of random attacks by Khaak, Xenon or pirates who pop in for no other reason than they have nothing better to do but cause trouble.

A "global" service would be much preferred, for this point, first to give me total coverage, all at once, without having to visit every sector and waiting forever for the BBS to show the contract (which will take forever), and also to counter this new problem of variable storage space and a flunky output message.

If such a service were offered, though, I think it should also take into account (as it's setting up the parameters) any existing sector services already in effect, and merge them into the global service contract (whatever method you use to "define" such a contract, since right now you're using a myriad of global variables, one for each sector, to declare "coverage" in that area).

Maybe, instead of a zillion global variables with sector names on them, you could assign a single 2-dimensional array, to mimic the (x,y) coords of sectors in the galaxy, and assign values into elements to declare coverage and fees?

As far as the sector summary listing goes, the only thing I can suggest is a solution like what I had to settle with for my own little project, and that is to break it up into multiple messages of 'x' number of sectors per message. I also formatted the output into columns to be more compact.

I don't know what X3 thinks about it, but I am just a bit concerned over so many scripts assigning so many global variables, that it might, after a while, clutter things up so badly that X3 can't "think" any more. It already takes half an hour for my game to load... :(

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 20543
Joined: Mon, 15. Nov 04, 00:26

Post by Cycrow » Tue, 22. Jul 08, 12:29

a global service was something i had planned at some point.

however you problem is to do with the number of lines rather than the actual data size.

you see, incomming messages have a maximum size of 100 lines.

there would be several solutions, including spliting large number of sectors to seperate messages or putting mulitple sectors on the same lines.

for global varibles, they do use memory space, and will also increase the size of your saved game.

but as long as the scripts use them sensibly then its not usually a problem.

its local varibles that are more likly to effect things, as this could be on 1000's of objects.

updates to this script will most likly come in X3TC. When it comes out, i will adapt it to work and improve on it

Post Reply

Return to “X³: Reunion - Scripts and Modding”