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 05-19-2002, 01:18 PM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
2 functions ?

Is ok to set a function within a function?
NPC Code:

if (created||playerenters) {
toweapons Chat;
}
if (playerchats) {
tokenize #c;
for (i=0;i<tokenscount;i++) {
check();
}
}

// Functions
function check() {
if (strcontains(#t(i),#s(server.rsrvwords))) {
setplayerprop #c,Invalid and/or reserved words. Try again.;
} else {
addchat();
}
}


Reply With Quote
  #2  
Old 05-19-2002, 01:56 PM
Bhala Bhala is offline
Disgruntled Monkey
Bhala's Avatar
Join Date: Mar 2001
Posts: 779
Bhala is on a distinguished road
Yes. It helps clean up code a lot that way.
Reply With Quote
  #3  
Old 05-19-2002, 02:27 PM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
See what I am gonna have it do is have it add each token indivually to the string.
Reply With Quote
  #4  
Old 05-19-2002, 09:51 PM
BBflat BBflat is offline
Registered User
BBflat's Avatar
Join Date: Apr 2002
Location: United States of America
Posts: 573
BBflat is on a distinguished road
I did that once, and I got a bunch of nasty commas. =( Since my tokens were one character long, I just wrote something that took out every other character...
__________________
I am a .sig virus. Please put me in your .sig so I can continue to replicate.
Reply With Quote
  #5  
Old 05-19-2002, 11:52 PM
Despo1 Despo1 is offline
Registered User
Join Date: May 2002
Location: G3rM4nY
Posts: 38
Despo1 is on a distinguished road
Send a message via AIM to Despo1
i thing the formating of a script is better to use some function in function for menues or other big scripts because itz better to a add a function to hide some images as u add the part 20times in a script or so
__________________
Bl4h Si6n4tur3s sUx3n
Reply With Quote
  #6  
Old 05-20-2002, 01:06 AM
TDO2000 TDO2000 is offline
Registered User
TDO2000's Avatar
Join Date: Jul 2001
Location: Germany
Posts: 655
TDO2000 is on a distinguished road
hmmm Kaimetsu said something about rekursion not working in the next version of gscript O_o
but at the moment it perfectly works ^.^
__________________
No Webhost at the moment
Reply With Quote
  #7  
Old 05-20-2002, 05:04 AM
TDO2000 TDO2000 is offline
Registered User
TDO2000's Avatar
Join Date: Jul 2001
Location: Germany
Posts: 655
TDO2000 is on a distinguished road
Quote:
Originally posted by Kaimetsu


I said that? I must have been temporarily crazy or something. Although... I suppose it might not work. Probably will. But I don't see any recursion in that script...?
if you peer and hold your head like this...
hmmm no you are right no recursion inside this script...
need to watch stuff longer...
__________________
No Webhost at the moment
Reply With Quote
  #8  
Old 05-20-2002, 11:08 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
Recursion is basic calling a fuction withing a function, if you don't have some sort of end to it, or a sleep timeout, you could be a very very sad person...
However, all that happens is Graal dies after a certain amount of runs, Kaimetsu, do you know how many?
__________________

!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 05-21-2002, 11:10 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


I have no idea. I suppose we could test it if we really cared enough.
Thats true, should have thought of that.
__________________

!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
  #10  
Old 05-23-2002, 08:20 PM
BBflat BBflat is offline
Registered User
BBflat's Avatar
Join Date: Apr 2002
Location: United States of America
Posts: 573
BBflat is on a distinguished road
Recursion...

NPC Code:

if (playerenters)
{
a();
}

function a()
{
if (playerx < 5 && playerx > 2)
{
sleep 1;
a();
}
else
{
messageLoop Terminated;
}
}

__________________
I am a .sig virus. Please put me in your .sig so I can continue to replicate.
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 09:43 AM.


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