Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-24-2002, 01:43 PM
relenakat relenakat is offline
Registered User
Join Date: Feb 2002
Posts: 36
relenakat is on a distinguished road
Why so laggy?

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;
}

Reply With Quote
  #2  
Old 02-24-2002, 01:47 PM
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;
}

your "whiles" have no sleep
Reply With Quote
  #3  
Old 02-24-2002, 01:52 PM
relenakat relenakat is offline
Registered User
Join Date: Feb 2002
Posts: 36
relenakat is on a distinguished road
Err sorry I guess I was jsut to lazy to press the style button but it might be the sleeps I'll go check that and thanks!

Wow it was that!I guess I learned something else about loops that I hadn't run into.
Reply With Quote
  #4  
Old 02-24-2002, 02:09 PM
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
there will be future issues with that script which I am too lazy to address
Reply With Quote
  #5  
Old 02-25-2002, 10:08 PM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
Loops so many loops *gets dizzy*
Reply With Quote
  #6  
Old 02-25-2002, 10:21 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
The last while should get some 'break' or 'sleep'
Reply With Quote
  #7  
Old 02-25-2002, 10:33 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
hehe
Reply With Quote
  #8  
Old 02-25-2002, 11:57 PM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
lol. setting O.o ? Are there any keywords (or characters) that can't be used in flags? I thought i experianced one back a few versions with '-'.
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
Reply With Quote
  #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
  #10  
Old 02-26-2002, 07:17 AM
Bhala Bhala is offline
Disgruntled Monkey
Bhala's Avatar
Join Date: Mar 2001
Posts: 779
Bhala is on a distinguished road
it would be better to use 3 if's in a time out loop....
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:16 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.