• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Basic Walkthrough Request

Evalis

Prince
Joined
Mar 2, 2009
Messages
505
So I've been stumped for a while now (and thoroughly frustrated) at trying to get lua to work. I think I'm missing some extremely basic function, so I'm hoping you guys can fill me in.

What I have so far is:

Write code using Lua (yeah complicated I know, an example would be super but not neccessary)
Include the lua Filename in the 'Ingame.xml'
Update the actions for onmodactivate with ingame.xml
Update the content with the type (what type?) and filename.

Obviously I'm not looking for a clock example, which seems to be already recognized by the game. It's hard to tell if my code is correct because there seems to be some step i'm missing here. If not back to the drawing board I guess.
 
Hard to know where to point you because it is not clear exactly what you are trying to do. That said, I found the following things helpful for begining to understand it all....

The LUA manual

http://www.lua.org/manual/5.1/

The CiV 5 LUA reference on the 2K wiki. There is not much detail really..... just the lua game file names. But the best of way learning any programming or scripting language is to look at what others have done. So you can search for files that might be related to what you are trying to do in the CIV5 sub folders. The lua files are kind of scattered around but they are there.

http://wiki.2kgames.com/civ5/index.php/Lua_Reference

I also found it helpful to download and install a mod someone else did. I want to do some things with changing things in a plot so I download CsebMod - Extended Plot MouseOver Popup. This exercise helped me to understand the structure of a mod, not to mention quite a bit of lua code that is relevant to what I am trying to do.

Good luck!
 
I couldn't get separate LUA files to work either, so I ended up pasting my changes at the bottom of InGame.lua
 
Looking at what others have done is difficult because the project file doesn't come in the same format when downloaded. While learning the language is definately a top priority, I still need to figure out how modbuddy communicates with lua before I can go about doing anything =x
 
I couldn't get separate LUA files to work either, so I ended up pasting my changes at the bottom of InGame.lua

This seems the way to go about it.

Here is my test addition to the InGame.lua file.
Code:
function testTurnStart()
	print( "START Turn test." );
end
function testTurnEnd()
	print( "END Turn test." );
end

Events.ActivePlayerTurnStart.Add( testTurnStart );
Events.ActivePlayerTurnEnd.Add( testTurnEnd );
The print statements show up each turn in FireTuner's lua console, assuming you've enabled both FireTuner and logging in your config.ini. No need to put anything in the actions or content. It sees the file in the modinfo, recognizes the name, and apparently replaces the base file.

Hope this helps.
 
...error...
 
Back
Top Bottom