FreeSpace Releases > Scripting Releases

Change Name Script

<< < (2/2)

zookeeper:

--- Quote from: Admiral MS on February 08, 2013, 03:29:53 am ---When I saw this thread the first time I thought the same and tested it but for some reason the game ignored the change of .Name completely outside of scripting.

--- End quote ---

Well... now that you said that, I tested it myself too, and it worked for me just fine. I'm using an almost-latest nightly, but I doubt that makes a difference.


--- Code: ---$Formula: ( when
   ( has-time-elapsed 7 )
   ( script-eval
      "cn('Alpha 2', 'Foobar')"
   )
)
+Name: Event name
+Repeat Count: 1
+Interval: 1
--- End code ---

FelixJim:
When I tried to alter the name directly it actually worked perfectly, as far as I could see. Then I tried it in a debug build, which dropped dead from shock without so much as an error message, so I wasn't so sure it was a good idea.

As to the physics delay, from testing I think that the code needs finish at the script, do some physics calculations just in the regular engine, and then I need to change the value back. With single threading I don't see another way to dip in and out of the script like this.

Docking isn't carried over - that mess of docking nonsense is just to move the cargo across. It's kind of a fine line what should be handled in the script and in FRED, you can probably do most in either, so I was trying to see how much of it I could move script-side.

Creating ships does cause issues unless you reference the ship with a variable like @ship(Alpha 1) altered to @ship(mynewship) at the start in FRED (thank you Axem), but, again, I didn't see a way around that without setting up a lot more FRED-side than I wanted to.

Thanks all for comments!

zookeeper:

--- Quote from: FelixJim on February 08, 2013, 06:47:03 am ---When I tried to alter the name directly it actually worked perfectly, as far as I could see. Then I tried it in a debug build, which dropped dead from shock without so much as an error message, so I wasn't so sure it was a good idea.
--- End quote ---

Well, I did try my version on a debug build, but it was in the simplest kind of mission and it certainly sounds possible that in a more complicated mission it could cause a severe problem somehow.

Navigation

[0] Message Index

[*] Previous page

Go to full version