Morrowind scripting: on simple statements and setdelete delay
Print

Posted 03 June 2010 - 09:52 PM Nice ambitious project here!

NMZmaster, on 03 June 2010 - 06:30 AM, said:

If any script geniuses out there see something horribly wrong with my general script structure that is causing this, I can offer you a pretend cookie

Uhm, wait, this is mostly MWSE stuff ... (rubbing Fliggerty's lamp ) Some things you could try...
- refine your syntax until MWEdit compiles in Strong Warning Level mode without these glitches
- try waiting a few seconds instead of a few frames between disable and setdelete, you have to be sure there are no more spell effects animation/sound playing
- use statements as simple as possible ( max 2 operators per assignment )

example: before

set zangle to ( zangle * 3.1415 / 180 )
;MessageBox "zangle %0.00f xpos %0.00f ypos %0.00f px %0.00f py %0.00f", zangle, xpos, ypos, px, py	
set xtemp to ( zangle - ( zangle * zangle * zangle / 6 ) + ( zangle * zangle * zangle * zangle * zangle / 120 ) )
set ytemp to ( 1 - ( zangle * zangle / 2 ) + ( zangle * zangle * zangle * zangle / 24 ) )
set xtemp to ( xtemp - ( zangle * zangle * zangle * zangle * zangle * zangle * zangle / 5040 ) )
set ytemp to ( ytemp - ( zangle * zangle * zangle * zangle * zangle * zangle / 720 ) )
; ...
set dx1 to ( ( GetSecondsPassed * vx ) + xpos )

after

set zangle to ( zangle * 0,0174533 )
;MessageBox "zangle %0.00f xpos %0.00f ypos %0.00f px %0.00f py %0.00f", zangle, xpos, ypos, px, py	
float zangle2
set zangle2 to ( zangle * zangle )
float zangle3
set zangle3 to ( zangle2 * zangle )
float zangle4
set zangle4 to ( zangle3 * zangle )
float zangle5
set zangle5 to ( zangle4 * zangle )
float zangle6
set zangle6 to ( zangle5 * zangle )
float zangle7
set zangle7 to ( zangle6 * zangle )
set xtemp to ( zangle + ( zangle5 / 120 ) )
set xtemp to ( xtemp  - ( zangle3 / 6 ) )
set ytemp to ( 1 +  ( zangle4 / 24 ) )
set ytemp to ( ytemp - ( zangle2 / 2 ) )
set xtemp to ( xtemp - ( zangle7 / 5040 ) )
set ytemp to ( ytemp - ( zangle6 / 720 ) )
; ....
set dx1 to ( vx * GetSecondsPassed )
set dx1 to ( dx1 + xpos )

I'm not sure these things may help (I suspect you are simply trying to spawn/move too much for the engine), but maybe they are worth a try. Good luck and hold on, this is really a great project !


Posted 04 June 2010 - 10:05 AM NMZmaster, on 04 June 2010 - 12:33 AM, said:

On the matter of SetDelete after a Disable, though: From what I'd read, it was suggested to wait several frames before the SetDelete command is issued. But you're saying that it is better to do a time-based wait rather than frame-based wait?

It does not matter, as long as you are sure the sound/animation played by the object is over before setdelete.
Using a frame counter is hardware dependent though (for instance a 3 seconds sound would mean 30 frames at 10 FPS, 90 frames at 30FPS) , maybe using GetSecondsPassed is safer/easier to test.
Also, if you need to spawn an object which is spawning children objects, better verify to not delete the father before any of the the spawned children.

Last updated ( Friday, 26 June 2020 )