Author Topic: Stop FRED whining about a subsystem in a SEXP not present in a ship?  (Read 1086 times)

0 Members and 1 Guest are viewing this topic.

Offline Shivan Hunter

  • 210
  • FRED needs lambdas!
Stop FRED whining about a subsystem in a SEXP not present in a ship?
I have a SEXP that fires Alpha 1's turret07 beam at a ship. Alpha 1 doesn't have a turret07 at mission start, because it hasn't been set-ship-class'd into an SC Lilith yet. So FRED whines about the fact that Alpha 1 doesn't have a turret07 subsystem, because FRED thinks I'm a dumbass (I am actually a dumbass but not for this particular reason) and will be evaluating this SEXP at some point when the player is not in fact an SC Lilith. (would it even be a problem if I did? FS's usual MO for this type of error is "gracefully and silently fail" which isn't necessarily a problem...)

anyway how do I shut FRED up, preferably without using a stupid hack? I have confirmed that the SEXP works fine (except for a separate problem in my lua script) ingame, except for the subsystem error that FS throws.

 

Offline Axem

  • 211
Re: Stop FRED whining about a subsystem in a SEXP not present in a ship?
Well the issue is that FRED does all of its validity tests with variables by swapping in the default value into the sexps. Since Alpha 1 doesn't initially have a turret07, it raises a flag, even though you know it will eventually have one.

How about instead of directly referencing Alpha 1's turret07, you have a variable that references a dummy Lilith (which doesn't even have to appear in the mission, the arrival cue could be just set to false) so FRED will be all like "Yeah, this has a turret07, this is okay". Then when you change-ship-class, you change that variable to Alpha 1.

So its like

Code: [Select]
fire-beam
  @Variable('Dummy Lilith')
  turret07

That's the best thing I can think of right now.

 

Offline Shivan Hunter

  • 210
  • FRED needs lambdas!
Re: Stop FRED whining about a subsystem in a SEXP not present in a ship?
Hmm. I wasn't using variables at all (I had just used edit data to change the subsystem name in the SEXP to turret07). Actually, before I saw your post I changed the subsystem name in the SEXP to a variable containing "turret07" by default, and FRED no longer throws an error - which is odd, because I've encountered the checking-variable-defaults thing before.

Anyway, it works and isn't much of a hack, so it'll do I guess. Thanks anyway!

 

Offline Axem

  • 211
Re: Stop FRED whining about a subsystem in a SEXP not present in a ship?
Haha, I must have gotten my wires mixed up and added complexity into your problem. :p

 

Offline Shivan Hunter

  • 210
  • FRED needs lambdas!
Re: Stop FRED whining about a subsystem in a SEXP not present in a ship?
No, it made sense - I was using a variable for a ship name a while ago (since I needed to create a bunch with ship-create and then explode them, long story), and FRED complained since the default value wasn't a ship in the mission. Changing it to Alpha 1 stopped the errors. Not sure why FRED didn't catch this one - maybe it doesn't test for existing subsystems as rigorously as existing ships? Anyway, I'm glad it didn't because it doesn't need to.