Thread: Why so laggy?
View Single Post
  #9  
Old 02-26-2002, 06:58 AM
Faheria_GP2 Faheria_GP2 is offline
Banned
Faheria_GP2's Avatar
Join Date: Oct 2001
Posts: 1,177
Faheria_GP2 is on a distinguished road
Re: Why so laggy?

Quote:
Originally posted by relenakat
This is sorta jsut a simple script but what I'm wondering is why is it so laggy?

NPC Code:

}
if (created||playerenters) {
setcharprop #3,head5.gif;
set O.o;
}
while (O.o&&this.O.o<=20){
npcs[0].y=npcs[0].y-.5;
sleep .3;
this.O.o = this.O.o+1;
setcharani walk,;
dir = 0;
}
while (O.o&&this.O.o<=40){
npcs[0].x=npcs[0].x+.5;
sleep .1;
this.O.o = this.O.o+1;
dir = 3;
}
while(this.O.o==41){
setcharani idle,;
message This is *blank*'s room;
}

haghm, that script is very...for a lack of a better word, crappy...

the whiles aren't inside an event, the last one gets stuck in an infinite loop, the thing should be a for loop, maybe a timeout loop...just terrible...also, you should be using "x" instead of "npcs[0].x"...this.O.o is never set back to zero, so this whole thing will only run once, then poop out...what you are trying to do seems too complex for you...
Reply With Quote