(shouting)

LunaLua Offical Thread

The second SMBX collab!

Shall I stream some LunaLua live development?

Yes
23
92%
No
2
8%
 
Total votes: 25

User avatar
Wohlstand
Moondust and TheXTech developer
Posts: 186
Joined: 10 years ago
First name: Vitaly
Pronouns: he/him/his
Location: Moscow, Russia

Re: LunaLua Offical Thread

Post by Wohlstand »

Karatekid5 wrote:I'm having the same problem regarding the new version of LunaLUA and autocode. I used no comments in my level's autocode yet I still got the same on-screen syntax errors as SAJewers did. Though, I'm glad it isn't a problem with my level's LunaDLL code.
Please take hotfix (Kevin has been fixed that bug in Autocode module), just uploaded and it's available now
User avatar
Karatekid5
Welcome to the resort!
Posts: 78
Joined: 14 years ago
Location: Pennsylvania
Contact:

Re: LunaLua Offical Thread

Post by Karatekid5 »

Excellent! Everything is working again! ^_^
Yoshi Ambassador!
Image
User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 9 years ago

Re: LunaLua Offical Thread

Post by Kevsoft »

A Hotfix which fixes the Autocode Module has just been uploaded!
User avatar
Valentine
[b]the[/b]
Posts: 359
Joined: 9 years ago
Pronouns: she/her
https://valentine.talkhaus.com/

Re: LunaLua Offical Thread

Post by Valentine »

Does anyone have a lunalua script that can make it that if you hit a switch gravity flips and becomes upside down?

Also it'd be great if it worked for NPCs and not just for the player but that's isn't necessary.
Image
Image
:trans_pride:
User avatar
romajiQuadhash
typos "raocow" as "roacow" (and I TAS)
Posts: 12
Joined: 9 years ago
First name: Romaji Quadhash
Pronouns: ke/keh/ker
Location: ""Canada""

Re: LunaLua Offical Thread

Post by romajiQuadhash »

Little Boo wrote:Does anyone have a lunalua script that can make it that if you hit a switch gravity flips and becomes upside down?

Also it'd be great if it worked for NPCs and not just for the player but that's isn't necessary.
No, and knowing SMBX this is probably very, very hard
This is a sig
User avatar
Hoeloe
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaLua Offical Thread

Post by Hoeloe »

romajiQuadhash wrote:
Little Boo wrote:Does anyone have a lunalua script that can make it that if you hit a switch gravity flips and becomes upside down?

Also it'd be great if it worked for NPCs and not just for the player but that's isn't necessary.
No, and knowing SMBX this is probably very, very hard
Hopefully in the near future it will be not quite so hard, though not as simple as "flip gravity backwards".

The way this would be done is in three parts:

1. Create two sections - one the right way up, one upside down.
2. When you want to flip gravity, calculate the coordinates in the other section, and transport the player and all NPCs to that section.
3. (Not currently possible) Using a post-process effect, flip the entire screen upside down.
Image
Image
Image
Image
Image
User avatar
Valentine
[b]the[/b]
Posts: 359
Joined: 9 years ago
Pronouns: she/her
https://valentine.talkhaus.com/

Re: LunaLua Offical Thread

Post by Valentine »

I guess i'll wait for the post-process thing to become possible (Hopefully soon i guess).
Image
Image
:trans_pride:
User avatar
SAJewers
ASMBXT Level Wrangler/A2XT Project Coordinator /AAT Level Designer
Posts: 4199
Joined: 11 years ago
Location: Nova Scotia

Re: LunaLua Offical Thread

Post by SAJewers »

Hoeloe wrote: 3. (Not currently possible) Using a post-process effect, flip the entire screen upside down.
You should be able to fake the effect with an animated graphic, like that Super Mario Japan level. It would massively eat increase load times though, and wouldn't look as good.
ImageImageImageImageImage | Image | Image
Sharenite | RetroAchievements | NameMC | IGDB
User avatar
Valentine
[b]the[/b]
Posts: 359
Joined: 9 years ago
Pronouns: she/her
https://valentine.talkhaus.com/

