New to Cafu
Hello, I'm new to this game engine and have a few questions.
First, I've read that Cafu uses both Lua and C++. Which is used for which instance?
Second, when I bring up the properties window (ALT + ENTER) I notice a tab that says "map script", but the entire page is just blank. You cannot click to add anything in to it. Is there something I'm supposed to do to attach my scripts (which I've read is done in Lua) for the map and/or gui of the level I'm building?
I'm assuming I need to. The tutorial for the teleporter uses a gui script to make the teleporters work, but when I load the level, and walk over to one, I can see the pointer on the screen, but I cannot click anything (and nothing happens).
If any of this is in the intro/FAQ section, I missed it.
Can anyone help me with this?
Thank you so much!
First, I've read that Cafu uses both Lua and C++. Which is used for which instance?
Second, when I bring up the properties window (ALT + ENTER) I notice a tab that says "map script", but the entire page is just blank. You cannot click to add anything in to it. Is there something I'm supposed to do to attach my scripts (which I've read is done in Lua) for the map and/or gui of the level I'm building?
I'm assuming I need to. The tutorial for the teleporter uses a gui script to make the teleporters work, but when I load the level, and walk over to one, I can see the pointer on the screen, but I cannot click anything (and nothing happens).
If any of this is in the intro/FAQ section, I missed it.
Can anyone help me with this?
Thank you so much!
Re: New to Cafu
Hi Tym,
welcome to the Cafu forums!
For more information about scripting, please see http://api.cafu.de/scripting/
Right now, map scripts are written with a normal programmers text editor, and placed next to the map they're for.
This (instead of the left mouse button) is one of the awkward quirks that we really need to iron out asap...
welcome to the Cafu forums!
C++ is used for most of the application code, Lua is used for map and GUI scripts.Tym wrote:First, I've read that Cafu uses both Lua and C++. Which is used for which instance?
For more information about scripting, please see http://api.cafu.de/scripting/
You're doing everything right, this tab is not yet implemented.Second, when I bring up the properties window (ALT + ENTER) I notice a tab that says "map script", but the entire page is just blank. You cannot click to add anything in to it. Is there something I'm supposed to do to attach my scripts (which I've read is done in Lua) for the map and/or gui of the level I'm building?
Right now, map scripts are written with a normal programmers text editor, and placed next to the map they're for.
Did you use the "0" (zero) key for clicking?The tutorial for the teleporter uses a gui script to make the teleporters work, but when I load the level, and walk over to one, I can see the pointer on the screen, but I cannot click anything (and nothing happens).
This (instead of the left mouse button) is one of the awkward quirks that we really need to iron out asap...
Best regards,
Carsten
Carsten
Re: New to Cafu
First off,
Thank you for the warm welcome and fast reply!
That clarification helps me understand this engine more, so thanks!
As of right now, what are the steps needed to take to implement map/gui scripts with a .cmap file? I'm going to begin designing levels for a game in the next month or so, so I'm trying to learn as much as I can about Cafu in the meantime.
Thanks again!
Thank you for the warm welcome and fast reply!
That clarification helps me understand this engine more, so thanks!
As of right now, what are the steps needed to take to implement map/gui scripts with a .cmap file? I'm going to begin designing levels for a game in the next month or so, so I'm trying to learn as much as I can about Cafu in the meantime.
Thanks again!
Re: New to Cafu
Generally, the documentation at http://www.cafu.de/wiki/ is a good start to mapping. For example, it has sections about compiling maps (turningTym wrote:As of right now, what are the steps needed to take to implement map/gui scripts with a .cmap file? I'm going to begin designing levels for a game in the next month or so, so I'm trying to learn as much as I can about Cafu in the meantime.
.cmap
files into .cw
files that the game engine actually reads), and a lot more.Specifically to scripting, your question is a good one, because we have no "definitive" answer or self-contained tutorial or other "complete, all-in-one" documentation right now.
Good starting points are
- the documentation mentioned above,
- the scripting documentation and the pages that it links to,
- the example GUI and map scripts that come with Cafu.
In fact, I'd be happy to hear about any problems that you might encounter, because, for example, a new big problem like teleportation might not be solvable with the code as-is, and new functionality might be required that we might add as needed.
Best regards,
Carsten
Carsten
Re: New to Cafu
I read through all of that, but I am wondering what needs to be done to make sure a specific lua script (for map and/or gui) gets implemented in with the map when caWE compiles. Is there a specific folder the scripts should be placed in for the compiler? Should I be using a specific naming convention so it knows to compile with a certain map file?
Thanks
Thanks
Re: New to Cafu
Oh, good questions, sorry that I didn't mention this earlier or anywhere else:Tym wrote:I read through all of that, but I am wondering what needs to be done to make sure a specific lua script (for map and/or gui) gets implemented in with the map when caWE compiles. Is there a specific folder the scripts should be placed in for the compiler? Should I be using a specific naming convention so it knows to compile with a certain map file?
- The Lua script must be placed into the
Worlds/
directory next to the compiled world file. - The script must have the same base name, but suffix
.lua
instead of.cw
. - Good news is that the script is not compiled with the
.cw
file: You can change it at any time, and the changes become effective as soon as the map is loaded/restarted the next time. (In fact, you can reload the script "live", in the running map, without quitting. This can be a very useful feature, but you should understand how it can affect the maps global script state before you use it. Please let me know if you're interested.)
Best regards,
Carsten
Carsten
Re: New to Cafu
Thanks, and I am interested in fully understanding how it can affect the global script state. I definitely see myself editing the script "live" to figure out various values I'll want to use for certain features down the road.
Re: New to Cafu
Hi Tym,
I now added the answer to your previous question about map script details also to the related documentation,
About the global state, it's really just a matter of how
I now added the answer to your previous question about map script details also to the related documentation,
and added the answer to this as a new Developer FAQ: How do I dynamically reload the map script in-game?Tym wrote:Thanks, and I am interested in fully understanding how it can affect the global script state. I definitely see myself editing the script "live" to figure out various values I'll want to use for certain features down the road.
About the global state, it's really just a matter of how
dofile()
works: It does nothing special but "append" the reloaded map script to the existing map script state.Best regards,
Carsten
Carsten
Re: New to Cafu
Thanks!
One more question: Do you know of any IDE that I can run that allows some sort of error/bug check for the source C++ code? I want to begin tweaking it, but am afraid that if I try to do too much (or my programmer adds a lot of extra code) there is no way to check through the 1k+ lines of code for the errors.
Thanks
One more question: Do you know of any IDE that I can run that allows some sort of error/bug check for the source C++ code? I want to begin tweaking it, but am afraid that if I try to do too much (or my programmer adds a lot of extra code) there is no way to check through the 1k+ lines of code for the errors.
Thanks
Re: New to Cafu
I've just added this page to the documentation:Tym wrote:Do you know of any IDE that I can run that allows some sort of error/bug check for the source C++ code? I want to begin tweaking it, but am afraid that if I try to do too much (or my programmer adds a lot of extra code) there is no way to check through the 1k+ lines of code for the errors.
IDEs and Text Editors
Does that answer your question?
Best regards,
Carsten
Carsten
Who is online
Users browsing this forum: No registered users and 15 guests