Modding, Mission Design, and Coding > The Scripting Workshop

Scripting issues

(1/1)

Wanderer:
I encountered something very annoing while doin some scripting on new HEAD branch build (27/02/2007).

While trying the following script i get instant CTD when 'weapon' is accessed (like weapon.Position). For example ba.error(weapon:getBreedName()) results in ctd instead of error. All this happens with 'standard' r-build. Debug build does not crash.


--- Code: ---#Global Hooks

$Simulation:

[

nullvec = ba.createVector(0,0,0)
frametime = ba.getFrametime()
smoke = gr.loadTexture("ParticleSmoke01", true)

]

#End

#Conditional Hooks

$Weapon Class: Crusader
$On Ship Collision:

[


weapon = hv.Weapon
--ba.error(weapon:getBreedName())
weaponposition = weapon.Position
for d = 1,6 do
   ts.createParticle(weaponposition,ba.createVector(math.random(-75,75),math.random(-75,75),math.random(-75,75)),frametime,math.random(5,15),PARTICLE_BITMAP,-1,false,smoke)
end

]

#End
--- End code ---

Nuke:
i never could get those error messages to work.

Wanderer:
The error messages work just fine. ba.error crashes the game in both debug and r builds while ba.warning just shows a warning and only in debugs. But that wasnt the problem i was having. For some reason r build was unable to 'process' the newly created weapon variable.

Wanderer:
More on this issue... Hook variables 'Version', ' Player', and 'Viewer' are still valid and ok in the conditional hook. However using either of the "specific" hook variables 'Ship' or 'Weapon' causes instant ctd without any errors while testing with r build. Both (all) hook variables work fine in debug.

This is all i can get from the error:

--- Code: ---fs2_open_r_20070228 caused an Access Violation in module fs2_open_r_20070228.exe at 001b:0062debc.
Exception handler called in FreeSpace 2 Main Thread.
Error occurred at 3/2/2007 18:03:12.
E:\Games\FreeSpace2\fs2_open_r_20070228.exe, run by Someone.
1 processor(s), type 586.
1024 MBytes physical memory.
Read from location 000000d8 caused an access violation.
--- End code ---

WMCoolmon:
I took a look at this, and my guess is that it has something to do with a hack I threw into the code that only gets called for those hook variables, because it is (theoretically) more efficient.

I did some poking around and I think I can make things more efficient while eliminating my dirty little (clever) hack.

Navigation

[0] Message Index

Go to full version