Re: LunaLua Offical Thread

Post by Valentine »

Well i mean also since i have low gravity in the same level, is it possible to make the NPCs also be affected by the low gravity?

also PGE lets me flip sections upside with one button so that isn't gonna be nearly as tedious as i thought it would be.
Image
Image
:trans_pride:
User avatar
Hoeloe
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaLua Offical Thread

Post by Hoeloe »

Hotfix for multipoints! Somehow a persistent placeSprite had sneaked its way in there, so Lua checkpoints were causing lag and other weird behaviour. Fixed now.

http://engine.wohlnet.ru/pgewiki/Multipoints.lua

EDIT: Also slight update to raocoin2 to make text look a little neater. Would be good to have world-space text drawing as a thing in LunaLua without having to manually program it, though.
Image
Image
Image
Image
Image
WasabiJellyfish
Posts: 117
Joined: 9 years ago

Re: LunaLua Offical Thread

Post by WasabiJellyfish »




A little test for a something I'm working on, hope you guys like it.
User avatar
Hoeloe
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaLua Offical Thread

Post by Hoeloe »

Wasabi pointed out that I'd done something stupid in HUD of Time, so it's patched up now and the magic bar will no longer look super weird if you change the graphic.
Image
Image
Image
Image
Image
User avatar
Hoeloe
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaLua Offical Thread

Post by Hoeloe »

Small raocoin2 update that just makes the worldToScreen function less stupid.

Edit: And another to make it even more less stupid.
Image
Image
Image
Image
Image
Mikkofier
What about Ron magic?
Posts: 699
Joined: 11 years ago
First name: Mikko J. Fuzzygrumbles
Pronouns: he/him/his
Location: Lots of miles from Vietnam
Contact:

Re: LunaLua Offical Thread

Post by Mikkofier »

I'd like to see the lunadll.lua file of a level that uses switch block saving, for learning purposes.
Many people need desperately to receive this message: I feel and think much as you do, care about many of the things you care about, although most people do not care about them. You are not alone.
-Kurt Vonnegut
Context-free Supper Mario Broth Roulette! NOTE: Potential Jumpscare warning!
Image
Avatar source (for most of them).
Image
User avatar
Hoeloe
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaLua Offical Thread

Post by Hoeloe »

SAJewers pointed out yet another multipoints bug. 3.0.6 hotfix is up now that should fix it. Also updated raocoin2 to fix some sprite placements and added a per-currency onCollect event, as well as adding an "increment" variable for onCollect.
Image
Image
Image
Image
Image
User avatar
Hoeloe
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaLua Offical Thread

Post by Hoeloe »

Patch to raocoin2.lua. Pyro noted that using a P-switch counted as collecting raocoins, which is obviously incorrect. Using onNPCKill and colliders, this is now no longer the case, and raocoins can be properly collected in v2.0.6.

http://engine.wohlnet.ru/pgewiki/Raocoin2.lua

This should be added to the A2XT devkit.
Image
Image
Image
Image
Image
Rixithechao
https://www.youtube.com/watch?v=BODxOghVmko
Posts: 1811
Joined: 10 years ago
First name: Mack
https://rixithechao.talkhaus.com/

Re: LunaLua Offical Thread

Post by Rixithechao »

Just added some tables for certain groups of NPCs to npcid.lua to help with a dumb side project I just started. Most of 'em are based on their current organization (NPCID.BOSSES, NPCID.FISHES, NPCID.GHOSTS, NPCID.SHROOMS, etc) but I threw in a few others for specific enemy groups and whatnot (NPCID.FOODSHROOMS, NPCID.SNIFITS, NPCID.BOMBS, NPCID.VINETOPS, etc).

There's a lot more I could probably do, like all NPCs of specific categories for specific game, but [reasons] and [excuses].

https://drive.google.com/file/d/0B-w323 ... sp=sharing
Delightful Adventure Enhanced is out now!

