Scripts / Lua tip for beginners

Author
Message
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 30th Jul 2015 08:16 Edited at: 18th Sep 2015 17:13
Hi, for any one not familiar with LUA scripting that want to learn, you may or may not be aware that there is a LUA editor/examples on the LUA website
i.e. http://luabinaries.sourceforge.net/download.html

The editor allows to run the examples or your own code interactively, best way to learn as well as off of other experienced users.
Professional Programmer: Languages- SAS, C++, SQL, PL-SQL, JavaScript, HTML, Darkbasic Pro, Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; LG TFT monitor (widescreen).
Interests: Drumming, Saxophone, Art, Theatre, Music.

Attachments

Login to view attachments
SoUlFaThEr
9
Years of Service
User Offline
Joined: 20th Jul 2015
Location:
Posted: 1st Aug 2015 12:52
Is this program completely compatible with the lua used for this game engine? It also says it is meant for advanced users and programmers.

Basically, what version of lua is GG using would be good to know because they offer many versions.

Thanks for posting this.
The only stupid questions are those that were never asked.
PM
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 2nd Aug 2015 16:43
Latest LUA version used in GG is 5.2.
I guess I should have been more clear, my apologies. If you want to learn the basics of LUA you can find and run the LUA script called quickluatour.lua

C:\Program Files\Lua\5.1\examples\quickluatour.lua
just double click on it to run

Just press enter for the next example.



Professional Programmer: Languages- SAS, C++, SQL, PL-SQL, JavaScript, HTML, Darkbasic Pro, Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; LG TFT monitor (widescreen).

Attachments

Login to view attachments
SoUlFaThEr
9
Years of Service
User Offline
Joined: 20th Jul 2015
Location:
Posted: 2nd Aug 2015 18:37
Thanks for clarifying.

even in your screen it says print.....in GG its prompt print is probably the command for a CLI
The only stupid questions are those that were never asked.
PM
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 2nd Aug 2015 21:38
Prompt is a GG LUA function

function Prompt(str)
SendMessageS("prompt",str);
end

Print is a LUA command

Professional Programmer: Languages- SAS, C++, SQL, PL-SQL, JavaScript, HTML, Darkbasic Pro, Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; LG TFT monitor (widescreen).
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 3rd Aug 2015 08:04
I really recommend any scripter to use the following script commands, they will be extremely useful--

Include ("xxx")

Use within the init function to ensure the script called (xxx) is pre loaded

SwitchScript(e,str)

Switch the entities script to script named (str)
Professional Programmer: Languages- SAS, C++, SQL, PL-SQL, JavaScript, HTML, Darkbasic Pro, Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; LG TFT monitor (widescreen).

Login to post a reply

Server time is: 2024-12-21 18:55:51
Your offset time is: 2024-12-21 18:55:51