Topic: I'd like to make a scenario without knowing lua. is that realistic?
Posted at: 2017-01-04, 18:18
I have an idea for a scenario in the dolomites map brewing in my head. It would require only few basic features:
Today I looked into it. Unfortunately, the wiki on scripting scenarios is ... less than useful
really? I look for advice on how to make a scenario and I find "go to those links and learn lua"? It's like I ask how to fix my bike and I am told to go read a book on mechanics that will teach me how to make a car or a plane. I don't have the mix of time, intention and commitment needed to learn lua. I was hoping that I could get away with figuring out a few rudiments needed only for making a scenario. After all, I don't need to learn a whole programming language. I only need a handful of triggers; if this terrain comes under control of blue player, then make a window with a message appear. After that much time passes, change all instances of a certain terrain with a certain other terrain. it looks relatively easy. of course, I am well aware that everything you don't know how to do looks easier than it really is.
And so comes the point of my question. is it realistic that I can only learn how to work those handful of triggers to make a working scenario? or I don't really have a chance of managing it unless I become at least passably competent at lua? Does it makes sense for me to try without the commitment of becoming a programmer?
If the answer is "no, you have no chance of managing to make a scenario unless you become good with lua", then this bit of information should be addded to the wiki page. As it is, it sounds dismissive to the point of rudeness, at least to me.
Also, can someone recommend me a good lua editor usable under windows? I wanted to see if I can figure something out by looking at the scripting of existing scenarios and campaigns; at the moment I just use notepad to open lua files, but notepad does mess the formatting, and it makes really difficult to figure out what was going on. I've been using it so far to read stuff like the preferred growth parameters of trees or the working time of buildings, but no more
Posted at: 2017-01-04, 19:14
I only had a brief look on the lua-section of the wiki myself. The part about "go and learn the lua-basics first" put me off a bit, too, at first. Though it's understandable that it would be quite some (unnecessary) work to write another guide for these basics. A few months ago I taught myself StarBasic to write a macro for LibreOffice, a project of similar size and complexity, I think. I'd say you don't have to worry too much. As far as I know, lua is a fairly easy language to learn. You will spend some time researching stuff in the books again and again but you don't have to get an expert to script this scenario. It's mostly about knowing how to declare and use variables and the syntax of operations, checks, loops and functions, I guess. The by far most tricky part would be the season changing, especially if you want to replace walkable with impassable terrain.
Putting a link to a specific lua-tutorial suitable for scenarios in the wiki would be quite helpful though.
Posted at: 2017-01-04, 20:01
Programming has always two parts:
From my point of view the second point is the most difficult task. But especially related to this point you could always ask here in the Forum for help
The existing campaigns and scenarios are a good point to start with. E.g. the atlantean campaign has code to change terrain. You could copy the code and adjust it to your needs.
As Editor i use komodo-edit. I use it mostly for programming python, but it has the same features for programming Lua i think:
But i think each person has his own favorite editor
Posted at: 2017-01-05, 17:35
My favourite editor is Geany - it's available for MacOS, Windows and Linux.
Your best bet to get going is to copy an existing scenario and stealing code from scenarios as you go along, then using our API documentation to look for any other functions that you need. I do a lot of "frankencoding" myself
You should be familiar with some basic programming concepts (variables, conditional statement: if... else, loops, arrays/tables, and functions).
Make sure to declare all your variables as local.
If you get stuck, create a branch so that we can look at the code and ask for help.
Also, if you need a function that isn't available in our API, ask and we'll look into creating one.
The scripting reference definitely needs more info - it's an ongoing project. I'm still busy documenting the tribes and worlds ATM.
Edited: 2017-01-05, 17:36
Busy indexing nil valuesTop Quote