Image

There's an official ASMT Discord server! Check it out to discuss Demo games and follow their development! thread, invite link

(Entry requires verification, either with a connected Youtube/Twitter/Twitch/etc account or manually by the server staff.)


Itch.io (albums and eventually games), Youtube (dofur pass and I guess other videos)
User avatar
Hoeloe
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaLua Offical Thread

Post by Hoeloe »

Just wrote a bit of code that would probably be good to add to mainV2.lua.

Code: Select all

function registerCustomEvent(obj, eventName)
	local queue = {};
	local mt = getmetatable(obj);
	if(mt == nil) then
		mt = {__index = function(tbl,key) return rawget(tbl,key) end, __newindex = function(tbl,key,val) rawset(tbl,key,val) end}
	end
	local index_f = mt.__index;
	local newindex_f = mt.__newindex;
		
	mt.__index = function(tbl, key)
		if(key == eventName) then
			return function(...)
				for _,v in ipairs(queue) do
					v(...);
				end
			end
		else
			return index_f(tbl, key);
		end
	end
		
	mt.__newindex = function (tbl,key,val)
		if(key == eventName) then
			table.insert(queue, val);
		else
			newindex_f(tbl,key,val);
		end
	end
		
	setmetatable(obj,mt);
end
Essentially, this allows me to do something like this:

Code: Select all

registerCustomEvent(multipoints, "onCollected");
	registerCustomEvent(multipoints, "onLevelStart");
Which will register custom API events that can be defined in multiple places without overriding one another. So, for example, if I define:

Code: Select all

function multipoints:onCollected(id)
      windowDebug("lunaworld test");
end
inside lunaworld.lua, and:

Code: Select all

function multipoints:onCollected(id)
      windowDebug("lunadll test");
end
inside the level file's lunadll.lua, then I will get two debug windows, one for each event that was registered. Without this setup, only the lunadll.lua window would display, as it would overwrite the existing event when defining it.

This code relies on nested function calls, which shouldn't be an issue, but if you're worried about performance, I can write an alternative that uses tables instead without much issue.


On an only slightly related topic:

I'm looking into the multipoints bug where NPCs don't spawn when you load into a checkpoint. My suspicion is that SMBX is confused when warping the player because of the lack of a midpoint NPC, and is loading an unrelated set on NPCs. Now, the best way of fixing this would be to look into the warp code in SMBX and see how that sets the player location. By replicating that, I can ensure the NPCs are loaded properly.

In trying to fix this though, it's occurred to me that, though onLoad is useless 99% of the time, there are a very few occasions where it's actually useful, so, if nothing else but for the sake of consistency, can we make registerEvent work with onLoad please? At the moment APIs can't use it, and one of my attempted fixes required it.

EDIT: Also found a bug in raocoin2.lua. Should be fixed now.
Image
Image
Image
Image
Image
User avatar
Hoeloe
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaLua Offical Thread

Post by Hoeloe »

Okay, got a report that multipoints was causing some issues because of the latest patch. I've updated it now.

It seems the error was because multipoints teleports the player a frame late (to account for weirdness in the packaged game). I've not changed it so that it teleports the player on both the first and second frames, which should fix this issue. It seems to fix the the "NPCs don't spawn" error.

Also the multipoints events will now work even if you define them in multiple places. May use this in A2XT if we go with raocoins saving at checkpoints.

EDIT: Another update to multipoints, just fixes a bug where multipoints would fail if you used a hub that loaded the multipoints API.
EDIT EDIT: Turns out that fix was bogus and stupid and not necessary because there wasn't even a problem. New version fixes it.
EDIT EDIT EDIT: Turns out that multipoints didn't work with regular midpoints - if the library was loaded and only regular midpoints were used, things got a bit weird. 3.0.10 fixes that.
EDIT EDIT EDIT EDIT: Aaaand another hotfix. Multipoints 3.0.11 works with section music now. An earlier version broke that.
Image
Image
Image
Image
Image
User avatar
Hoeloe
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaLua Offical Thread

