Please try again to help me with LUA

A post about how I need to be helped

Information and discussion for custom maps and mods.
Post Reply
Alley
Posts: 31
Joined: Sat Sep 19, 2015 3:03 pm

Please try again to help me with LUA

Post by Alley »

Hello! :)

So I think that I have tryied to move on with LUA after a lot of time ago. Before that I gave up because I worked for money and because of I need some success in my activity regularly also I cancelled with Openra. Just didn't know if I am going to make some or I only will spend time for sitting on front of LUA reaching nowhere. :P

I am not sure if I know now something about LUA theoretically and considering the books but I think I know now a first simple thing about LUA practically and functionally that is an imagination of how things works. And I created also the first simple tutorial rather not for you guys but for me and for you guys to leave an imagination of how I really need to be guided in all other things that I still can't do.

Even I can't believe but I really have that much hard times with LUA API for Openra and I know that the most of other things have much understable guides for those to learn. I also found that people here was nice and tried to give me some more detailed ways how to send me understanding LUA first. Just I cannot imagine how LUA is merged with Openra and I don't understand how LUA can do applications and such without being merged with something.
I must undestand the structure of LUA. Lot's of other languages are understandable because those include understandable keywords like simple "draw", "destroy" etc. but LUA, well, it include like just some elements as "function", "=" and even "if" keywords but I cannot make with those the whole world.

So if someone bothers not only for me but also for others then I need a lessons simple as mine. For example short mission only with units that will attack the player. One function. The list of function on already existing guide with parameters are like but what I should write to " int closeEnough = 0" field. I am truly able to merge those simple knowledges for creating a whole thing by myself. Every test will cause not just a glitch but a fatal error and I think like what, this LUA is like what. :O

I am also not that exact in other things than LUA because I am able to figure out writing a file named map.yaml. LUA however, is here first really simple challenge and if someone would make it that understandable about how to give an attack action to a unit then I would be a lot of smarter enough to learn more. :D

Place extracted content to: C:\Users\<Username of your PC>\Documents\OpenRA\maps\ra\<Your Openra release>\
Open LUA file to see what can help me. :P

Please understand me! :D
Attachments
Custom Function.rar
(14.5 KiB) Downloaded 341 times

abcdefg30
Posts: 643
Joined: Mon Aug 18, 2014 6:00 pm

Re: Please try again to help me with LUA

Post by abcdefg30 »

First of all, sorry for the late response! (I've been quite busy recently.)

So, to your questions:
Alley wrote: I am not sure if I know now something about LUA theoretically and considering the books but I think I know now a first simple thing about LUA practically and functionally that is an imagination of how things works. And I created also the first simple tutorial rather not for you guys but for me and for you guys to leave an imagination of how I really need to be guided in all other things that I still can't do.
[...]
I must undestand the structure of LUA. Lot's of other languages are understandable because those include understandable keywords like simple "draw", "destroy" etc. but LUA, well, it include like just some elements as "function", "=" and even "if" keywords but I cannot make with those the whole world.
You can have a look at http://www.lua.org/pil/contents.html#P1 (and/or http://lua-users.org/wiki/TutorialDirectory ) or search on e.g. youtube for a guide. It's quite easy actually.
Alley wrote: Just I cannot imagine how LUA is merged with Openra and I don't understand how LUA can do applications and such without being merged with something.
I would also strongly suggest you look at some of the scripts of our shipped missions, you can easily view them at: https://github.com/OpenRA/OpenRA/search?l=lua (Just ignore the first 3 entries, they are "system scripts".) We also have a wiki page for it: https://github.com/OpenRA/OpenRA/wiki/Map-scripting
Alley wrote: The list of function on already existing guide with parameters are like but what I should write to " int closeEnough = 0" field.
The "= 0" just stands for the default value. If you leave that parameter empty it will default to the value of "0".
But: you can't leave parameters in the middle out. E.g. for "DisplayMessage(string text, string prefix = Mission, HSLColor color = nil)" you can't do "Media.DisplayMessage("my text", HSLColor.Black)" but then would have to do "Media.DisplayMessage("my text", "Mission", HSLColor.Black)".
Alley wrote: So if someone bothers not only for me but also for others then I need a lessons simple as mine. For example short mission only with units that will attack the player. One function.
Edited your script a bit (with comments) and reuploaded the map.

Hope I could help you. :)
Attachments
Custom Function.zip
I changed map.yaml and training.lua
(15.32 KiB) Downloaded 270 times

zypres
Posts: 42
Joined: Mon Oct 17, 2011 12:50 am
Location: Bergen

nice

Post by zypres »

This is interesting for more players than him.
Thank you for helping him and others.
We should have more lua-tutorial maps, and some guides.

Other wishes:
  1. One big map with caves and modders just edit settings to change what spawn and when
  2. waves(ants,dinos,etc) maps with the same, so we can change what comes.
  3. Someone should take the best part out of http://resource.openra.net/maps/14969/ (gabezs chrono gates..) I tried to make a dumb version, but its too hard for me
  4. A way to make users work together on lua and mapmaking.
  5. A contest for best lua-tutorials.. Or just a bounties

Alley
Posts: 31
Joined: Sat Sep 19, 2015 3:03 pm

Post by Alley »

Answer for abcdefg30:

Yeah! I was quiting again and took another project for now because I wasn't expecting an answer. Yesterday however, I thought that I check here once more because however, quite much time have been passed and you never know. But I have no problems with your late answer. Instead of it, I am happy and thank you! I understand, I am also in this. Time is often limited but I didn't think that I get something that I ask because some things that I may ask may be very different from others and often even not noticed. :)

I wasn't that long with LUA contents in few hours because I didn't think I would do with those in Openra API thing something but I focused much in your edited script and I really understood what have done there. I saw also that it is quite understandable how several parts of the script have been merged. So it's seems that because of LUA looks different from another simple scripts like GML for example I just couldn't find relations for only one function from the whole script when there are several ones mixed together. That was very helpful. With script and comments I understood more than 50% written in your answer for me and I am sure that if I am still not able to write a thing without help then at least with help with LUA table with contents I am now able to create my own reinforcements with my units, movement etc.

When I try to make a function by myself again then I try to use your edited script as a lead for another script. :)

Answer for zypres:

So I am really not the only one. :) Yeah, what you suggested for is about what I meant. It depends on community and often people may not notice and/or accept me in letter but I knew that a simple script that I made and edited one which came with an answer is exactly a way that should help the biggest beginners at least. :) And I know something same simple is available for lot's other applications and scripts but in some kind of reason not for Openra although scripting in LUA at least for me needs a simple guide much more because of it's difficulty. Thank you too for confirming this. :)

---

Please do not close this topic however! I got that I needed and I am sure it is the basics to move on but you never know where we can be blocked and what else we may learn faster and simpler with a simple answer. :)

Alley
Posts: 31
Joined: Sat Sep 19, 2015 3:03 pm

Post by Alley »

No... The script with reinforcements looks very clear to me and I really understand where are the relations but if I make script about another script with "bool Build(String[] actorTypes, LuaFunction actionFunc = nil)" along the lines of reinforcements then again... No farther than level 1 I still cannot get which is just fatal error that even tells me nothing. :/

Really! Next to LUA there are no script types tried by me in the world that I cannot figure out along the lines of another made script and that I cannot make even with editing complete one. :O There seems to be too much things that I do not notice or consider.

Post Reply