Page 1 of 1

How to insert codes?

Posted: 2010-05-14, 13:51
by pizzadude223
I have done alot of lua programming on other engines, just not this one, and I dont know where and how to insert my lines of code to make actions on here. Can someone help me?

Re: How to insert codes?

Posted: 2010-05-14, 20:41
by Carsten
What exactly do you want to achieve?

The scripting documentation is currently somewhat incomplete, unfortunately, but you can see an introductory example for GUI and map scripting at Creating Teleporter Stations.

More GUI scripting examples, including very comprehensive ones, are found in directory Games/DeathMatch/GUIs/, and GUI scripting documentation is at The Cafu GuiSys.

More map scripting examples are found in directory Games/DeathMatch/Worlds/. Map scripting is where our documentation is (currently) lacking the most...

Re: How to insert codes?

Posted: 2010-05-15, 02:49
by pizzadude223
Okay, I understand how to program it, like how do I call my lines of code after I have written them? Like if I hit in an object and it needs to do something, how do I call the code that makes it do stuff to make it do the action?

Re: How to insert codes?

Posted: 2010-05-17, 00:19
by Carsten
pizzadude223 wrote:how do I call my lines of code after I have written them? Like if I hit in an object and it needs to do something, how do I call the code that makes it do stuff to make it do the action?
The short answer is: The Cafu engine calls it automatically.

For example, when a trigger entity is named "trapdoor", and a player enters the trigger area, the engine automatically calls script method

Code: Select all

trapdoor:OnTrigger()
that you can define in the related map script file to do whatever you want it to do.
You can see an example of this in file TechDemo.lua and others mentioned above.

But you're right, the related documentation is scarce, I'll do my best and try to find the time to make some enhancements during the upcoming week!