Page 10 of 50
Re: Presenting: Lunadll for Lua!
Posted: 29 Oct 2014, 12:47
by Kevsoft
I just checked the code kil wrote. So the image is ALWAYS loaded from the custom-folder of the level.
Re: Presenting: Lunadll for Lua!
Posted: 29 Oct 2014, 13:13
by Hoeloe
Kevsoft wrote:I just checked the code kil wrote. So the image is ALWAYS loaded from the custom-folder of the level.
This is a pain, but if this is the case, then there is something wrong with placeSprite in the API code. I haven't tested it on a loop, but it doesn't seem to work on load.
Re: Presenting: Lunadll for Lua!
Posted: 29 Oct 2014, 13:32
by Darkchaox100
I tried loading & Placing sprites with a api too,doesnt seem to work.
with lunadll.lua it seems to work without any issues though.
Re: Presenting: Lunadll for Lua!
Posted: 29 Oct 2014, 16:20
by Kevsoft
I just tested it, for me it works all fine:
in LuaScriptLib/sometestloader.lua
Code: Select all
local sometestloader = {}
function sometestloader.onInitAPI()
registerEvent("sometestloader", "onLoad")
registerEvent("sometestloader", "onLoop")
end
function sometestloader.onLoad()
loadImage("sometest.bmp", 1, 0xFFFFFFFF)
end
function sometestloader.onLoop()
placeSprite(1, 1, 20, 300)
end
return sometestloader
and in lunadll.lua:
Code: Select all
loader = loadAPI("sometestloader")
Re: Presenting: Lunadll for Lua!
Posted: 29 Oct 2014, 16:29
by Hoeloe
placeSprite in a loop with no duration is inefficient, as it places more sprites each frame (eventually causing the game to slow down). It's much more efficient to call placeSprite once when loading, and that is what doesn't work. I suspect it might be to do with the code that calls the onLoad function, but I'm not sure.
Try this code out:
Code: Select all
local sometestloader = {}
function sometestloader.onInitAPI()
registerEvent("sometestloader", "onLoad")
end
function sometestloader.onLoad()
loadImage("sometest.bmp", 1, 0xFFFFFFFF)
placeSprite(1, 1, 20, 300)
end
Re: Presenting: Lunadll for Lua!
Posted: 29 Oct 2014, 16:34
by Kevsoft
Works without problems (and yes, in the API file and not in the host file)!
Re: Presenting: Lunadll for Lua!
Posted: 29 Oct 2014, 16:40
by Hoeloe
Kevsoft wrote:Works without problems (and yes, in the API file and not in the host file)!
Interesting. Perhaps there is some difference between your version and the released version that has fixed the issue?
EDIT: Hmm. I just tried again, and it worked. My code is exactly the same as it was before, but now it seems to work fine. Interesting.
Would certainly be nice to be able to load from the main path, rather than the level folder, though. It would make global objects (such as the raocoin counter) much easier to load in reliably.
EDIT EDIT: Ah, turns out I was using the wrong lunaworld - it's still not working.
I'll post an update of my Raocoin system when I have this working. I'm not going to change anything in the trigger system, though. You can still use loadAPI to load it in, but you still need to manually check for triggers. The reason for this is that it requires you specify the item IDs of the triggers in question. Given time, I just might be able to work it so that it does it automatically, but at the moment, this is how it will be.
Re: Presenting: Lunadll for Lua!
Posted: 30 Oct 2014, 09:44
by Kevsoft
LunaLua v0.3.3 is out!
Changes:
Example:
Code: Select all
i = 0
run = true
function onLoop()
i = i + 1
local myLayer = findlayer("MyLayer")
if(myLayer)then
printText(myLayer.layerName.str, 30, 200)
if(i % 100 == 1)then
run = not run
end
if(run)then
myLayer.speedX = -1
else
myLayer:stop()
end
end
end
(requires a layer "MyLayer" added with some blocks

)
Documentary will be updated soon!
Re: Presenting: Lunadll for Lua!
Posted: 30 Oct 2014, 10:20
by Hoeloe
Going to check if this new version sorts out the placeSprite issue.
EDIT: Aha! I finally fixed it! Turns out, it was an issue with the path of the "init" function being mistyped! Seems to work fine now. Will upload a new version of the raocoin system soon.
New shop library! Now a lot easier to use. Requires only one line in lunaworld to implement the raocoin system!
Raocoin Library
Re: Presenting: Lunadll for Lua!
Posted: 30 Oct 2014, 11:09
by Kevsoft
Hoeloe wrote:EDIT: Aha! I finally fixed it! Turns out, it was an issue with the path of the "init" function being mistyped! Seems to work fine now. Will upload a new version of the raocoin system soon.
Then all is good! :D
Btw guys: Do you need to change smbx events at runtime? I just asking if I should implement that.
Re: Presenting: Lunadll for Lua!
Posted: 30 Oct 2014, 11:17
by Hoeloe
Kevsoft wrote:Hoeloe wrote:EDIT: Aha! I finally fixed it! Turns out, it was an issue with the path of the "init" function being mistyped! Seems to work fine now. Will upload a new version of the raocoin system soon.
Then all is good! :D
Btw guys: Do you need to change smbx events at runtime? I just asking if I should implement that.
What do you mean by "change" SMBX events?
Re: Presenting: Lunadll for Lua!
Posted: 30 Oct 2014, 11:22
by Kevsoft
Well, modify the events.
Re: Presenting: Lunadll for Lua!
Posted: 30 Oct 2014, 11:24
by Hoeloe
Kevsoft wrote:Well, modify the events.
That's not entirely helpful. Do you mean changing what a specific event does? Changing which event is triggered by an object? There are a number of things that could mean.
For the record, of those two, the latter would be more useful.
Re: Presenting: Lunadll for Lua!
Posted: 30 Oct 2014, 11:41
by Kevsoft
Or better said: Modifiy the event properties/content... whatever.
Hoeloe wrote:Changing which event is triggered by an object.
Is currently difficult because of the ugly VB6 Strings. Might be possible in the future.
Re: Presenting: Lunadll for Lua!
Posted: 30 Oct 2014, 11:55
by Hoeloe
Kevsoft wrote:Or better said: Modifiy the event properties/content... whatever.
I'm not sure it's really worth it. The ability to trigger Lua from SMBX events means you can essentially do this already, by using two different events and hooking up a condition in Lua. Still, might make things a bit easier, depending on implementation, and having an Event class would be useful in the long run anyway.
Re: Presenting: Lunadll for Lua!
Posted: 30 Oct 2014, 13:33
by Oddwrath
So, I've looked at the section class code and I'm still not sure about one thing: can we do autoscrolling like
this yet?
Re: Presenting: Lunadll for Lua!
Posted: 30 Oct 2014, 15:48
by TiKi
Oddwrath wrote:So, I've looked at the section class code and I'm still not sure about one thing: can we do autoscrolling like
this yet?
It better not be
Re: Presenting: Lunadll for Lua!
Posted: 30 Oct 2014, 16:03
by Kevsoft
Probably by updating the level boundaries yourself.....
Re: Presenting: Lunadll for Lua!
Posted: 30 Oct 2014, 19:19
by Rixithechao
Oh, man,
so close! Everything works except disabling the original NPC messages! Setting NPC.msg.str = "" just replaces the first character with a space.
Which offset points to the NPC.msg VBStr? I could index the pointers, grab a dead end pointer from an NPC without a message and then selectively replace them based on the section number or some other scope condition; in theory, that
should disable the default SMBX message functionality... if not, then it might just be controlled by another NPC offset and I'd just have to experiment with the remaining unknowns.
Re: Presenting: Lunadll for Lua!
Posted: 30 Oct 2014, 19:44
by Hoeloe
Quick question: how does playSFX work? I'm trying to use it to add more sound effects to my level, but it's just playing the Windows alert noise, not my sound file.
Re: Presenting: Lunadll for Lua!
Posted: 30 Oct 2014, 19:45
by Holy
Kevsoft wrote:1.) "player.UKeyState" is what your looking for. -1 if it is pressed, 0 if it is not pressed
Awesome, didn't know that was a thing!
Is there a way to "tighten" the block collision? Basically I'm tryin to do this bouncy ball thing:
and you can bounce up the walls because it still thinks you're colliding with the tops of the wall blocks.
Here's the current code for this btw in case there's a hilariously easier way to do it I didn't think of
Re: Presenting: Lunadll for Lua!
Posted: 30 Oct 2014, 20:16
by Kevsoft
uff... I currently don't know a "easier" way. I might add a secondary function where you can add you offsets to the collision check.
Re: Presenting: Lunadll for Lua!
Posted: 30 Oct 2014, 20:19
by Rixithechao
The block collision stuff is kinda finnicky, I tried to set up some stuff with it and Demo kept falling through the ground. Best to manipulate layers instead of blocks... unless you're doing something like a yellow devil battle (someone should get on that asap plz kthx).
Regarding playSFX, it may be the import path.
Re: Presenting: Lunadll for Lua!
Posted: 30 Oct 2014, 21:45
by Hoeloe
Is there a way to access and set the absolute position of a layer? I'm trying to create a series of looping events. Doing so in SMBX is difficult because the floating point values get truncated too early, meaning it drifts over time. Doing so in Lua seems to also drift off, but more severely, and only under certain circumstances (such as changing sections).
Oh, I also fixed playSFX - it only supports .wav files, not .mp3. Worth adding that to the documentation.
Re: Presenting: Lunadll for Lua!
Posted: 30 Oct 2014, 21:51
by Kevsoft
Layers in SMBX don't have positions. They only move their objects by the speed, nothing else.