combat-agent 0 Posted August 10, 2006 I have two scripts. One to create a vehicle, and one to check and see if the vehicle is dead. When I pass the name of the vehicle to the check life script it says theres an error, saying that what i passed is a string not a object. whats up that? heres my scripts The create script <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#Wagon ? sw1 == 1 and sw2 == 1: hint "error";exit ? sw1 == 1 and sw2 == 0: sw2 = 1; ? sw1 == 0: sw1 = 1; _p = "Wag" createvehicle [(getpos rhql select 0) + random 10, (getpos rhql select 1) + random 10,0] _p = format["swag%1",rWagonname]; [_p] exec "/scripts/supplycheck.sqs" Rmoney = Rmoney - 10 Hint format["You have purchased a new supply wagon. %1.", _P] rWagonName = rWagonName + 1 exit The checklife script, and oh by the way Ive tried (getdammage _1) == 1 and !(alive _1) <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_1 = _this select 0 #loop hint format["%1", _1] ? isnull _1: goto "end" ~5 goto "loop" #End ?_1 == sw1 select 0: sw1 = [] ?_1 == sw2 select 0: sw2 = [] hint "wagon dead" exit Any ideas why it is bringing up an error? Share this post Link to post Share on other sites
Chris Death 0 Posted August 10, 2006 hmm - i see an error but it shouldn't be related to your error message; sw1 is a numeric variable (like seen in your first script) in your second script you try to access sw1 as an array <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?_1 == sw1 select 0: sw1 = [] Why don't you just hint format the contents of your variables on screen to check if they're filled with what you expected? ~S~ CD Share this post Link to post Share on other sites
hoz 0 Posted August 10, 2006 Here your converting the object to a string <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_p = format["swag%1",rWagonname]; there fore when you pass _p to the scripting your passing a string. Try passing rWagonname instead of _p. Hoz Share this post Link to post Share on other sites
nindall 0 Posted August 10, 2006 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_p = format["swag%1",rWagonname] [_p] exec "/scripts/supplycheck.sqs" Switching these two lines around should work. To check if the unit is alive you can use either '!(alive _1)' or 'getDammage _1 == 1'. Share this post Link to post Share on other sites
UNN 0 Posted August 10, 2006 Edit: Never mind, if it's fixed, it's fixed. Share this post Link to post Share on other sites
combat-agent 0 Posted August 10, 2006 thanks for the replies. I did see that error in the scripts I posted here. I needed _p = format["swag%1",rWagonname] so i couldnt just pass rwagonname, rwagonname was a numerical valuethat increased to give the vehicles diffrent names. Quote[/b] ]Switching these two lines around should work. To check if the unit is alive you can use either '!(alive _1)' or 'getDammage _1 == 1'. That was what I needed, it did work, there was some more complications after i got that to work, but i got it all sorted out now. Thanks for the quick responses. Share this post Link to post Share on other sites