|
| 05 Dec 2011 05:51 PM |
Why does the code run, even the StageL isn't "Red"
coroutine.resume( coroutine.create( function() while StageL == "Red" do wait() Bot.AI:MoveTo(_G.Character.Torso.Position, _G.Character.Torso) end end ) ) |
|
|
| Report Abuse |
|
|
blockoo
|
  |
| Joined: 08 Nov 2007 |
| Total Posts: 17202 |
|
|
| 05 Dec 2011 05:54 PM |
| It may have something to do with coroutines running independent of the script, so it still sees StageL as "Red" even when it's not. Just a guess, though. |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2011 05:56 PM |
I could see that as a possibility, As "StageL" only changes when another event becomes active. |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2011 05:59 PM |
I don't know if this goes without asking, but how could I fix it?
(Besides not running it from a coroutine) |
|
|
| Report Abuse |
|
|
pwnedu46
|
  |
| Joined: 23 May 2009 |
| Total Posts: 7534 |
|
|
| 05 Dec 2011 06:02 PM |
If StageL's value is not "Red" then it does not continue checking for the loop and it goes through the rest of the script. since there's nothing else after it, the coroutine's status becomes "dead."
---------- ~ pwendu46, the unicorn ~ |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2011 06:05 PM |
Even though its dead, the bot follows me :c |
|
|
| Report Abuse |
|
|
blockoo
|
  |
| Joined: 08 Nov 2007 |
| Total Posts: 17202 |
|
|
| 05 Dec 2011 06:07 PM |
| Make the initial value of StageL something other than "Red" and see what happens. |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2011 06:10 PM |
He doesn't move.....
Odd how this happens, but I realized I might as well fix this now and use a string value. |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2011 06:19 PM |
?
Seems like when I get a good distance (100 studs+) he times out..... |
|
|
| Report Abuse |
|
|