aook002 0 Posted June 17, 2004 Hi again..... Ok i have two scripts: takeoff.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">titleText ["", "white out"] ~2 plane setpos [getpos plane select 0, getpos plane select 1, 80] v0=125; dir=getDir(plane);vBase = [sin(dir),cos(dir), 0]; plane setVelocity [(vBase select 0)*v0,(vBase select 1) * v0, 0] ~7.5 titleText ["", "white in"] exit stoppedpilot.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">goto "halt" #halt v0=0; dir=getDir(plane);vBase = [sin(dir),cos(dir), 0]; plane setVelocity [(vBase select 0)*v0,(vBase select 1) * v0, 0] ;;<insert if statement here - then goto "stop"> goto "halt" #stop exit Ok what i want to do is, i want the "stoppedpilot.sqs" script to check if the "takeoff.sqs" script is running and if yes, stop the running of the "stoppedpilot.sqs" script. Thanks Aook Share this post Link to post Share on other sites
Ninja_STO 0 Posted June 17, 2004 Ok, this is a guess since I'm starting to learn things. But when your first script "takeoff.sqs" starts, it can set a variable to true, and when that script ends, it sets that variable back to false. With the "stoppedpilot.sqs", it can start only when the variable is false, and if the variable is set to true while it's running, it will just end. Make any sense? Remember, I'm a gimp with scripting, but maybe I am learning enough to give an idea? Share this post Link to post Share on other sites
aook002 0 Posted June 17, 2004 So something like this then...maybe... takeoff.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">running=true titleText ["", "white out"] ~2 plane setpos [getpos plane select 0, getpos plane select 1, 80] v0=125; dir=getDir(plane);vBase = [sin(dir),cos(dir), 0]; plane setVelocity [(vBase select 0)*v0,(vBase select 1) * v0, 0] ~7.5 titleText ["", "white in"] exit stoppedpilot.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">goto "halt" #halt ? (running=true) : goto "halt" v0=0; dir=getDir(plane);vBase = [sin(dir),cos(dir), 0]; plane setVelocity [(vBase select 0)*v0,(vBase select 1) * v0, 0] goto "halt" #stop exit Aook Share this post Link to post Share on other sites
aook002 0 Posted June 17, 2004 Well the running 'variable' doesnt work...does anyone know of a variable that would work. Also is my scripting correct? Thanks Aook Share this post Link to post Share on other sites
benu 1 Posted June 17, 2004 goto "halt" in the second script is pointless, except this is not the full script but an excerpt. Checking for equality is done with "==", not with "=", so it has to be: ? (running==true) : goto "halt" I am not sure if this is intended to be a singleplayer or mp mission, but for mp you should probably make running a publicvariable, depending on where each of the scripts is supposed to run. Share this post Link to post Share on other sites
aook002 0 Posted June 17, 2004 So benu in the first script would i change running=true to... running==true Aook Ps: England have just scored !!! And again !!!(England 3 - 0 Switzerland) Â Â Â Share this post Link to post Share on other sites
aook002 0 Posted June 17, 2004 Ok my scripts are like this now.... but still i get an error with:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? (running==true) : goto "stop" "takeoff.sqs" <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">running=true titleText ["", "white out"] ~2 deletevehicle fakeS1 deletevehicle fakeS2 deletevehicle fakeS3 S1 moveincargo plane S2 moveincargo plane S3 moveincargo plane plane setpos [getpos plane select 0, getpos plane select 1, 80] v0=125; dir=getDir(plane);vBase = [sin(dir),cos(dir), 0]; plane setVelocity [(vBase select 0)*v0,(vBase select 1) * v0, 0] ~7.5 titleText ["", "white in"] exit "stoppedpilot.sqs" <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">goto "halt" #halt ? (running==true) : goto "stop" v0=0; dir=getDir(plane);vBase = [sin(dir),cos(dir), 0]; plane setVelocity [(vBase select 0)*v0,(vBase select 1) * v0, 0] goto "halt" #stop exit Aook  Share this post Link to post Share on other sites
Ninja_STO 0 Posted June 17, 2004 One thing you can try is in your init.sqs, maybe make sure the variable is set to false at mission start? Also, with the first script, make the variable false again before exit, that way the variable is only true when that script is running. Like I said, I suck with scripting, but have seen something like this before. I just threw the idea out to see if the scripting guru's could actually go into more detail. But try working on it based on what I mentioned in this post, and see if it does help. And if my advice makes things worse...NOT THE FACE! Â Share this post Link to post Share on other sites
aook002 0 Posted June 17, 2004 Ok Ninja_STO i've made an addition to the init.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">running=false i didnt make the running=false at the end of the first script as it is only execed once. But i still get the error... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">'(running==true) |#|': Error ==: Type Bool, expected Number,String,Object,Side,Group Aook Share this post Link to post Share on other sites
MrZig 0 Posted June 17, 2004 With booleans (true/false) you don't check with "boolean == true" You check with just boolean or !boolean (! means not, but ! is smaller and smaller = better) So for your script, make it <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">goto "halt" #halt ~0.01 ? (running) : goto "stop" v0=0; dir=getDir(plane);vBase = [sin(dir),cos(dir), 0]; plane setVelocity [(vBase select 0)*v0,(vBase select 1) * v0, 0] goto "halt" #stop exit Always put a delay, unless you are tracking a bullet or something. Share this post Link to post Share on other sites
aook002 0 Posted June 17, 2004 That is sweeeeet. It works now. Cheers everybody and mrziggyziggy Aook Share this post Link to post Share on other sites
Ninja_STO 0 Posted June 17, 2004 Glad to see you got it working. Like I said in my first post, I really don't know jack about scripting. But I had an idea just based on something I saw in the command references, and hoped it helped. I'm also glad I didn't cause your pc to sizzle and smoke. Share this post Link to post Share on other sites
aook002 0 Posted June 17, 2004 Well im like you Ninja.....i dont have a bloody clue But after a bit of random tweaking i sometimes reach my goal. Thanks Anyway Everyone Aook Share this post Link to post Share on other sites
wizzywig 0 Posted July 22, 2004 when you reach your gole pm me please buddy Share this post Link to post Share on other sites
aook002 0 Posted July 22, 2004 Pm'd you Wizzywig. Aook Share this post Link to post Share on other sites