I have a issue running more then 1 for loop in a function when I separate into 2 functions it works fine is there any other way around this ?
msmalik681 said:I have a issue running more then 1 for loop in a function when I separate into 2 functions it works fine is there any other way around this ?
void menugo(char sfx, char newName)
{
void textbox = getindexedvar("speech"); //place speech entity in indexedvar
int i; int x; //for loop counter
if(sfx==NULL()) sfx="move"; //set default sfx if nothing set
void movesfx = loadsample("data/sounds/menu_"+sfx+".wav"); //load sound effect to be used
void menuList = getindexedvar("menuList"); //get menu array
int menuCount = getentityvar(textbox,"menuCount"); //get menu index
char menuName = get(menuList,getentityvar(textbox,"menuCount"));//get current menu location by name
for(x=0;x<=30;x++)
{
if(get(menuList,x)==newName) //look for text set by user
{
setentityvar(textbox, "menuCount",x); //change menu index to match
for(i=0;i<=30;i++)
{
if(gettextobjproperty(i,"text")==menuName) //scroll all text objects untill a mach is found
{
setentityvar(textbox, "x",gettextobjproperty(i,"x")-20); //new menu pointer loction
setentityvar(textbox, "y",gettextobjproperty(i,"y")-2); //new menu pointer location
playsample(movesfx, 0, 150, 150, 100, 0); //play menu movement sample
break;
}
}
break;
}
}
}
menuName = get(menuList,getentityvar(textbox,"menuCount"));