View Single Post
  #87  
Old 05-01-2009, 05:37 PM
Raelyn Raelyn is offline
the Professional.
Raelyn's Avatar
Join Date: Sep 2003
Location: Zormite
Posts: 964
Raelyn will become famous soon enough
Quote:
Originally Posted by Chompy View Post
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.
So I write functions like normal basically in GS1, but to call a trigger, I have to make a function... also?

So, creating the function onCreated() basically itself is a trigger, so you have to use that trigger to initialize all other triggers?
__________________
*Don't let the door hit you on the way out.*
Reply With Quote