Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Functions (https://forums.graalonline.com/forums/showthread.php?t=14555)

nyghtGT 10-13-2001 11:57 PM

Functions
 
ok ... i was wondering the exact way to test for functions and to apply functions ... can someone help me ....

KJS 10-14-2001 12:39 AM

Re: Functions
 
Quote:

Originally posted by nyghtGT
ok ... i was wondering the exact way to test for functions and to apply functions ... can someone help me ....
what do you mean by test for functions?

you make functions like this
NPC Code:

if(created)
dostuff();
function dostuff(){
//coding
}


nyghtGT 10-14-2001 02:31 AM

k
 
i understood how to do fuctions but what i was unsure of was how to test using 'if' and i found out now ....
NPC Code:

if (actionMining) {
//commands
}


btedji 10-14-2001 08:13 AM

Re: k
 
Quote:

Originally posted by nyghtGT
i understood how to do fuctions but what i was unsure of was how to test using 'if' and i found out now ....
NPC Code:

if (actionMining) {
//commands
}


you didnt know how to use if?? j/k :D that looks like it would be used with triggeraction, a flag that starts with action is usually cause by triggeraction from another npc

Xaviar 10-14-2001 08:26 AM

Re: Re: k
 
Quote:

Originally posted by btedji


you didnt know how to use if?? j/k :D that looks like it would be used with triggeraction, a flag that starts with action is usually cause by triggeraction from another npc

Or you could be weird and start all your flags with 'action'...Just for the fun of it, you understand.

dragoonvenganc 10-14-2001 10:52 AM

while on functions.. i am not sure.. on Q basic a funcition does its action and returns a value but on graal useing a function is just like putting the whole function script there.. so it does it all right.. do you guys understand what i am saying..

nyghtGT 10-14-2001 11:10 AM

Re: Re: k
 
Quote:

Originally posted by btedji


you didnt know how to use if?? j/k :D that looks like it would be used with triggeraction, a flag that starts with action is usually cause by triggeraction from another npc

no i just didn't know how to test for a function thats all ...
but what i was oing was just asking how when i do:
NPC Code:

if (playerenters) {
mining()
}


how I would would use 'if' to check if it was occuring ....

btedji 10-15-2001 12:30 AM

Re: Re: Re: k
 
Quote:

Originally posted by nyghtGT

how I would would use 'if' to check if it was occuring ....

i dont think thats even possible, just dont make the function occur until you want it to

Xaviar 10-15-2001 03:53 AM

Re: Re: Re: Re: k
 
Quote:

Originally posted by btedji


i dont think thats even possible, just dont make the function occur until you want it to

I'll have to agree with you on that...

Nyght, heres an example:

if you use oh, say this:
if (playertouchsme) {
talk();
}

function talk() {
message Hello.;
sleep 3;
message ;
}

its the exact same thing as using this, the only difference is readability, and some performance issues:

if (playertouchsme) {
message Hello.;
sleep 3;
message ;
}


Got it?


All times are GMT +2. The time now is 07:26 AM.

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