Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding multiple scripts together?
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#6
RE: Adding multiple scripts together?

Hmm. Maybe this will clear some things up.

void OnStart () ///this is a function, every script inside the brackets runs off this function
{
SetMapDisplayNameEntry("library"); ///these are scripts
AddTimer("ChairThrow", 0.0f, "ChairThrow");
AddUseItemCallback("", "key_laboratory_1", "mansion_7", "unlock", true); ///this script calls a new function, which will start with "void" and get a new pair of brackets
}

void unlock(string &in asItem, string &in asEntity) ///many functions need syntax like this when triggered by a callback
{
SetSwingDoorLocked("mansion_7", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_7", 0, false);
RemoveItem("key_laboratory_1");
}

In the example above, every script in the first function runs as soon as you start the map. Every script in the second function runs when it is triggered. It is callbacks that prepares a trigger to execute scripts.

(This post was last modified: 06-25-2012, 07:02 PM by Damascus.)
06-25-2012, 07:00 PM
Find


Messages In This Thread
RE: Adding multiple scripts together? - by Damascus - 06-25-2012, 07:00 PM



Users browsing this thread: 1 Guest(s)