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 03-12-2002, 07:28 AM
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
Talking Some Optimization for You All...

Talk about optimization:
This is a beginning. ;)
NPC Code:

// I could really care less if anyone uses this, because it will be 2 player in about a week.
if (created || initialized) {
disabledefmovement;
this.vars = {1,1,int(random(0,360)),32,32,this.vars[3]-5,this.vars[4]-5,this.vars[3]-10,this.vars[4]-10,this.vars[5],this.vars[6],.75,.5,this.vars[3],this.vars[6],0};
setarray this.keys,11;
timeout=.05;
}
if (timeout) {
for (i=0;i<11;i++;) this.keys[i] = (keydown(i) ? 1 : 0);
this.ix = (cos(this.vars[2]/57.3)*this.vars[11])-(cos(this.vars[2]/57.3));
this.iy = (sin(this.vars[2]/57.3)*this.vars[11])-(sin(this.vars[2]/57.3));
this.vars = {(this.vars[9]>=this.vars[3]&&this.vars[10] in |this.vars[14]-.75,this.vars[14]+.25| ? 0 : (this.vars[9]<=this.vars[7] ? 1 : this.vars[0])),(this.vars[10]>=this.vars[4] ? 0 : (this.vars[10]<=this.vars[8] ? 1 : this.vars[1])),this.vars[2],this.vars[3],this.vars[4],this.vars[5],this.vars[6],this.vars[7],this.vars[8],this.vars[9]+(this.vars[0]==1 ? abs(this.ix) : -abs(this.ix)),this.vars[10]+(this.vars[1]==1 ? abs(this.iy) : -abs(this.iy)),this.vars[11],this.vars[12],this.vars[13],this.vars[14]+(this.keys[2]==1&&this.vars[14]<this.vars[4] ? this.vars[12] : (this.keys[0]==1&&this.vars[14]>this.vars[8] ? -this.vars[12] : 0)),(this.vars[9]>this.vars[3]+.25&&!(this.vars[10] in |this.vars[14]-.75,this.vars[14]+.25|) ? 1 : 0),this.vars[16]+(this.vars[9]>=this.vars[3]&&this.vars[10] in |this.vars[14]-.75,this.vars[14]+.25| ? 1 : 0)};
if (this.vars[15]==1) say2 You Lost!;
showimg 1,@.,this.vars[9],this.vars[10];
showimg 2,@|,this.vars[13],this.vars[14]; changeimgzoom 2,.5;
showimg 3,@#v(this.vars[16]),25,100; changeimgvis 3,4; changeimgzoom 3,.5;
timeout=(this.vars[15]==0 ? .05 : 0);
}

__________________

!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
  #2  
Old 03-12-2002, 08:24 AM
Aknts Aknts is offline
Level Designer
Aknts's Avatar
Join Date: Apr 2001
Location: USofA
Posts: 3,340
Aknts will become famous soon enough
Send a message via AIM to Aknts
??????
__________________
Reply With Quote
  #3  
Old 03-12-2002, 08:45 AM
Goboom Goboom is offline
Pixel Monkey
Goboom's Avatar
Join Date: Dec 2001
Location: Michigan
Posts: 1,702
Goboom is on a distinguished road
Send a message via ICQ to Goboom Send a message via AIM to Goboom Send a message via MSN to Goboom Send a message via Yahoo to Goboom
it freezes sometimes...:-\
__________________
Reply With Quote
  #4  
Old 03-12-2002, 08:49 AM
Aknts Aknts is offline
Level Designer
Aknts's Avatar
Join Date: Apr 2001
Location: USofA
Posts: 3,340
Aknts will become famous soon enough
Send a message via AIM to Aknts
I don't get it...As soon as I play the level it says you lose
__________________
Reply With Quote
  #5  
Old 03-12-2002, 09:01 AM
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
Quote:
Originally posted by Aknts
I don't get it...As soon as I play the level it says you lose
yeah set the player x and y to 32, probably should have mentioned that. Its the placement of the script...sorry...lol
__________________

!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
  #6  
Old 03-12-2002, 09:07 AM
Goboom Goboom is offline
Pixel Monkey
Goboom's Avatar
Join Date: Dec 2001
Location: Michigan
Posts: 1,702
Goboom is on a distinguished road
Send a message via ICQ to Goboom Send a message via AIM to Goboom Send a message via MSN to Goboom Send a message via Yahoo to Goboom
ya you got to move quick
__________________
Reply With Quote
  #7  
Old 03-13-2002, 12:41 AM
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
Quote:
Originally posted by Kaimetsu
Small code size doesn't necessarily mean good code. Bear that in mind.
True, however this is not only small code, but optimization, and it works well. I don't know weather you like it at all, but in my opinion its pretty good, and thats just the start. . I was actually posting to get some thoughts on it...any opinions?
__________________

!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
  #8  
Old 03-13-2002, 01:39 AM
Spanko Spanko is offline
Squeaker of Soles
Spanko's Avatar
Join Date: Nov 2001
Location: The Netherworl...lands
Posts: 1,366
Spanko is on a distinguished road
Send a message via ICQ to Spanko Send a message via AIM to Spanko Send a message via Yahoo to Spanko
Evil, evil, where are the line breaks? AAHHHH!
__________________

ICQ: 125283920
MSN: [email protected]
AIM: Squeax0r
Squeaker seems unable to access the forum using this account.. tis a sad day.
Now with occasional Asuka flavour! Ooops a bit too much...
Asuka should be king of Dustari!

"Y'know, some days even my lucky rocketship underpants don't even help."
Reply With Quote
  #9  
Old 03-13-2002, 07:20 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
writing cryptic code makes you look smarter
Reply With Quote
  #10  
Old 03-13-2002, 07:33 AM
BARGAD BARGAD is offline
Registered User
Join Date: Aug 2001
Location: Sweden
Posts: 345
BARGAD will become famous soon enough
Quote:
Originally posted by Faheria_GP2
writing cryptic code makes you look smarter
Specially to newbies like me who have no idea what this script does, and no clue what most of the commands does neither

Maths and such makes me confused O.o!
__________________
Gori

Born To Kill
Death Silent Killers

Two little newbies, out in the sun.
Then came Gori and there was only one.

Reply With Quote
  #11  
Old 03-13-2002, 08:24 AM
Goboom Goboom is offline
Pixel Monkey
Goboom's Avatar
Join Date: Dec 2001
Location: Michigan
Posts: 1,702
Goboom is on a distinguished road
Send a message via ICQ to Goboom Send a message via AIM to Goboom Send a message via MSN to Goboom Send a message via Yahoo to Goboom
Quote:
Originally posted by Faheria_GP2
writing cryptic code makes you look smarter
your funny
__________________
Reply With Quote
  #12  
Old 03-13-2002, 09:30 AM
haunter haunter is offline
Registered User
haunter's Avatar
Join Date: Mar 2001
Posts: 7,989
haunter is on a distinguished road
0.o

... I don't get it, it doesn't do anything...
Reply With Quote
  #13  
Old 03-14-2002, 01:22 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
Well, you live you learn, right. I know in this version, it has no line bvreaks, but the one i have here has line breaks all over, the point is I want it to be cryptic. Its point was to have fun to see how short I could get it and make it still work, it really does improve your scripting ability.
__________________

!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
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 11:45 PM.


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