News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Just Discovered Lua Scripting, WOW!  (Read 2813 times)

RyanfaeScotland

  • Sr. Member
  • ****
  • Posts: 366
    • View Profile
    • My Brill Game Site
Just Discovered Lua Scripting, WOW!
« on: September 25, 2016, 04:17:27 pm »
I can't believe you guys have been holding out on me for so long!

I read about Lua scripting a while back when considering doing some work on Monkey Island but never really looked into it. That was about 10 years ago and then last night I happened to notice Gens has Lua scripting capabilities and now I can't stop coding!

Here's what my Toejam and Earl screen looks like just now:



This is going to make figuring things out so much faster and more fun! I've done a handful of serious things (loops for all present locations, enemy locations and so on, display for the count down timer for presents) and some fun things (Press X to warp to the elevator).

Still don't quite think like a scripter though because I realised after 20 iterations of 'increase value in save state by 1 in hex editor, reload, note different, repeat) that I could just script an increment function to a key and edit the memory directly!

So, I'm sorry, this is a bit of a none descript topic, just wanted to say Lua scripting is awesome. Wouldn't mind hearing about some of your favourite scripts, functions or uses if anyone wants to share?

FAST6191

  • Hero Member
  • *****
  • Posts: 2965
    • View Profile
Re: Just Discovered Lua Scripting, WOW!
« Reply #1 on: September 25, 2016, 06:15:49 pm »
The main one I have gone through is https://www.dropbox.com/s/b2kuma6zs89di8n/Metroid.lua which I was linked in http://www.romhacking.net/forum/index.php?topic=18717.0 . I have no great desire to play the game with it but to go through it saw me consider some things I might not have otherwise done and I like it for that.

I tend not to use it as I do try for "runs in hardware" as the basis for things and the systems I tend to play on all have top debugging capabilities, though should I go back to the megadrive I probably would want something there.

RyanfaeScotland

  • Sr. Member
  • ****
  • Posts: 366
    • View Profile
    • My Brill Game Site
Re: Just Discovered Lua Scripting, WOW!
« Reply #2 on: September 25, 2016, 07:29:19 pm »
Yeah I get the runs on real hardware thing and can see this being a real temptation into the darkside with quick and powerful results at the expense of real hardware compatibility.

Just from the topic you linked (not the script) it's funny it should mention a hud because that's one of the first things I thought of for T&E, drawing more items on the map (presents, ship pieces, enemies, pretty much everything).

tryphon

  • Hero Member
  • *****
  • Posts: 722
    • View Profile
Re: Just Discovered Lua Scripting, WOW!
« Reply #3 on: September 26, 2016, 05:55:34 pm »
Is there some tuto for Lua scripting in GENS ?

mz

  • Sr. Member
  • ****
  • Posts: 447
  • Whore
    • View Profile
Re: Just Discovered Lua Scripting, WOW!
« Reply #4 on: September 26, 2016, 06:31:29 pm »
Yes, just get the Gens version with Lua support (Gens Re-recording) and it should come with a file called gens-lua.html, which has a tutorial an all the documentation you should need. It also comes with several examples.

(...I think. I haven't used it in 10 years.)
There has to be a better life.

RyanfaeScotland

  • Sr. Member
  • ****
  • Posts: 366
    • View Profile
    • My Brill Game Site
Re: Just Discovered Lua Scripting, WOW!
« Reply #5 on: September 26, 2016, 07:00:20 pm »
I'm using r57shell for my flavour of Gens that has it and it has a few example scripts. The one I really caught interest in it from was one for Gain Ground which I think I found via a TAS video, I'd need to search again to be sure though and it's a bit late for that.

I can however pass you these two links that are working out pretty handy: Lua in Gens: http://ystc.ru/gens-lua.html and Lua in General https://www.lua.org/manual/5.3/ YouTube also turns up some fun and interesting videos although nothing really suited for tutorials but the guy Xkeeper showcases some really cool stuff, https://www.youtube.com/playlist?list=PL95B59A7166999892, of note: Drag and Drop Mario (https://www.youtube.com/watch?v=NnZz5A9Z6A8) and Rainbow Riding (https://www.youtube.com/watch?v=1XNTjVScm_8)

September 27, 2016, 02:49:40 am - (Auto Merged - Double Posts are not allowed before 7 days.)
Mz, just noted the names of the HTML files we both mention and I'd be surprised if they aren't the same file.  :thumbsup:

Here is the Gain Ground script I was on about: http://tasvideos.org/3736S.html does lots of cool stuff and is pretty well coded (I think) so a good example to look at.
« Last Edit: September 27, 2016, 02:51:13 am by RyanfaeScotland »

tryphon

  • Hero Member
  • *****
  • Posts: 722
    • View Profile
Re: Just Discovered Lua Scripting, WOW!
« Reply #6 on: September 27, 2016, 01:52:04 pm »
Thank you very much. I use Gens on a daily basis and never dared to use Lua. It may be tile for a try !