Suggestion for LunaLua: Memory Locking

This is the place for discussion and support for LunaLua and related modifications and libraries.

Moderator: Userbase Moderators

Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?
Sambo
Snifit
Snifit
Posts: 211
Joined: Fri Jan 24, 2014 6:43 pm

Suggestion for LunaLua: Memory Locking

Postby Sambo » Tue Oct 25, 2016 10:28 pm

Are you familiar with that checkbox next to each memory address in Cheat Engine that "locks" it so the hooked program can't change it? This could be a powerful function for LunaLua, especially if it could be done to a specific NPC or block. I know, you could set the address to the same value every frame. But this doesn't always work. Let's look at platform NPCs, for example:

What if you wanted to take control of a platform's movement? The movement pattern of a platform is determined by an address that stores the ID of the line it is on, and this value is set every frame, depending on what line the platform is on (set to 0 if not on a line). If the value is 0 and the platform is active, the platform is affected by gravity. You don't want it to be affected by gravity; this makes controlling its movement a hassle. You can't set the platform to not be affected by gravity in its .txt (I tried and it doesn't work). Changing the memory address containing the line ID to 0 every frame doesn't work, either. SMBX just changes it back to 0 and it still falls a bit before Lua switches it back to 71 (the horizontal line).

It would work like this:

Code: Select all

Misc.lockMem(address)
"address" can be any memory address. For instance, if you wanted to lock AI-1 of an NPC (it would probably need to be wrapped with pnpc.lua), you would use:

Code: Select all

Misc.lockMem(npc.ai1)
This would lock that address and prevent SMBX from changing it. You could still change it yourself using LunaLua, of course.

I will put this in the LunaLua wishlist, linked to this page.

Alucard648
Flurry
Flurry
Posts: 181
Joined: Sun Aug 16, 2015 3:45 am

Re: Suggestion for LunaLua: Memory Locking

Postby Alucard648 » Wed Oct 26, 2016 7:20 am

And SMBX will crash when encounter such lock. Not worth hellish hassle.

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Suggestion for LunaLua: Memory Locking

Postby PixelPest » Wed Oct 26, 2016 7:31 am

As long as it's not a read-only field, you should be able to set it onTick() just fine from what I've tried

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9891
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Suggestion for LunaLua: Memory Locking

Postby Emral » Wed Oct 26, 2016 10:24 am

Alucard648 wrote:And SMBX will crash when encounter such lock. Not worth hellish hassle.
No?
PixelPest wrote:As long as it's not a read-only field, you should be able to set it onTick() just fine from what I've tried
No? Have you tried setting a boo's ai1 field in onTick?

Either way, sounds like something pretty useful, though I think it would work better as an override which forces a value onto a memory offset. Having a lock sounds like you wouldn't be able to externally modify it.

Sambo
Snifit
Snifit
Posts: 211
Joined: Fri Jan 24, 2014 6:43 pm

Re: Suggestion for LunaLua: Memory Locking

Postby Sambo » Wed Oct 26, 2016 4:46 pm

PixelPest wrote:As long as it's not a read-only field, you should be able to set it onTick() just fine from what I've tried
It doesn't always. When I tried that platform example in my last post, setting the value on onTick did not work right, and NPC AI fields aren't read only.
Enjl wrote:Either way, sounds like something pretty useful, though I think it would work better as an override which forces a value onto a memory offset. Having a lock sounds like you wouldn't be able to externally modify it.
That's what I meant. That's how it works in Cheat Engine. After you lock the field, you can still assign different values to it. The program itself just stops changing it.

Hoeloe
Phanto
Phanto
Posts: 1465
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: Suggestion for LunaLua: Memory Locking

Postby Hoeloe » Wed Oct 26, 2016 5:13 pm

I'm reluctant about this idea. It's got potential caveats, and serious ones, and from a programming design perspective is a VERY strange way to go about things, and is really quite... well, ugly, frankly.

There are better solutions to SMBX's awkward value management than this, and it is a topic that has come up during development of 2.0, it's just not a priority at the moment.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari