Off Topic / beginner here interested in coding in lua

Author
Message
willcrow
4
Years of Service
User Offline
Joined: 31st Mar 2019
Location:
Posted: 9th Apr 2019 14:27
i have no coding experience really other then copy and pasting other peoples scripts and have played with the lua scripts contained in game guru which has helped me learn a little but for the most part i really have no experience in writing any code with lua or C++ period. other then going to school is there any recommendations on the best place to start in learning coding such as what books work best for beginners or websites anything really. thank you.
AMD Ryzen 5 1600 Six-Core Processor, 3200 Mhz, 6 Core(s), 12 logical Processor(s), 16gb ram, NVIDIA Geforce GTX 1050, windows 10
PM
Len the man
8
Years of Service
User Offline
Joined: 12th Jun 2015
Location:
Posted: 9th Apr 2019 21:29 Edited at: 9th Apr 2019 21:33
There are a few places you can look for help on this subject matter, such as the following:

1 Some help is listed on the Steam website for Game Guru at this link - https://steamcommunity.com/sharedfiles/filedetails/?id=398177770

2 Here is a visual scripter to help you learn how to put some scripts together - https://ank00.itch.io/codeworks
The visual scripter is also talked about at this link - https://forum.game-guru.com/thread/207960

3 Many folks here use Notepad ++ for typing up some scripts. It is free software that you can download for free on the internet.

4 It's also nice to use another free program called Lua edit. This program will help you quickly debug or find any errors in your script before you try to use it.

5 Another good place to look is at this link in this forum that talks about Lua scripting - https://forum.game-guru.com/thread/208970

6. Another good place to look is at this link to find more information on Lua scripting - https://www.tutorialspoint.com/lua/index.htm

7 I have also heard of some people purchasing books on how to write Lua scripts.

I can also tell you that it has been difficult for some of us (like me) to learn scripting, but this year I have made a few that worked well. Some of the scripts I made were (like you said) cut and pasted from a few other scripts. I'm sure there are a few others in this forum that might give some good advice also, such as, AmenMoses, and smallg. smallg has a nice section where he shares a lot of his scripts for free. It's in the "Scripts" section of the forum at this link - https://forum.game-guru.com/thread/207801?page=24

I hope this helps... I wish you all the best.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 10th Apr 2019 01:40
So that's why my ears were twitching!

First thing to say is that, like getting a perfect six pack, there is no short cut to learning how to 'code'.

Second is that in reality there is no difference between 'coding' and 'scripting', they are all the same thing.

The best way I can put it is to compare with being a good author, i.e. if you can write well it doesn't really matter which language you choose to write in.

The best programmers are those that can put themselves in the position of the computer and figure out the simplest way of converting a real world problem into a solution comprising a sequence of steps that a computer is capable of understanding and carrying out such that the end result is; a) achieved to the accuracy required, b) repeatable and c) with acceptable performance.

Lua is a very, very powerful language which scales extremely well. It can do really simple stuff easily and it can do extremely complex stuff as well, you can use it procedurally, functionally and object orientedly (is that even a word?), it is entirely up to you how you approach the solution and the language itself can accommodate any approach.

For any language the first step should always be to get hold of the official language guide, this is usually written by the same people that developed the language and is the best guide to what it can do, avoid the 'for dummies' books as they only ever scratch the surface.

The official Lua documentation is freely downloadable for the earlier versions, in fact 5.2 is the version you want to concentrate on as that is the one that GG (and almost every other engine out there) uses.

Apart from that read all my tutorials and examine my scripts, when you are ready to become a Jedi you'll find me in the temple.
Been there, done that, got all the T-Shirts!
PM
willcrow
4
Years of Service
User Offline
Joined: 31st Mar 2019
Location:
Posted: 11th Apr 2019 13:31
thank you very much just what i was needing
AMD Ryzen 5 1600 Six-Core Processor, 3200 Mhz, 6 Core(s), 12 logical Processor(s), 16gb ram, NVIDIA Geforce GTX 1050, windows 10
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 11th Apr 2019 14:14 Edited at: 11th Apr 2019 14:15
without coding knowledge start small and pick apart some basic scripts, once you get used to the flow of a language it will also make things much easier (i.e. lua uses 'end' for closing pretty much everything while other languages use other methods), coding in GG / Lua isn't a whole lot different to writing once you get used to it, it's just a case of remembering the correct commands for the job... it also depends how far you want to learn and for what reason, if you're just looking to learn the basics to make your own projects a bit more alive then you really don't need to learn much, you can do a lot with simple checks like GetPlayerDistance(e) and many 'if' statements.

biggest newbie tip i can give is always use indentation - i didn't do this when i was learning and the number of times i wasted so much time trying to figure out which part of code was broken is silly... with indentation and correct use of states you can very easily find problem areas.
i.e.


is way more confusing to read compared to



because everything that should be executed at the same time is now easily seen by just scanning down the lines that are in the same indentation as each other - and this becomes more and more true the longer / more complex your scripts become
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 11th Apr 2019 17:10 Edited at: 11th Apr 2019 17:13
It's amazing what you can do with LUA, it's a far more powerful language than people realize, although in my opinion having LUA as the coding language for GameGuru can be good and bad, on the good side it is so powerful, but on the bad side LUA has become pretty much the standard language used for add-on API's in many big ticket games and a lot of softeware, for example world of warcraft, and elder scrolls, fragmotion, and nimble writer all use it for their add-ons. A lot of the user base for gameguru are people who have played games, and modded for them, so they see it as an "add-on language" and not a full coding language, which is probably one of the reasons for many of the "it's just a level editor .... " reviews we get, they just don't know how powerful it can be. I'm pretty sure if we used C# instead we would get less of those "level editor", not that it's any better, but just because seen as more a solid coding language, a more "grown up" scripting over LUA.

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
willcrow
4
Years of Service
User Offline
Joined: 31st Mar 2019
Location:
Posted: 11th Apr 2019 18:16
if lua is so powerful why is C# seen as a more "grown up" scripting language?
AMD Ryzen 5 1600 Six-Core Processor, 3200 Mhz, 6 Core(s), 12 logical Processor(s), 16gb ram, NVIDIA Geforce GTX 1050, windows 10
PM
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 11th Apr 2019 19:52
Because it has been adopted by most of the top rated game engines for their scripting, whereas LUA is being heavily used for add-ons to games, they hear about C# all the time about creating games, but only really know about LUA as an add-on API to games and level editors.

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 16th Apr 2019 14:37
Remember that C# and C++ are two different beasts.

Both are used extensively in the creation of the engines themselves, C# is probably slightly more common in cross platform engines, and both rely on using multiple 'off-the-shelf' libraries for things like rendering, sound, physics, internet access etc, as does GG for that matter.

Writing either is in no way as simple or as powerful as using a scripting language like Lua, that is why every engine has a scripting language. As long as the engine exposes enough control to the user via the Lua interface there is virtually no limit to what can be achieved, as I think I've been demonstrating quite well over the last few years!

Been there, done that, got all the T-Shirts!
PM

Login to post a reply

Server time is: 2024-03-29 06:09:40
Your offset time is: 2024-03-29 06:09:40