Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: HLD_Prophecy on November 03, 2016, 10:24:48 am

Title: How to clear techroom?
Post by: HLD_Prophecy on November 03, 2016, 10:24:48 am
Hey all!

So for the mod I'm working on, I'd like to get the techroom clear. I'm using retail ships, but I'd like to only have my custom ships actually in the techroom.

I know that I could import the retail tbl data and remove all the "in tech database" flags, but I'd like to know if there's a simpler way. I'll do it if I have to, but...

Thanks!
Title: Re: How to clear techroom?
Post by: tomimaki on November 03, 2016, 12:05:25 pm
Name your custom table ships.tbl.
Ah wait, you still want retail ships. Then nvm :warp:
Title: Re: How to clear techroom?
Post by: 0rph3u5 on November 03, 2016, 01:12:05 pm
Use a -shp.tbm with +nocreate entries for the retail ships. With these entries you can overwrite the $flags-line of ships.tbl without having your own ships.tbl

Be advised however that this might interfere with any mod you are also using that does exactly the same thing...
Title: Re: How to clear techroom?
Post by: Buff Skeleton on November 03, 2016, 06:43:02 pm
On a similar thread, is there any way to reorder the DB with a .tbm that doesn't remove or add any retail ships? I was able to do this with a .tbl by just reordering entries, but the .tbm doesn't handle that because the retail .tbl order is still preserved.
Title: Re: How to clear techroom?
Post by: 0rph3u5 on November 03, 2016, 07:10:05 pm
The order in the techdatabase is the same as in the ships.tbl - there is no changing that right now as far as i know
(A coder may contradict me)
Title: Re: How to clear techroom?
Post by: HLD_Prophecy on November 04, 2016, 12:47:14 pm
Use a -shp.tbm with +nocreate entries for the retail ships. With these entries you can overwrite the $flags-line of ships.tbl without having your own ships.tbl

Be advised however that this might interfere with any mod you are also using that does exactly the same thing...

What would a +nocreate entry look like? Would it just be the Name plus a nocreate flag, or do I have to type out the entire entry?
Title: Re: How to clear techroom?
Post by: Droid803 on November 04, 2016, 02:08:19 pm
with a +nocreate flag, you only have to have the lines you want to replace in the tbm (in this case, would be just $Flags: )
Title: Re: How to clear techroom?
Post by: HLD_Prophecy on November 04, 2016, 08:49:51 pm
with a +nocreate flag, you only have to have the lines you want to replace in the tbm (in this case, would be just $Flags: )

Great, that's what I had hoped.

Hoo boy, time for some serious typing. This is going to take time.  :p Do they have to be in the same order as the entries in the retail .tbl, or can they be in a different order and still replace the retail ships as long as the names are the same?
Title: Re: How to clear techroom?
Post by: HLD_Prophecy on November 04, 2016, 08:54:38 pm
Wait, does "nocreate" go in the $Flags field, or does "+nocreate" come right after the $Name?
Title: Re: How to clear techroom?
Post by: niffiwan on November 04, 2016, 09:59:09 pm
Code: [Select]
$Name:                  SB Seraphim
+nocreate
$Allowed PBanks:             ( "Subach HL-7" "Subach HL-7" "Subach HL-7")
$Default PBanks:             ( "Subach HL-7" "Subach HL-7" "Subach HL-7" )
$Flags:                 ( "player_ship" "bomber" "dynamic primary linking" )

