How to insert codes?

Get technical support about the C++ source code and about Lua scripts for maps, entities, GUIs, the console, materials, etc. Also covered are the Cafu libraries and APIs, as well as compiling, linking, and the build system.
Post Reply
pizzadude223
Posts:7
Joined:2010-05-12, 04:01
How to insert codes?

Post by pizzadude223 » 2010-05-14, 13:51

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?
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: How to insert codes?

Post by Carsten » 2010-05-14, 20:41

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...
Best regards,
Carsten
pizzadude223
Posts:7
Joined:2010-05-12, 04:01

Re: How to insert codes?

Post by pizzadude223 » 2010-05-15, 02:49

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?
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: How to insert codes?

Post by Carsten » 2010-05-17, 00:19

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!
Best regards,
Carsten
Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests