Right now, my life has been crazy hectic, so I honestly don't know. I originally took time away from the Lua in order to finish my mod but I haven't even had time to do that. Now I'm preparing to re-enter school, so that's really been taking up all my time. The thread is open-ended though, so that anyone who wants to can throw in their own two cents, advice, tips, or lesson.Neikun wrote:When's the next lesson, Spider?
[Learning LUA] Lesson 3: Values and Operators is up!
- SpiderFighter
- Posts: 789
- Joined: Thu Apr 12, 2012 4:15 pm
Re: [Learning LUA] Lesson 3: Values and Operators is up!
- Halluinoid
- Posts: 165
- Joined: Tue Apr 02, 2013 7:08 pm
- Contact:
Re: [Learning LUA] Lesson 3: Values and Operators is up!
what IS your MOD SpiderFighter? is there a thread on it?
this is a great thread, it's very tempting to just use the Dungeon Editor without Lua at all
which is what I have done so far!
but with a thread like this - maybe some simple Lua scripting can begin

this is a great thread, it's very tempting to just use the Dungeon Editor without Lua at all

but with a thread like this - maybe some simple Lua scripting can begin

Beleagured Castle LOGII complete
- SpiderFighter
- Posts: 789
- Joined: Thu Apr 12, 2012 4:15 pm
Re: [Learning LUA] Lesson 3: Values and Operators is up!
My mod is at viewtopic.php?f=14&t=3638Halluinoid wrote:what IS your MOD SpiderFighter? is there a thread on it?![]()
this is a great thread, it's very tempting to just use the Dungeon Editor without Lua at allwhich is what I have done so far!
but with a thread like this - maybe some simple Lua scripting can begin
I had to re-do the first couple of levels, as they were pretty dull to play. Now, the mapping and item/mob placement is 95% finished; at this point, all I really have left to do is finish the dialogue and boss fights; I just haven't been able to work on it the last few months. Although I'm sure no one is going to going to care when it finally gets released! lol
Re: [Learning LUA] Lesson 3: Values and Operators is up!
I don't know if somebody knows, there is a gloabl variable _G that contains everything, I can't use in in Grimrock, did anyone know a way to get all globals elements (would be usefull to know the potential of Grimrock) ?
Thanks in advance.
Also, I've been using lua a little for another game, and for Grimrock I quickly recreated the 3 signs riddle we can encouter in Skyrim, but I don't know how to use corectly timers ?
Thanks in advance.
Also, I've been using lua a little for another game, and for Grimrock I quickly recreated the 3 signs riddle we can encouter in Skyrim, but I don't know how to use corectly timers ?
Re: [Learning LUA] Lesson 3: Values and Operators is up!
You cannot access the _G, as each script entity only has a local scope.Thau wrote:I don't know if somebody knows, there is a gloabl variable _G that contains everything, I can't use in in Grimrock, did anyone know a way to get all globals elements (would be usefull to know the potential of Grimrock) ?
Thanks in advance.
Also, I've been using lua a little for another game, and for Grimrock I quickly recreated the 3 signs riddle we can encouter in Skyrim, but I don't know how to use corectly timers ?
Documentation for the timers is in the modding section, but if you're good with lua you might bypass it. The most accurate technique most advanced mods here use is to use the party onDrawGui hook as an update function, use getStatistic("play_time") to establish a deltaTime, then program delays & coroutines within lua.
Re: [Learning LUA] Lesson 3: Values and Operators is up!
Now I was a very old school Cobol programmer in the '80 for a very short time. I learned some machine code, jsp and had already taught myself basic on the zx spectrum. I learned binary and hexadecimal systems. I used that knowledge for editing game memories. Nowadays I mostly use my skills in excel like making a calendar.
What most programmers forget or are too lazy is to make program structure diagrams or schedules (one with symbols the other takes the whole A4 width). You write your ideas like that and think about any possible direction the flow might go. Then you test your variables and see if the result in every flow is what you want it to be.
Now you start programming and you follow your paper. You define all your variables and initial values and in the end you set them to zero again. With special editors you for next loops. etc. get a tab automatically and it makes it easier to read. Some might even detect when you forget a space, point or a comma. Then you clean it up and test it. If it works you go to the next part...
What most programmers forget or are too lazy is to make program structure diagrams or schedules (one with symbols the other takes the whole A4 width). You write your ideas like that and think about any possible direction the flow might go. Then you test your variables and see if the result in every flow is what you want it to be.
Now you start programming and you follow your paper. You define all your variables and initial values and in the end you set them to zero again. With special editors you for next loops. etc. get a tab automatically and it makes it easier to read. Some might even detect when you forget a space, point or a comma. Then you clean it up and test it. If it works you go to the next part...
-
- Posts: 1
- Joined: Wed Dec 04, 2013 3:25 am
Re: [Learning LUA] Lesson 3: Values and Operators is up!
Hello
This is my first post on the site.
And similarly My first minute trying anything in lua!
i just was hoping i could get a bit of help on a failed attempt at writing something very basic.
Please be gentle
Here it is:
funcion snaildrop ()
spawn ("snail" 1, 15, 11, 2)
end
the error message '=' expected near snaildrop appears.
This is my first post on the site.
And similarly My first minute trying anything in lua!
i just was hoping i could get a bit of help on a failed attempt at writing something very basic.
Please be gentle
Here it is:
funcion snaildrop ()
spawn ("snail" 1, 15, 11, 2)
end
the error message '=' expected near snaildrop appears.
Last edited by Angrynoodle1 on Wed Dec 04, 2013 3:52 am, edited 1 time in total.
Re: [Learning LUA] Lesson 3: Values and Operators is up!
Code: Select all
function snaildrop()
spawn("snail", 1, 15, 11, 2)
end
Finished Dungeons - complete mods to play
Re: [Learning LUA] Lesson 3: Values and Operators is up!
You wrote funcion not function 

Re: [Learning LUA] Lesson 3: Values and Operators is up!
Where have you been all my life?!Diarmuid wrote:Hi all,
A scripting help session with drakkan today on the LoTNR chat gave me an idea to contribute to this thread with a general programming principle, which is called
DRY - Don't Repeat Yourself

Anyway, thankyousomuch!





Words can't describe how useful this post is for me as a total noob and layperson to coding! :tearsofjoy:
Also this whole topic is a gold mine so thanks in advance for every other contributor as well and of course to SpiderFighter!