Post by Hoeloe »

So I'm working on a library called Xmem, designed to make mem calls a little less awkward.

It's still experimental at the moment, but it adds a number of new functions to NPCs and Players (these can be used just like the regular mem function, even on pnpc objects!)

NPC:memget - this gets the value at the given mem address. It is limited to the addresses on the wiki, but does not need a type argument. For example, npc:memget(0xF0) is equivalent to npc:mem(0xF0,FIELD_WORD).

Code: Select all

npc:memget(memaddress)
NPC:memset - similar to memget, but for setting variables instead of getting them. So npc:memset(0xF0,1) is equivalent to npc:mem(0xF0,FIELD_WORD,1).

Code: Select all

npc:memset(memaddress, value)
NPC:xmem - used the same way as the existing mem calls. Can be used for both getting and setting values. For example, npc:xmem(0xF0) is equivalent to npc:memget(0xF0), while npc:xmem(0xF0,1) is equivalent to npc:memset(0xF0,1).

Code: Select all

npc:xmem(memaddress, [optional]value)
There are also a couple of useful debug features:

NPC:memdump - prints the entire memory structure of the NPC to the screen. If textblox is installed, it will use it for better formatting, otherwise it will use the default font. Can be fed upper and lower limits to print only a section of the NPC memory.

Code: Select all

npc:memdump([optional]lowbound, [optional]highbound)
NPC:memlog - similar to memdump, but will write the value out to a file instead. Each new play session will generate a new log file the fire time memlog is called.

Code: Select all

npc:memlog([optional]lowbound, [optional]highbound)
These functions can also be used with players:

Code: Select all

player:memdump()
And can be used on global memory:

Code: Select all

xmem.memdump()
What do people think of this library? It's still experimental because the typing of a few values needs to be finalised, but in theory, it should help a lot with debugging.

Here's a screenshot of some "memdump" calls, with textblox active:

Image
Image
Image
Image
Image
Image
User avatar
Ivy
Posts: 2387
Joined: 10 years ago
Pronouns: any
Contact:
https://ivy.talkhaus.com/

Re: LunaLua Offical Thread

Post by Ivy »

neat!
3DS FC: 2793-0650-7690 | Switch: SW-2766-9108-9399 | Steam: ivysaur1996 (ivy)
User avatar
ohmato
hey idiot
Posts: 792
Joined: 9 years ago
Location: location, location
Contact:

Re: LunaLua Offical Thread

Post by ohmato »


Image
Image
Image
Image
Image
User avatar
Hoeloe
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaLua Offical Thread

Post by Hoeloe »

So... I made a new library. Someone mentioned particle effects on Skype and.. well...

http://i.imgur.com/CATciUP.webm

Particles.lua can be downloaded here.
Image
Image
Image
Image
Image
User avatar
ohmato
hey idiot
Posts: 792
Joined: 9 years ago
Location: location, location
Contact:

Re: LunaLua Offical Thread

Post by ohmato »

I made a prototype plugin that implements the SMW camera in SMBX. You can get it here.

There are only three functions: activate/deactivate methods, and a get method for whether the camera is active. When you load the API, the camera is active by default.

As I mentioned, this is a prototype. L/R scrolling should be fairly close to the desired product, vertical camera locking is present but might need work. I'd like some feedback from people more familiar with the SMW feel to improve it. Some details might be iffy given how wildly different SMBX and SMW are in some places.
Image
Image
Image
Image
Image
User avatar
ohmato
hey idiot
Posts: 792
Joined: 9 years ago
Location: location, location
Contact:

Re: LunaLua Offical Thread

Post by ohmato »

SMW camera update. Tweaked vertical snapping, added U/D panning when you hold up or down.

L/R button panning soon to come, maybe.

Edit: Fixed how warping affects camera panning.
Edit 2: Fixed camera panning on slopes and when standing on NPCs.
Image
Image
Image
Image
Image
Post Reply