Author Topic: Scripting issues  (Read 2140 times)

0 Members and 1 Guest are viewing this topic.

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
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: [Select]
#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

Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
i never could get those error messages to work.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
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.
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
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: [Select]
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.
Do not meddle in the affairs of coders for they are soggy and hard to light

  

Offline WMCoolmon

  • Purveyor of space crack
  • 213
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.
-C