View Single Post
  #86  
Old 05-01-2009, 04:51 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Raelyn View Post
See, that confuses me, so there is no need to designate functions anymore? Or, alternatively, there is no need to set up triggers? The function itself is a trigger?

So instead of writing:

PHP Code:

function ThisStuff(){
  
stuff;
}

if (
trigger){
  
ThisStuff();

I can just do:

PHP Code:
function onThisStuffTrigger(){
  
stuff;

and it would act the same?
Well, no.

PHP Code:
// This is an event that occurs when the WNPC is updated
function onCreated() {
  
this.string "foo";
}

function 
onTrigger() {
  
this.string "bar";

Since onTrigger() isn't triggered, this.string will be "foo"

However,

PHP Code:
function onCreated() {
  
this.string "foo";

  
onTrigger();
}

function 
onTrigger() {
  
this.string "bar";

Would now make this.string equal "bar" since the function is triggered.
__________________
Reply With Quote