What are you working on?

Welcome back!!! Let us know if you need help with anything.
Thanks @JPetroski ! I see that in ToT the Cheat menu is much simpler than in MGE, and most 16bit tweaking apps don't work anymore on modern 64bit OS. Is there any external tool other than Civitas by TheNamelessOne to assist scenario designers to bulk edit stuff? Thanks! Just trying some stuff... :crazyeye:
 
I think Civitas is about it with the exception that a few scripts have been written to help you compile things like an object list for lua (basically a file that most of your other lua work would draw from -- the object file takes data from the rules file).

If you were used to using the cheat/scenario editor to build from MGE it'll be a bit of a learning curve but honestly when you go and start editing the files directly it's much easier as you can copy/paste, move stuff to a spare notepad etc. Point in fact I just had to edit 12 rules files this morning and that would have been unbearably long in the editor of old :)

If I've *completely* misread your question please let me know!
 
Thanks, that was it! Just reading a lot of Lua documentation at the moment to be able to explore its possibilities. I work as a software developer but never worked with this language, however it looks really straightforward. As long as I can declare global variables and use random values in the code, I'll be able to achieve many things I have in mind :) I'll keep you updated.
 
I'm working on...catching up after so many years absent from the Civ2 world! Delighted to find out about ToTPP and Lua, this brings the scenario making possibilities to levels never imagined before! Hi all, lots of familiar names still around :grouphug:

Howdy...!
Great to see another old hand around here. :D
 
Howdy...!
Great to see another old hand around here. :D

Hah, definitely old! I joined this forum as a teenager, and now I'm getting close to my 40's...glad to see you around mate!
 
As long as I can declare global variables and use random values in the code, I'll be able to achieve many things I have in mind :) I'll keep you updated.

If you happen to use my Lua Scenario Template, you'll find that standard global variables are disabled by default as almost the first thing I do, but I do make a global variable called _global, which is a table you can store your global variables in. The reason for this is the way that Lua handles global variables.

All variables in Lua are global, unless you use 'local' to define them. In Lua, "tables" let you register key-value pairs, and are used for storing lots of information, and for creating data types with more than one value in them. Tables also return the "nil" value for all keys that are not in the table. This is relevant, because global variables are stored in a special "global" table, and it turns out that makes debugging more complicated.

Consider this code
Code:
local myBool = true
if mybool then
    print("myBool is true")
end

You probably want this code to generate an error, since you have a typo in the if statement. Instead Lua looks at mybool, sees that it is not a local variable, then looks in the global table. The string "mybool" is not a key in the global table, so that table returns nil, and hence mybool is evaluated as nil, which happens to be falsy, so the print statement is skipped. You now have to try to figure out why your program isn't working. You can get really weird and inconsistent bugs easily. Here's an example (the error is reported here, and the fix/explanation the post after that). If you define a local variable outside of a function, it can be used and changed by any function in the file.

If I need to link files in both directions (one direction is accomplished with the require command), I typically write a "linking" function, usually to link the 'state table' (The 'state table' is the table that is converted to a string and attached to the end of a saved game, so we can save arbitrary information. TNO gave it the name state in an example, and the name stuck.)

Code:
local flagState = "flagState not linked"
local function linkState(tableInStateTable)
    if type(tableInStateTable) == "table" then
        flagState = tableInStateTable
    else
        error("linkState: linkState takes a table as an argument.")
    end
end
flag = {}
flag.linkState = linkState
return flag
 
Thanks for the detailed explanation @Prof. Garfield !

I do make a global variable called _global, which is a table you can store your global variables in.

Yeah that's a clean way to have all global variables stored in key-value pairs. I'm really liking how this Lua works. Once I start messing around with the code, if I get stuck I'll reach you.
 
First, I want to briefly introduce myself. It's been thirty years since I first played my first Civ game together with my
older cousin. After being an avid Civ2 player for a long time, I then switched to Civ IV for more than a decade.
But all the great mods (PAE, RI, AND, etc.) had one crucial problem, they failed due to the memory limitation of the
32-bit architecture of Civ IV itself. At some point, the game will inevitably crash, no matter how powerful your
computer is. Frustrated by this, and immensely disappointed with V & VI, I decided to give up Civ altogether.

But then, years later during the first lockdown, I remembered Civ2 and discovered TOTPP.
In two months I built an extensive scenario centered around the world of the popular german role-playing game
The Dark Eye. Due to my limited knowledge of basic game mechanics and the decision not to use LUA, the project
unfortunately ended up being a single excessive unit spam. Disillusioned, I put the whole project on file and limited
myself to playing scenarios for the time being.

Now I want to give it a second try. This time I want to deal with the basics first and in any case also include LUA
in the considerations before I start implementing the scenario. The scenario is intended to outline the great migration
of peoples in Europe (A.D. 395 - 568). I'm still at a very early stage and mainly concerned with understanding and
integrating game mechanics. In this context, I will soon deal with LUA. In any case, it will take a while until I can
present something halfway mature.

I apologize in advance for the barrage of questions, particularly regarding the behavior of barbs and the AI.
If I sometimes sound a little harsh, that's because of my mediocre english skills. Please don't take this personally.

Best regards

C.
 
Welcome! We are here and happy to help! It might not be a bad idea to start a development thread when you're ready, so that we can all help out.
 
Welcome @400AD !

I foresee we are in a new Golden Age of Civ2 scenario making (who could tell 20 years ago?) thanks to the wonders of ToTPP & Lua, combined with the 15-bit colour graphics and the talent of the artists/designers who are still around drawing!!
 
Thanks for the warm welcome! For a few quick successes, I have already tested my first LUA events.
It's great what's already available. If I understand correctly, it is now also possible to locate units on the map. This is really great progress!
 
Top Bottom