Home   Help Search Login Register  

Author Topic: Need debugging first aid!  (Read 1228 times)

0 Members and 1 Guest are viewing this topic.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Need debugging first aid!
« on: 08 Jun 2007, 23:47:10 »
Please find attached a zipped mission. I need help debugging because I simply can not findf what is wrong and it is either something very simple and stupid or subtle and complicated. In any event I am going mad staring at it.  >:(

Preview the mission and use the over object action. I get a syntax error on a trivially simple code line 5 of the script overobject.sqf.  ARG!!!  >:( >:( >:( >:( >:( >:( >:( >:(
« Last Edit: 09 Jun 2007, 02:15:41 by Mr.Peanut »
urp!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Need debugging first aid!
« Reply #1 on: 09 Jun 2007, 00:23:18 »
Code: [Select]
private

["_pos","_dist","_type","_buf","_breakflag","_obj","_j","_c","_xmin","_xmax","_ymin","_ymax","_zmin","_zmax","_mpos","_mx","_my","_mz","_wz"

,"_return"];
_pos = _this select 0;
_type = _this select 1;
_dist = _this select 2;
_buf = [0,0,0];
if (count _this > 3) then {_buf = _this select 3;};
_breakflag = TRUE; 
_obj = nearestObjects [_pos, _type, _dist];
_wz = -99999;
for [{_j = 0},{_j < count _obj && _breakflag},{_j = _j + 1}] do
{
   _c = boundingBox (_obj select _j);
   _xmin = ((_c select 0) select 0) - (_buf select 0);
   _xmax = ((_c select 1) select 0) + (_buf select 0);
   _ymin = ((_c select 0) select 1) - (_buf select 1);
   _ymax = ((_c select 1) select 1) + (_buf select 1);
   _zmin = ((_c select 0) select 2) - (_buf select 2);
   _zmax = ((_c select 1) select 2) + (_buf select 2);
   _mpos = (_obj select _j) worldToModel _pos;
   _mx = _mpos select 0;
   _my = _mpos select 1;
   _mz = _mpos select 2;
   if (_mx > _xmin && _mx < _xmax && _my > _ymin && _my < _ymax) then
   {
      _breakflag = FALSE;
      _wz = ((_obj select _j) modelToWorld [0,0,_zmax]) select 2;
   };
};
[not _breakflag,_wz]

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Need debugging first aid!
« Reply #2 on: 09 Jun 2007, 02:15:01 »
offs.... every function I ever wrote for OFP I knew that info about last unsemicoloned line being the return value was not true, but there I was doing it. Thanks. I was losing my mind.
urp!