Advertisement

Author Topic: Very weird error... Please help!  (Read 423 times)

0 Members and 1 Guest are viewing this topic.

Offline L!nk

  • Members
  • *
Very weird error... Please help!
« on: 21 Feb 2008, 17:34:44 »
I get a "while loop" error when I run the script for I think 2 minutes. I pops up at the top of my screen while playing.
Inside the "while" loop is: sleep 1;

It reads more or less like this:

"while {(alive player)} # do"
                              ^
                               l
                     here is the problem

It does not specify what type of error it is. I just says "Error" and then the location of the problem. eg. line 27

Driving me crazy....!!! >:(
Please help.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Very weird error... Please help!
« Reply #1 on: 21 Feb 2008, 17:44:32 »
Post the whole loop, the problem is inside it most likely.
Project MCAR   ---   FWW2 - Finland At War 1939-1945
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Tajin

  • Members
  • *
Re: Very weird error... Please help!
« Reply #2 on: 21 Feb 2008, 18:16:28 »
Either that, or a missing symbol before it.
So, post a bigger snipplet of the code instead of a single line. (since that one is correct)

Offline L!nk

  • Members
  • *
Re: Very weird error... Please help!
« Reply #3 on: 21 Feb 2008, 18:50:57 »
Ok, here is my exact code:
-----------------------------------------------------------------------------------------
while {(alive player) && (player == vehicle player) && (player distance WestMHQ < 50)} do
{
   sleep 1;
};
if (!(alive _unit)) then {hint "player dead"};
if (_unit != vehicle _unit) then {hint "player in vehicle"};
-----------------------------------------------------------------------------------------

:scratch:

and the error:

-----------------------------------------------------------------------------------------
'...yer} && (player distance WestMHQ)} #do
{
sleep 1;
};
if (!(alive _unit)) the...'
Error
File
C:\blah\blah\blah.sqf, line 11
-----------------------------------------------------------------------------------------
When I retry this mission without restarting the game. I get a CTD.
BTW, I tested on ArmaA 1.09Beta and 1.08

thx in advance.
L!nk
« Last Edit: 21 Feb 2008, 18:59:07 by L!nk »

Offline L!nk

  • Members
  • *
Re: Very weird error... Please help!
« Reply #4 on: 01 Mar 2008, 19:57:02 »
Still have to figured this out. Someone please help. This is preventing me from doing something awesome.

Thx.
L!nk

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Very weird error... Please help!
« Reply #5 on: 01 Mar 2008, 20:07:16 »
If your error is indeed on line 11, why does it look like line 1 to us, is there a previous 10 lines we haven't seen yet?


Planck
I know a little about a lot, and a lot about a little.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Very weird error... Please help!
« Reply #6 on: 01 Mar 2008, 20:45:56 »
Code: [Select]
while {(alive player) && (player == vehicle player) && ((player distance WestMHQ) < 50)} do
{
   sleep 1;
};

Offline L!nk

  • Members
  • *
Re: Very weird error... Please help!
« Reply #7 on: 02 Mar 2008, 11:24:49 »
here is the whole file.
called in this way: [] execVM "filename.sqf"


Code: [Select]
LinkCTI_MHQBuildAction =
{
_actionOptionsObject = objNull;
_actionOptionsID = -1;

if (_actionOptionsID == -1) then {_actionOptionsObject = player; _actionOptionsID = _actionOptionsObject addAction ["MHQ Build Options", "client\ActionMHQBuild.sqf"]};
while {(alive player) && (player == vehicle player) && (player distance WestMHQ < 50)} do
{
sleep 1;
};
if (!(alive _unit)) then {hint "player dead"};
if (_unit != vehicle _unit) then {hint "player in vehicle"};
if (_actionOptionsID != -1) then {_actionOptionsObject removeAction _actionOptionsID; _actionOptionsID = -1};
sleep 1;
call LinkCTI_MHQBuildAction;
};

sleep 1;
call LinkCTI_MHQBuildAction;

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Very weird error... Please help!
« Reply #8 on: 02 Mar 2008, 11:41:46 »
Try this and read the NOTE:

Code: [Select]
if (isNil "LinkCTI_MHQBuildAction") then
{
LinkCTI_MHQBuildAction =
{
   private["_actionOptionsObject", "_actionOptionsID", "_unit"];
 


   // NOTE: In your script, _unit is undefined so set it to the corresponding value or replace it by player   



   while {true} do
   {
_actionOptionsObject = objNull;
_actionOptionsID = -1;

if (_actionOptionsID == -1) then {_actionOptionsObject = player; _actionOptionsID = _actionOptionsObject addAction ["MHQ Build Options", "client\ActionMHQBuild.sqf"]};
while {(alive player) && (player == vehicle player) && ((player distance WestMHQ) < 50)} do
{
sleep 1;
};
if (!(alive _unit)) then {hint "player dead"};
if (_unit != vehicle _unit) then {hint "player in vehicle"};
if (_actionOptionsID != -1) then {_actionOptionsObject removeAction _actionOptionsID; _actionOptionsID = -1};
sleep 1;
   };
};
};

sleep 1;
[] spawn LinkCTI_MHQBuildAction;

Offline L!nk

  • Members
  • *
Re: Very weird error... Please help!
« Reply #9 on: 02 Mar 2008, 12:56:22 »
aha! seem to work so far.

Just wondering, you sire have a diffirent way of programming than mine.

Is mine incorrect or is it just esier for you.

Why the "isNil" and "spawn" and "private" commands.

Mine still works but, I just want to know I your is maybe better?