Woulff 0 Posted September 15, 2007 I can't seem to get this to work. Â What am I missing? I'm using a trigger to exec PilotsGetin.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> if (_nObject = nearestObject [Player, "Helicopter"]) then { Pilot1 assignAsCargo _nObject; Pilot2 assignAsCargo _nObject; [_Pilot1] orderGetIn true; _Pos = position PilotLounge; Pilot1 move _Pos; } esle { if (_nObject = nearestObject [Player, "car"]) then { Pilot1 assignAsCargo _nObject; Pilot2 assignAsCargo _nObject; [_Pilot1] orderGetIn true; _Pos = position PilotLounge; Pilot1 move _Pos; } esle { if (_nObject = nearestObject [Player, "Tank"]) then { Pilot1 assignAsCargo _nObject; Pilot2 assignAsCargo _nObject; [_Pilot1] orderGetIn true; _Pos = position PilotLounge; Pilot1 move _Pos; } } }; Share this post Link to post Share on other sites
Woulff 0 Posted September 15, 2007 This is what appears in the editor when previewing: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> '|#|};' Error Missing{ Share this post Link to post Share on other sites
UNN 0 Posted September 15, 2007 Don't know if you did a cut & paste from your script, for the example you posted. But it should be: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">else Not <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">esle Share this post Link to post Share on other sites
Woulff 0 Posted September 15, 2007 OMG! Thanks. I fixed the typo and still get same results. Share this post Link to post Share on other sites
UNN 0 Posted September 15, 2007 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (_nObject = nearestObject [Player, "Helicopter"]) then     {     Pilot1 assignAsCargo _nObject;     Pilot2 assignAsCargo _nObject;     [Pilot1] orderGetIn true;     _Pos = position PilotLounge;     Pilot1 move _Pos;     }     else     {     if (_nObject = nearestObject [Player, "car"]) then         {         Pilot1 assignAsCargo _nObject;         Pilot2 assignAsCargo _nObject;         [Pilot1] orderGetIn true;         _Pos = position PilotLounge;         Pilot1 move _Pos;         }         else         {         if (_nObject = nearestObject [Player, "Tank"]) then             {             Pilot1 assignAsCargo _nObject;             Pilot2 assignAsCargo _nObject;             [Pilot1] orderGetIn true;             _Pos = position PilotLounge;             Pilot1 move _Pos;             };         };     }; I reformatted the example with indents, makes it a bit easier to read. Just do a search and replace across your script, swapping tab's for eight spaces, when posting code on the forum. I also noticed you had mixed global and local variables for Pilot1 & _Pilot1. So I changed them all to global. As I said in a similar thread, which was completly ignored. The best way to figure it out, is with a bit of basic debugging. If a chunck of code is giving you problrms, them simplify it. Start with: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (_nObject = nearestObject [Player, "Helicopter"]) then     {     Pilot1 assignAsCargo _nObject;     Pilot2 assignAsCargo _nObject;     [Pilot1] orderGetIn true;     _Pos = position PilotLounge;     Pilot1 move _Pos;     }     else     {     }; If you get the same error, then you only need to worry about a third of your script. If that works ok, then add: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (_nObject = nearestObject [Player, "Helicopter"]) then     {     Pilot1 assignAsCargo _nObject;     Pilot2 assignAsCargo _nObject;     [Pilot1] orderGetIn true;     _Pos = position PilotLounge;     Pilot1 move _Pos;     }     else     {     if (_nObject = nearestObject [Player, "car"]) then         {         Pilot1 assignAsCargo _nObject;         Pilot2 assignAsCargo _nObject;         [Pilot1] orderGetIn true;         _Pos = position PilotLounge;         Pilot1 move _Pos;         }         else         {         };     }; And so on... I know it's tempting to get other people to figure it out (not so much you). But in the long run, you will save yourself so much more time, if you can quickly track down problems as soon as they arise. Share this post Link to post Share on other sites
Woulff 0 Posted September 15, 2007 Thank you! Here is the correct code: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _hObject = nearestObject  [Pilot1, "Helicopter"]; _cObject = nearestObject  [Pilot1, "car"]; if (nearestObject = "Helicopter") then    {    Pilot1 assignAsCargo _hObject;    Pilot2 assignAsCargo _hObject;    [Pilot1] orderGetIn true;    _Pos = position PilotLounge;    Pilot1 move _Pos;    }    else         {         if (nearestObject = "car") then             {              Pilot1 assignAsCargo _cObject;              Pilot2 assignAsCargo _cObject;              [Pilot1] orderGetIn true;              _Pos = position PilotLounge;              Pilot1 move _Pos;              }         }; As you can see I had the beginning statements wrong. That is why it was showing: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> '|#|};' Error Missing{ I agree with about doing the research and troubleshooting before posting.  I jumped the gun. Share this post Link to post Share on other sites
Gobbs 0 Posted September 16, 2007 Shouldn't the "=" inside the if conditions be "==" for SQF? I believe a single "=" is an assignment, making the first if always true. It won't cause an error, but you can never get to the rest of the condition testing in the code block. Share this post Link to post Share on other sites
UNN 0 Posted September 16, 2007 Actualy there are a few other things that don't look right. Perhaps if you posted some details on what you're trying to do? Share this post Link to post Share on other sites