LunaLua Offical Thread
Re: Presenting: Lunadll for Lua!
No, sorry for the misunderstanding. I meant with 'replace' that is should be used in the future.
Re: Presenting: Lunadll for Lua!
That's fine, just wanted to clear that up. It's always best to just mark old functions as "deprecated" rather than removing them for this reason, but that seems to be what's been done, which is good.Kevsoft wrote:No, sorry for the misunderstanding. I meant with 'replace' that is should be used in the future.
Re: Presenting: Lunadll for Lua!
I'm having some problems with pnpc. I've used spawnNPC to create a new NPC, and am storing it by wrapping it up with pnpc:
This seems to work, but I get an "invalid access" error on the next bit (line 84 of pnpc):
And if I add a validity check around those, I get "attempt to index field '__ref' (a number value)".
Code: Select all
local effect = pnpc.wrap(spawnNPC(165, x, y, player.section));
effect:mem(0x46,FIELD_WORD,-1);
effect.speedX = 0;
effect.speedY = 0;
Qs[i] = { e = effect, x = x, y = y };
Code: Select all
for _,v in pairs(Qs) do
v.e.x = v.x;
v.e.y = v.y;
end
Re: Presenting: Lunadll for Lua!
Could you not check for whether the current time from Audio.MusicClock() has decreased? That would imply either a song changing or the music looping.Horikawa Otane wrote:Wohl seems to use ticks to determine song stuff. Would it be possible to use the new isplaying stuff to detect when a song ends and switch to a new random one?
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: Presenting: Lunadll for Lua!
Actually you can't use Audio.MusicClock() to detect when it loops, pretty sure it'll just keep counting up through the loop. I don't *think* the the SDL audio API gives a way to hook when it loops at all. There's Mix_HookMusicFinished but pretty sure that won't get called upon a loop. A better alternative to implementing detection of when it loops, is if the LunaLua Audio API was simply extended to allow you to run a play music call that doesn't automatically loop. If I add that, all you need to do is call the "is music stopped" function each tick and if so start the next track. As far as fading out is concerned, perhaps just edit it into the audio files?Horikawa Otane wrote:I must have missed that! When it becomes zero, the song is over.Hoeloe wrote:Could you not check for whether the current time from Audio.MusicClock() has decreased? That would imply either a song changing or the music looping.Horikawa Otane wrote:Wohl seems to use ticks to determine song stuff. Would it be possible to use the new isplaying stuff to detect when a song ends and switch to a new random one?
It'd be nice if we had something to return the length of the song so we could calculate how long it has until the end (and then do a fade out).
Querying the length of a song is also not something that's particularly easy. The SDL API doesn't give a way to query music length. For some audio formats (i.e. .ogg, .wav, etc) I could implement something that loads the music file as a sound effect temporarily instead and queries it's length that way, but for other audio formats that it supports (i.e. xm, midi, etc) that method would fail. It would be a messy way to do things.
If you hardcode song lengths, I do suggest you still use Audio.MusicClock() do compare against though as that's guaranteed to stay in sync with the audio engine unlike other timekeeping methods.
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: Presenting: Lunadll for Lua!
I think you're running an out-of-date version of the pnpc library. There was a bug causing the "attempt to index field '__ref' (a number value)" in an older version that I've fixed, and further line 84 has nothing to do with accessing __ref in the current version. The current version is both on the wiki and in the current LunaDLL download.Hoeloe wrote:I'm having some problems with pnpc. I've used spawnNPC to create a new NPC, and am storing it by wrapping it up with pnpc:.
Re: Presenting: Lunadll for Lua!
Certainly possible. I'll give that a try.Rednaxela wrote:I think you're running an out-of-date version of the pnpc library. There was a bug causing the "attempt to index field '__ref' (a number value)" in an older version that I've fixed, and further line 84 has nothing to do with accessing __ref in the current version. The current version is both on the wiki and in the current LunaDLL download.Hoeloe wrote:I'm having some problems with pnpc. I've used spawnNPC to create a new NPC, and am storing it by wrapping it up with pnpc:.
On an unrelated note, since the latest update, setting the direction of an NPC doesn't appear to work any more. Both "npc.direction" and using the mem function have no effect.
Last edited by Hoeloe 9 years ago, edited 2 times in total.
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: Presenting: Lunadll for Lua!
Somewhat surprised you have the old version as there was only a 2-day window of time (March 1st to March 3rd) that was up that the fixed version wasn't. I blame Murphy.
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: Presenting: Lunadll for Lua!
Doh. I realized what happened. I thought the direction field was accidentally changed at one point recently, and changed it "back" but was mistaken about the way it was originally. I probably did that on too little sleep. Now fixed.Hoeloe wrote:On an unrelated note, since the latest update, setting the direction of an NPC doesn't appear to work any more. Both "npc.direction" and using the mem function have no effect.
Re: Presenting: Lunadll for Lua!
Hotfix (0.6.1.1) is out by fixing the direction bug and updating the eventu library.
Re: Presenting: Lunadll for Lua!
I updated the download link, it should be now easier to access LunaLua.
Re: Presenting: Lunadll for Lua!
I just added a poll to the main post.
- Wohlstand
- Moondust and TheXTech developer
- Posts: 186
- Joined: 10 years ago
- First name: Vitaly
- Pronouns: he/him/his
- Location: Moscow, Russia
Re: Presenting: Lunadll for Lua!
Hey, I made a small autotool which will fix all non-44100hz musics in all subfolders where you will put them:
https://drive.google.com/open?id=0B3QNP ... authuser=0
I made this file to fix (especially in the previous episodes which made before LunaLUA got usage of SDL)
How to use:
1) unpack archive into "worlds" folder
2) run "MusicFixer.bat" file and wait while all musics will be fixed.
This thing will fix ALL musics in all installed SMBX episodes.
You also can edit "MusicFixer.bat" to define target episode folder which will be fixed.
Good Music Forever!
https://drive.google.com/open?id=0B3QNP ... authuser=0
I made this file to fix (especially in the previous episodes which made before LunaLUA got usage of SDL)
How to use:
1) unpack archive into "worlds" folder
2) run "MusicFixer.bat" file and wait while all musics will be fixed.
This thing will fix ALL musics in all installed SMBX episodes.
You also can edit "MusicFixer.bat" to define target episode folder which will be fixed.
Good Music Forever!
Re: Presenting: Lunadll for Lua!
I just updated from 6.0.3 to "Latest"(6.1.1) using the download link from the first post (full installation).
Using eventu.lua now causes the following error. This even happens when the lua file does absolutely nothing but load the API.
==> eventu.lua:79: bad argument #1 to 'pairs' (table expected, got nil)
What happened?
Using eventu.lua now causes the following error. This even happens when the lua file does absolutely nothing but load the API.
==> eventu.lua:79: bad argument #1 to 'pairs' (table expected, got nil)
What happened?
- Wohlstand
- Moondust and TheXTech developer
- Posts: 186
- Joined: 10 years ago
- First name: Vitaly
- Pronouns: he/him/his
- Location: Moscow, Russia
Re: Presenting: Lunadll for Lua!
Try to update with this: https://dl.dropboxusercontent.com/u/30847069/eventu.luaS1eth wrote:I just updated from 6.0.3 to "Latest"(6.1.1) using the download link from the first post (full installation).
Using eventu.lua now causes the following error. This even happens when the lua file does absolutely nothing but load the API.
==> eventu.lua:79: bad argument #1 to 'pairs' (table expected, got nil)
What happened?
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: Presenting: Lunadll for Lua!
Anyone notice something different?
(Hint: New feature implemented for the next LunaDLL release)
(Hint: New feature implemented for the next LunaDLL release)
Re: Presenting: Lunadll for Lua!
You're just changing the game in every way. That's just amazing.
Re: Presenting: Lunadll for Lua!
This file is identical to the one I am already using.Wohlstand wrote:Try to update with this: https://dl.dropboxusercontent.com/u/30847069/eventu.luaS1eth wrote:I just updated from 6.0.3 to "Latest"(6.1.1) using the download link from the first post (full installation).
Using eventu.lua now causes the following error. This even happens when the lua file does absolutely nothing but load the API.
==> eventu.lua:79: bad argument #1 to 'pairs' (table expected, got nil)
What happened?
From what I can tell, since I did not change anything at all, this error should happen to everyone using the 6.1.1 version, not just me.
Can you, or anyone else, reproduce this? Just make a test level with the example code from http://engine.wohlnet.ru/pgewiki/Eventu.lua and run it in the 6.1.1 full installation version from http://engine.wohlnet.ru/LunaLua/
Re: Presenting: Lunadll for Lua!
Ah. I think I know what the problem is, and it's my fault. It will probably do this if you trigger an SMBX event and don't have anything in eventu listening for it with waitEvent. I can fix it quite easily, let me just do that.S1eth wrote: This file is identical to the one I am already using.
EDIT: Try redownloading now. The hotfix should be on the same link.
Re: Presenting: Lunadll for Lua!
Thank you, this appears to have fixed it. Now my MAFAB entry works again.Hoeloe wrote:Ah. I think I know what the problem is, and it's my fault. It will probably do this if you trigger an SMBX event and don't have anything in eventu listening for it with waitEvent. I can fix it quite easily, let me just do that.S1eth wrote: This file is identical to the one I am already using.
EDIT: Try redownloading now. The hotfix should be on the same link.
- Wohlstand
- Moondust and TheXTech developer
- Posts: 186
- Joined: 10 years ago
- First name: Vitaly
- Pronouns: he/him/his
- Location: Moscow, Russia
Re: Presenting: Lunadll for Lua!
Do you implementing the alpha-channel render feature?Rednaxela wrote:Anyone notice something different?
(Hint: New feature implemented for the next LunaDLL release)
By anyway you can apply mask as alpha-channel (which PGE Editor/Engine are doing)
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: Presenting: Lunadll for Lua!
I might consider adding using the mask file as an alpha channel as well, but for now what it's loading PNGs (with alpha channel) for NPCs (will add blocks, effects, etc later) and overriding the default graphics bitblt using that, and leaving the mask rendering the normal smbx way for GIF file graphics, for compatibility.Wohlstand wrote:Do you implementing the alpha-channel render feature?
By anyway you can apply mask as alpha-channel (which PGE Editor/Engine are doing)
- Wohlstand
- Moondust and TheXTech developer
- Posts: 186
- Joined: 10 years ago
- First name: Vitaly
- Pronouns: he/him/his
- Location: Moscow, Russia
Re: Presenting: Lunadll for Lua!
Good strategy: in the PGE Editor I made the bit-blit like mask applying to keep compatibility of some graphics and I was used bitblit as part of my lazy-fix tool which fixes incorrect masks (like copy-pasting of source sprite but with white color) and PGE Editor have a flag which toggles alpha-blending and bitblit mask applying in the "view -> Enable GFX Fix" menu:Rednaxela wrote:I might consider adding using the mask file as an alpha channel as well, but for now what it's loading PNGs (with alpha channel) for NPCs (will add blocks, effects, etc later) and overriding the default graphics bitblt using that, and leaving the mask rendering the normal smbx way for GIF file graphics, for compatibility.Wohlstand wrote:Do you implementing the alpha-channel render feature?
By anyway you can apply mask as alpha-channel (which PGE Editor/Engine are doing)
It's a function which implementing the original bit-blit:
https://github.com/Wohlhabend-Networks/ ... cs.cpp#L65
BUT, it's an editor only thing, PGE Engine is uses the alpha-blending only
P.S. I think, we should hook the npc.txt parser and parse it we-self to prevent any dumb bugs (I have implemented parser of than format, I will need to port it into STL) like lines of spaces which causes crash. This way will give able to add the "image=" field which I will use in future with PGE to provide customization of image files
Re: Presenting: Lunadll for Lua!
That's really neat! It's always been a pain dealing with masks, and pngs are a much more widely used format for this kind of thing.Rednaxela wrote:I might consider adding using the mask file as an alpha channel as well, but for now what it's loading PNGs (with alpha channel) for NPCs (will add blocks, effects, etc later) and overriding the default graphics bitblt using that, and leaving the mask rendering the normal smbx way for GIF file graphics, for compatibility.Wohlstand wrote:Do you implementing the alpha-channel render feature?
By anyway you can apply mask as alpha-channel (which PGE Editor/Engine are doing)
I'd personally still like to see the placeSprite functions get a little more involved, too. As it stands, we can only draw bmps over the top of the game screen, but it would be nice to be able to draw into the game window alongside npcs and such, with extra features such as transparency, animation, scaling, etc. We could do so much with these additions, and if we could get a lightweight "drawPixel" function, we could pretty much render whatever we like, including 3D effects (though these would be limited since we're not using OpenGL as far as I'm aware).
- FrozenQuills
- hehe haha 2024
- Posts: 843
- Joined: 9 years ago
- Location: my skull
Re: Presenting: Lunadll for Lua!
Oh man this is all super cool!Hoeloe wrote:That's really neat! It's always been a pain dealing with masks, and pngs are a much more widely used format for this kind of thing.Rednaxela wrote:I might consider adding using the mask file as an alpha channel as well, but for now what it's loading PNGs (with alpha channel) for NPCs (will add blocks, effects, etc later) and overriding the default graphics bitblt using that, and leaving the mask rendering the normal smbx way for GIF file graphics, for compatibility.Wohlstand wrote:Do you implementing the alpha-channel render feature?
By anyway you can apply mask as alpha-channel (which PGE Editor/Engine are doing)
I'd personally still like to see the placeSprite functions get a little more involved, too. As it stands, we can only draw bmps over the top of the game screen, but it would be nice to be able to draw into the game window alongside npcs and such, with extra features such as transparency, animation, scaling, etc. We could do so much with these additions, and if we could get a lightweight "drawPixel" function, we could pretty much render whatever we like, including 3D effects (though these would be limited since we're not using OpenGL as far as I'm aware).
If we could just get a drawPixel function, we'll be able to build raytracers and FPS's with enough work... using SMBX of all things lol
But seriously though adjustable alpha channels with .pngs are super amazing enough.
avatar by crayonchewer!