(from a table I have lying around)
Title: Re: How to clear techroom?
Post by: AdmiralRalwood on November 04, 2016, 10:03:50 pm
with a +nocreate flag, you only have to have the lines you want to replace in the tbm (in this case, would be just $Flags: )
This is a misconception; no information is actually required for a ship table entry except its name (although attempting to actually do anything with such an entry, like look at it in the F3 lab, will almost certainly result in warnings/errors/crashes). The only thing "+nocreate" does is say that an entry for the ship won't be created if it doesn't already exist; if you can guarantee that it will already exist, it serves no purpose (it's only really useful for things like the MediaVPs, which may be used as a secondary mod for mods that may not use the retail ships.tbl file).

That being said, it's common practice to use "+nocreate" with any entry meant to modify an existing entry "just in case", and/or because of misconceptions that the entry otherwise wouldn't be valid.
Title: Re: How to clear techroom?
Post by: HLD_Prophecy on November 05, 2016, 01:19:08 pm
with a +nocreate flag, you only have to have the lines you want to replace in the tbm (in this case, would be just $Flags: )
This is a misconception; no information is actually required for a ship table entry except its name (although attempting to actually do anything with such an entry, like look at it in the F3 lab, will almost certainly result in warnings/errors/crashes). The only thing "+nocreate" does is say that an entry for the ship won't be created if it doesn't already exist; if you can guarantee that it will already exist, it serves no purpose (it's only really useful for things like the MediaVPs, which may be used as a secondary mod for mods that may not use the retail ships.tbl file).

That being said, it's common practice to use "+nocreate" with any entry meant to modify an existing entry "just in case", and/or because of misconceptions that the entry otherwise wouldn't be valid.




But in this case, an entry does already exist in the retail .tbl. I just want to make all the retail entries disappear from the tech room (unless you hit Ctrl-Shift-S, of course).

You should open the techroom and see nothing but the custom ships that I've added.

This does not work:
Code: [Select]
$Name: GTF Ulysses
+nocreate

The entry is still there.
Title: Re: How to clear techroom?
Post by: 0rph3u5 on November 05, 2016, 01:32:24 pm
with a +nocreate flag, you only have to have the lines you want to replace in the tbm (in this case, would be just $Flags: )
This is a misconception; no information is actually required for a ship table entry except its name (although attempting to actually do anything with such an entry, like look at it in the F3 lab, will almost certainly result in warnings/errors/crashes). The only thing "+nocreate" does is say that an entry for the ship won't be created if it doesn't already exist; if you can guarantee that it will already exist, it serves no purpose (it's only really useful for things like the MediaVPs, which may be used as a secondary mod for mods that may not use the retail ships.tbl file).

That being said, it's common practice to use "+nocreate" with any entry meant to modify an existing entry "just in case", and/or because of misconceptions that the entry otherwise wouldn't be valid.




But in this case, an entry does already exist in the retail .tbl. I just want to make all the retail entries disappear from the tech room (unless you hit Ctrl-Shift-S, of course).

You should open the techroom and see nothing but the custom ships that I've added.

This does not work:
Code: [Select]
$Name: GTF Ulysses
+nocreate

The entry is still there.

Code: [Select]
$Name: GTF Ulysses
+nocreate
$Flags:                         ( "player_ship" "default_player_ship" "fighter" )
should do the trick - at least it does for me
Title: Re: How to clear techroom?
Post by: HLD_Prophecy on November 05, 2016, 01:54:08 pm
with a +nocreate flag, you only have to have the lines you want to replace in the tbm (in this case, would be just $Flags: )
This is a misconception; no information is actually required for a ship table entry except its name (although attempting to actually do anything with such an entry, like look at it in the F3 lab, will almost certainly result in warnings/errors/crashes). The only thing "+nocreate" does is say that an entry for the ship won't be created if it doesn't already exist; if you can guarantee that it will already exist, it serves no purpose (it's only really useful for things like the MediaVPs, which may be used as a secondary mod for mods that may not use the retail ships.tbl file).

That being said, it's common practice to use "+nocreate" with any entry meant to modify an existing entry "just in case", and/or because of misconceptions that the entry otherwise wouldn't be valid.




But in this case, an entry does already exist in the retail .tbl. I just want to make all the retail entries disappear from the tech room (unless you hit Ctrl-Shift-S, of course).

You should open the techroom and see nothing but the custom ships that I've added.

This does not work:
Code: [Select]
$Name: GTF Ulysses
+nocreate

The entry is still there.

Code: [Select]
$Name: GTF Ulysses
+nocreate
$Flags:                         ( "player_ship" "default_player_ship" "fighter" )
should do the trick - at least it does for me

Aha, of course! I just need to get rid of the in-tech-database flag. Thanks!
Title: Re: How to clear techroom?
Post by: Droid803 on November 05, 2016, 02:10:34 pm
with a +nocreate flag, you only have to have the lines you want to replace in the tbm (in this case, would be just $Flags: )
This is a misconception; no information is actually required for a ship table entry except its name (although attempting to actually do anything with such an entry, like look at it in the F3 lab, will almost certainly result in warnings/errors/crashes). The only thing "+nocreate" does is say that an entry for the ship won't be created if it doesn't already exist; if you can guarantee that it will already exist, it serves no purpose (it's only really useful for things like the MediaVPs, which may be used as a secondary mod for mods that may not use the retail ships.tbl file).

That being said, it's common practice to use "+nocreate" with any entry meant to modify an existing entry "just in case", and/or because of misconceptions that the entry otherwise wouldn't be valid.

How is that a misconception? and how is that relevant?  :confused:
He's trying to overwrite a field in an existing ship, and was asking whether he needed to paste the whole entry or just the line to be replaced, in which case the answer is "only the line to be replaced".

Whether +nocreate is necessary or not does not factor in to this.

Your tangent on there not needing to be any actual lines in a ship entry (and not having +nocreate) is neither relevant, and nor useful other than for trivia purposes.
Yes, you don't need +nocreate, but why would you encourage poor practice? Having it there has no downside, even if the entry you are seeking to modify is guaranteed to exist. And can you really guarantee that an entry will always exist? Mods can evolve over time to the point where you may need to expunge certain entries from the base ships.tbl just to reduce clutter, etc. You can bet that if you promote not using it if you can "guarantee* the base entry will exist, someone will forget about that, delete/remove the base entry and wonder why they still have such a ship entry and why it's causing the game to crash (or throw errors).
I would rather just perpetuate this "misconception" because frankly it makes for good practices.
Title: Re: How to clear techroom?
Post by: AdmiralRalwood on November 05, 2016, 05:56:22 pm
How is that a misconception?
...he asks, before demonstrating that he seems quite clear on how it's a misconception. :wtf:

and how is that relevant?  :confused:
He's trying to overwrite a field in an existing ship, and was asking whether he needed to paste the whole entry or just the line to be replaced, in which case the answer is "only the line to be replaced".

Whether +nocreate is necessary or not does not factor in to this.

Your tangent on there not needing to be any actual lines in a ship entry (and not having +nocreate) is neither relevant, and nor useful other than for trivia purposes.
A much better question; it's relevant because that's how the engine works! If you're wondering why that was the only information my post included, it's because it originally included more information but niffiwan ninja'd me in the process, so I removed the redundant parts.

Yes, you don't need +nocreate, but why would you encourage poor practice? Having it there has no downside, even if the entry you are seeking to modify is guaranteed to exist. And can you really guarantee that an entry will always exist? Mods can evolve over time to the point where you may need to expunge certain entries from the base ships.tbl just to reduce clutter, etc. You can bet that if you promote not using it if you can "guarantee* the base entry will exist, someone will forget about that, delete/remove the base entry and wonder why they still have such a ship entry and why it's causing the game to crash (or throw errors).
I would rather just perpetuate this "misconception" because frankly it makes for good practices.
I would argue that modding by voodoo is worse practice than not including a redundant line; as for there being "no downside", the downside is that people get into the habit of adding "+nocreate" to entries that shouldn't have it, and then get confused when FSO complains at them (this has happened before; had someone very confused ask me why "+nocreate" couldn't be used with Ship Templates and it took quite a while for the explanation to sink in because they had a misconception of what "+nocreate" actually did).

Also, "mods can remove the base ship and then have a pointless +nocreate entry lying around" doesn't really strike me as an argument in favour of the behavior you're describing; it sounds like the worst kind of practices to be encouraging.

Lastly, you seem... unusually hostile about this? Aggravated, maybe? Perhaps I'm reading tone where there is none, in which case don't worry about it, but I was really just providing some extra information because I feel like we have enough bad information being passed around (that we later discover has no basis in how the engine actually works) as it is; no need to take it personally.
Title: Re: How to clear techroom?
Post by: Droid803 on November 05, 2016, 06:56:39 pm
I may have come off a bit hostile about it, yes. Apologies.
Yes, you've explained the general misconception sufficiently well. I was just very confused by the lack of relevance of the post, and how the quoted statement actually referred to the misconception at all?

That and mod debugging triggers me. Probably.
*shudders*
Title: Re: How to clear techroom?
Post by: HLD_Prophecy on November 05, 2016, 09:06:18 pm
Help help everybody's arguing over my innocent question. help.  :p
Title: Re: How to clear techroom?
Post by: Droid803 on November 05, 2016, 09:44:02 pm
Naw im just being dumb