# Quick help with "eval" syntax needed

**URL:** <https://forum.kirupa.com/t/quick-help-with-eval-syntax-needed/2603>\
**Category:** Uncategorized\
**Created:** [May 28, 2002, 6:31pm UTC](https://forum.kirupa.com/t/quick-help-with-eval-syntax-needed/2603 "2002-05-28T18:31:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 28, 2002, 6:31pm UTC](https://forum.kirupa.com/t/quick-help-with-eval-syntax-needed/2603/1 "2002-05-28T18:31:11Z")

</div>

I’m modifing some code I, um, borrowed. The following loop statements check a movement variable on 9 different levels. Ive modified my site structure to multiple MCs instead of levels.

I can’t seem to get the correct syntax on the loops to change the evaluation line from levels to MC’s. the trick is that the MCs are all on level0 so I need to refer to them by the full name.

In fakescript:  
\_level0. eval(“mc”+i)…

Heres the original script.

on (press) {  
inmotion = false;  
for (i=1; i\<=10; i++) {  
if (eval("\_level"+i).movement == true) {  
inmotion = true;  
}  
}  
if (!inmotion) {  
for (i=1; i\<=10; i++) {  
if (i != 2) {  
if (eval("\_level"+i).active == true) {  
eval("\_level"+i).gotoAndPlay(“play\_out”);  
}  
}  
}  
}  
inmotion = false;  
for (i=1; i\<=10; i++) {  
if (eval("\_level"+i).movement == true) {  
inmotion = true;  
}  
}  
if (!inmotion && \_level0.mc2.active == false) {  
\_level0.mc2.gotoAndPlay(“play”);  
&nbsp &nbsp &nbsp &nbsp }  
}

avlisdivad

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 28, 2002, 8:04pm UTC](https://forum.kirupa.com/t/quick-help-with-eval-syntax-needed/2603/2 "2002-05-28T20:04:58Z")

</div>

\_level0[“mc”+i];

or if you really want to use eval:

eval(“level0.mc”+i);
