# Help: how to make these script shorter?

**URL:** <https://forum.kirupa.com/t/help-how-to-make-these-script-shorter/83151>\
**Category:** flash\
**Created:** [March 16, 2005, 3:52pm UTC](https://forum.kirupa.com/t/help-how-to-make-these-script-shorter/83151 "2005-03-16T15:52:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![antialan81](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@antialan81](https://forum.kirupa.com/u/antialan81)\
**Post date:** [March 16, 2005, 3:52pm UTC](https://forum.kirupa.com/t/help-how-to-make-these-script-shorter/83151/1 "2005-03-16T15:52:56Z")

</div>

Hello, I am facing the proble of lagging because of abundant of script.☹  
Could someone kind please help me to shorten this ? Thanks a lot.

**Exaple 1:**  
if(\_global.i==5){  
\_root.shoot5();  
}  
else if(\_global.i==6){  
\_root.shoot6();  
}

else if(\_global.i==7){  
\_root.shoot7();  
}

else if(\_global.i==8){  
\_root.shoot8();  
}  
else if(\_global.i==9){  
\_root.shoot9();  
}

else if(\_global.i==10){  
\_root.shoot10();  
}

**Example2:**  
if (spy1==1){  
with(\_root.spider1){  
gotoAndPlay(2);  
}  
}  
if (spy1==2){  
with(\_root.spider2){  
gotoAndPlay(2);  
}  
}

if (spy1==3){  
with(\_root.spider3){  
gotoAndPlay(2);  
}  
}

if (spy1==4){  
with(\_root.spider4){  
gotoAndPlay(2);  
}  
}

if (spy1==5){  
with(\_root.spider5){  
gotoAndPlay(2);  
}  
}
