[Discussion] Generic X3TC S&M questions I

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

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

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

Post by Cycrow » Tue, 7. Jul 09, 21:22

it should return the same value thats displayed in the menu for fuel resupply.

also remember that fuel resupply and autojump are completly seperate things

Osiris_sam
Posts: 422
Joined: Thu, 24. Aug 06, 13:45
x4

Post by Osiris_sam » Thu, 9. Jul 09, 02:42

Trade Commands;
the Find station commands on the trade menu, in particular the ones which go like

<retvar/if> = (<refobj> ->) find station: Product <ware> ...

will they find trade docks/eq docks/other kinds of docks, which will buy that ware? or do i need to script that eventuality in (for tech wares, e.g. weapons, shields etc)?

note: to Cycrow.
the command i queried about before return the amount that is needed to fuel jumps within the jumprange set, taking into account ecells in the hold already. Not exactly what i needed, so i wrote i library to do what i wanted... thanks for your (as always) quick response though :)

User avatar
s9ilent
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Thu, 9. Jul 09, 08:02

@ Osiris_sam
No they will not include trade docks for missiles/weapons/lasers.

So you will have to use a sideways solution to the issue. I just use a search for navigation command software. You could probably also just do a search for stations of the dock class too.

Osiris_sam
Posts: 422
Joined: Thu, 24. Aug 06, 13:45
x4

Post by Osiris_sam » Thu, 9. Jul 09, 12:38

k thanks, didnt think they did...
you'd think there would be a command

<retvar> = find dock buys: ware ...

:( oh well

ThisIsHarsh
Posts: 1132
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh » Fri, 10. Jul 09, 01:11

Anyone know if you can override the stock command->script mappings? I'm trying to override a stock command to link to my own script instead of the one in the !init.ship.globalsciptmap scripts, but when I run it on a ship it still runs the old version. I've tried adding a wait of 1ms at the top of my setup script in the hopes it will re-register it after registering in the !init scripts, but to no avail...

Osiris_sam
Posts: 422
Joined: Thu, 24. Aug 06, 13:45
x4

Post by Osiris_sam » Fri, 10. Jul 09, 01:38

the global script make: set: ...
command should overwrite the previous one (you probably need to set the script command upgrade too as normal)
init scripts run before setup files, so that should not be a problem (please correct me if im wrong)

you can also do it on a ship to ship basis if you want to change only some ships.

ThisIsHarsh
Posts: 1132
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh » Fri, 10. Jul 09, 01:51

Yeah tried all sorts of combinations can't seem to override the default mapping.

Even tried just removing the command altogether (global script map: remove), and still no difference - the command is still available and whatsmore still runs the stock script. Tried running my setup script manually. Tried different ship classes... there must be some trick to doing this, I'm sure it's been mentioned before.

EDIT: tried 'global script map: ignore' and that worked to remove the command. But then, wierdly, when I add a 'global script map: set' after the 'ignore' and pass it my own script, the command reappears - but still uses the stock script!!!

Osiris_sam
Posts: 422
Joined: Thu, 24. Aug 06, 13:45
x4

Post by Osiris_sam » Fri, 10. Jul 09, 02:13

which command are you trying to overwrite?

ThisIsHarsh
Posts: 1132
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh » Fri, 10. Jul 09, 02:19

Aha! Sorted it. The weird behaviour was because the stock command (Deploy Satellite Network) had preload script assigned! I had to overwrite both the command script and command preload script in order to get it to work. Sorted now, cheers.

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

Post by Cycrow » Fri, 10. Jul 09, 02:30

preloads are used to display the menu.

these are run before the actual script command, so when u tested it, u most likly only saw the preloaded menu, before getting to your script change ;)

what would have happened is, when u selected the menu, then ur command would start and u will see the changes, if u want to change the input, u'll need to also change the preload.

when u said u overright the preload, did u use the same script for both ?
coz its not advised to do that

ThisIsHarsh
Posts: 1132
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh » Fri, 10. Jul 09, 05:09

Cycrow wrote:preloads are used to display the menu.

these are run before the actual script command, so when u tested it, u most likly only saw the preloaded menu, before getting to your script change ;)

what would have happened is, when u selected the menu, then ur command would start and u will see the changes, if u want to change the input, u'll need to also change the preload.

when u said u overright the preload, did u use the same script for both ?
coz its not advised to do that
I wrote my own preload script and overwrote it with that.

As I say, the weird thing is that if I only overwrite the command script and the leave the preload script alone, then it doesn't do anything, I *have* to overwrite the preload script as well. Unfortunately there is no 'remove command preload' script command, so the only method is to write a (very small in this case) replacement preload script.

Makes sense in a way to block replacing of command script whilst the preload script remains the same - stop the (potentially) wrong input going to the new command script.

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

Post by Cycrow » Fri, 10. Jul 09, 16:02

well as i said, the preload script is run first.

so when you start the command, what happens, is the preload script is run.

this script then returns an array of arguments. If those arguments match the command script, then the command will start.

otherwise, the command will not begin at all.

preloads basically allow you to create a menu system for the command without starting the command straight away.

if u put a menu in the command script itself, then the existing command will stop to display this menu, so if u then quit out the menu to cancel the command, u will lose any existing commands running as well.

with a preload it allows the existing commands to continue running until u've finished and accepted the menu selection

ThisIsHarsh
Posts: 1132
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh » Fri, 10. Jul 09, 18:05

Ah OK, I think I understand - actually that explains another weird behaviour where the script wouldn't start at all sometimes.

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

Post by Cycrow » Fri, 10. Jul 09, 18:48

yeah if ur using a preload, jsut make sure ur returning an array of arguments, even if the command script only has 1 argument.

the idea of preloads is to basically allow you to create a script to select what arguments are being passed to the command, instead of the game simply getting input for each argument.

if you use one argument as a Var/Ship, then when u run the command u will get the standard ship selection menu then the command will run using that ship.

if u use a preload, u can make a custom menu for a different ship selection, then simply return that ship as an array.

u cant do this

Code: Select all

return $ship
u need to make it into an array

Code: Select all

$arr = create array with arguments = $ship, null, null, null, null
return $arr
then each element of that array is passed to the command script arguments

if u dont return an array, then the command terminates, ie, if u want to quit out the menu coz u no longer want to run the command, then u can just return null and the command will then never be run

User avatar
ScytheBlade1
Posts: 42
Joined: Fri, 26. Oct 07, 04:38
x3tc

.cat/.dat format?

Post by ScytheBlade1 » Sun, 12. Jul 09, 00:26

I've searched high and low, and while it is entirely possible that the answer is right in front of me, I can't find it..

For various reasons, I'm looking to write a .cat/.dat parser. Everywhere I look simply says "don't do this, just use one of these tools: X Y or Z" or it just says "don't do this." :)

Which doesn't help me much.

Seeing as this is the generic S&M thread, I figured it'd be worth it to ask and see if anyone (a) knows the formats in question well enough to describe it and (b) would be willing to do so. :)

Locked

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”