Changes:
LunaLua Offical Thread
Re: Presenting: Lunadll for Lua!
LunaLua v0.2.7.1 is out
Changes:
NOTE: The documentary is not updated yet, because I am still working on moving the whole documetary to the wiki.
Changes:
-
Darkchaox100
- Posts: 0
- Joined: 8 years ago
Re: Presenting: Lunadll for Lua!
But you can still skip the whole typing if you press X.What i basicaly want is that you can only press X if the last letter has been drawn.Your code doesnt quite work yet.Hoeloe wrote:Yeah, that's what that does. It will prevent text from progressing unless it's finished typing.Darkchaox100 wrote:I mean if the text has finished drawing,then you are able to press x,and not while its still typing.Hoeloe wrote:...
Re: Presenting: Lunadll for Lua!
It shouldn't be particularly hard to work out how to do that. If you look at the code I posted again, you'll see that what it's doing is first checking if the X key is pressed while a cutscene is playing:Darkchaox100 wrote: But you can still skip the whole typing if you press X.What i basicaly want is that you can only press X if the last letter has been drawn.Your code doesnt quite work yet.
Code: Select all
if(keycode == KEY_X and cinematX.dialogEndWithInput == true and (cinematX.dialogOn or cinematX.dialogSpeakerTime > 0)) thenCode: Select all
if(cinematX.dialogNumCharsCurrent < string.len (cinematX.dialogTextFull)) then
Code: Select all
cinematX.dialogNumCharsCurrent = string.len(cinematX.dialogTextFull;Then, you'll see an "else" clause - this contains events that should happen whenever the last condition is not met. In this case, we are still looking at when the X key is pressed, but now we're looking for the events when the typewriter effect has actually finished:
Code: Select all
else
playSFX(23) -- 10 = skid, 14 = coin, 23 = shckwup
cinematX.endDialogLine()Code: Select all
if x key is down then
if typewriter is not finished then
finish typewriter
else
progress text
end
end
Code: Select all
if x key is down then
if typewriter is finished then
progress text
end
end
Code: Select all
function cinematX.onKeyDown (keycode)
-- Skip dialog if allowed
if(keycode == KEY_X and cinematX.dialogEndWithInput == true and (cinematX.dialogOn or cinematX.dialogSpeakerTime > 0)) then
if(cinematX.dialogNumCharsCurrent < string.len (cinematX.dialogTextFull)) then
else
playSFX(23) -- 10 = skid, 14 = coin, 23 = shckwup
cinematX.endDialogLine()
end
end
end
Code: Select all
function cinematX.onKeyDown (keycode)
-- Skip dialog if allowed
if(keycode == KEY_X and cinematX.dialogEndWithInput == true and (cinematX.dialogOn or cinematX.dialogSpeakerTime > 0)) then
if(cinematX.dialogNumCharsCurrent >= string.len (cinematX.dialogTextFull)) then
playSFX(23) -- 10 = skid, 14 = coin, 23 = shckwup
cinematX.endDialogLine()
end
end
end
Code: Select all
function cinematX.onKeyDown (keycode)
-- Skip dialog if allowed
if(keycode == KEY_X and cinematX.dialogEndWithInput == true and (cinematX.dialogOn or cinematX.dialogSpeakerTime > 0) and cinematX.dialogNumCharsCurrent >= string.len (cinematX.dialogTextFull)) then
playSFX(23) -- 10 = skid, 14 = coin, 23 = shckwup
cinematX.endDialogLine()
end
end
Code: Select all
if x key is down and typewriter is finished then
progress text
end





-
Darkchaox100
- Posts: 0
- Joined: 8 years ago
Re: Presenting: Lunadll for Lua!
Thats just what i needed! Thank you.
Re: Presenting: Lunadll for Lua!
Want to add that the new documentation for "placeSprite" is still completely useless. What does "type" do? What do the other arguments do, for that matter. You only address the resource number and position, which is a total of 3 of a potential 6 arguments.





Re: Presenting: Lunadll for Lua!
As I already said, I am still working on this getting a decent documentary together. If you need the arguments for all of them you just need to ask kil. I only ported it from Autocode to Lua without getting to actual context. Or in other words: I didn't test it. I just copied the arguments Kil was given to me.
Re: Presenting: Lunadll for Lua!
Right, okay. I only point it out because I'm having trouble with placeSprite, as it's placing the sprites on the scene permanently, which is awkward if I want them to move (it causes a big ugly trail).Kevsoft wrote:As I already said, I am still working on this getting a decent documentary together. If you need the arguments for all of them you just need to ask kil. I only ported it from Autocode to Lua without getting to actual context. Or in other words: I didn't test it. I just copied the arguments Kil was given to me.





Re: Presenting: Lunadll for Lua!
Small update to v0.2.7.2
I just made some crash fixes. It shouldn't crash after a error message display anymore. I did made some test with error spamming, and it did crash. But as long you don't overreact with errors, it should be all fine ;)
I just made some crash fixes. It shouldn't crash after a error message display anymore. I did made some test with error spamming, and it did crash. But as long you don't overreact with errors, it should be all fine ;)
-
Rixithechao
- https://www.youtube.com/watch?v=IwLdM6ejGAM
- Posts: 1608
- Joined: 8 years ago
- First name: Mack
- https://rixithechao.talkhaus.com/
Re: Presenting: Lunadll for Lua!
I can fill in some details, but I can't sign up to the wiki and I don't know if you're ready for others to contribute just yet (haven't checked since yesterday, gonna do that now.)
Delightful Adventure Enhanced is out now!

There's an official ASMT Discord server! Check it out to follow and/or contribute to A2XT Episode 2's 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)

There's an official ASMT Discord server! Check it out to follow and/or contribute to A2XT Episode 2's 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)
Re: Presenting: Lunadll for Lua!
Make a account here. It is bound to the wiki.
Re: Presenting: Lunadll for Lua!
I'm having real trouble with the UserData commands. UserData.isValueSet doesn't seem to work. It always returns false during onLoad, which, annoyingly, is when it's most often useful.





Re: Presenting: Lunadll for Lua!
I see the point. It is because the lua code is loaded before the var-bank is loaded, which result that this API is useless. I just shifted the load code after the var-bank load code and if it is fine I will release it.
Re: Presenting: Lunadll for Lua!
Small update to v0.2.7.3
By request by Hoeloe I've moved the lua code, so the userbank is loaded before the onLoad-code. I also tested it... it works!
By request by Hoeloe I've moved the lua code, so the userbank is loaded before the onLoad-code. I also tested it... it works!
Re: Presenting: Lunadll for Lua!
I made a shop library! I posted it in the theme/town thread, but I'll put it here, too:
https://dl.dropboxusercontent.com/u/308 ... ibrary.zip
It still uses the old version of LunaLua, because I didn't update to the latest one while I was developing it, but it should still work fine.
https://dl.dropboxusercontent.com/u/308 ... ibrary.zip
It still uses the old version of LunaLua, because I didn't update to the latest one while I was developing it, but it should still work fine.





Re: Presenting: Lunadll for Lua!
I am currently working on a custom API-Enviroment, so all events are running independetly for each loaded API. I try to make the usage of custom APIs easier. If I get the first draft out, I will let you guys know.
Re: Presenting: Lunadll for Lua!
Small update about the upcoming LunaLua version.
With the new version you can write APIs running parallel to the main code file.
For example here I have 'framecounter.lua' (which counts the frames).
with the registerEvent-function I can handle specific events before or after the event is executed by the main file.
And in the main code file I just write:
The loadAPI-function is based on the require function, but in addition does add the api to the event-table and makes the registerEvent-function possible.
Also the new shared API folder is located in "{Main Game Path}/LuaScriptsLib/" containing all API files. Like: "{Main Game Path}/LuaScriptsLib/framecounter.lua"
The main host-lua file will be located in "{Main Game Path}/LuaScriptsLib/main.lua" and is required to run LunaLua.
Note that this isn't released yet. I still have to tweak a bit on that, but what do you think, guys?
Any suggestions to that?
With the new version you can write APIs running parallel to the main code file.
For example here I have 'framecounter.lua' (which counts the frames).
Code: Select all
local framecounter = {}
local myCounter = 0
function framecounter.onInitAPI()
--init vars
myCounter = 0
--register event handler
--registerEvent(string apiName, string internalEventName, string functionToCall, boolean callBeforeMain)
registerEvent("framecounter", "onLoop", "onCountFrame", true)
end
function framecounter.onCountFrame()
myCounter = myCounter + 1
end
function framecounter.getCurrentFrame()
return myCounter
end
return framecounter
And in the main code file I just write:
Code: Select all
function onLoad()
--Load API
loadAPI("framecounter")
end
function onLoop()
printText("Current Frame: "..tostring(framecounter.getCurrentFrame()), 30, 220)
end
Also the new shared API folder is located in "{Main Game Path}/LuaScriptsLib/" containing all API files. Like: "{Main Game Path}/LuaScriptsLib/framecounter.lua"
The main host-lua file will be located in "{Main Game Path}/LuaScriptsLib/main.lua" and is required to run LunaLua.
Note that this isn't released yet. I still have to tweak a bit on that, but what do you think, guys?
Any suggestions to that?
-
Rixithechao
- https://www.youtube.com/watch?v=IwLdM6ejGAM
- Posts: 1608
- Joined: 8 years ago
- First name: Mack
- https://rixithechao.talkhaus.com/
Re: Presenting: Lunadll for Lua!
Oooh, nice timing, I was just about to ask! (began writing this post like a couple hours ago...)
Sounds good for the most part. The only things I can think to add would be registerEventBefore and registerEventAfter functions for readability. But that's just nitpicking, really.
Sounds good for the most part. The only things I can think to add would be registerEventBefore and registerEventAfter functions for readability. But that's just nitpicking, really.
Delightful Adventure Enhanced is out now!

There's an official ASMT Discord server! Check it out to follow and/or contribute to A2XT Episode 2's 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)

There's an official ASMT Discord server! Check it out to follow and/or contribute to A2XT Episode 2's 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)
Re: Presenting: Lunadll for Lua!
It should be warned that this is not suitable for all APIs (if it is what I think it is). Parallel processing can be very awkward, so if you need a lot of communication aside from just updating, then it might be best to avoid it.





Re: Presenting: Lunadll for Lua!
Of course it isn't directly "parallel".
The event loop is going like that:
Anyways, I also implemented a stack trace for errors. Can be useful at some point.
The event loop is going like that:
- Lunadll passes the event to main.lua
- main.lua checks for APIs registered the given event before the main event function and calls them
- Now the main event function is called
- main.lua checks for APIs registered the given event after the main event function and calls them
- Do the same things with the other events.
Good point, actually it would clean up the arguments a bit. I probably take over that.Rockythechao wrote:Oooh, nice timing, I was just about to ask! (began writing this post like a couple hours ago...)
Sounds good for the most part. The only things I can think to add would be registerEventBefore and registerEventAfter functions for readability. But that's just nitpicking, really.
Anyways, I also implemented a stack trace for errors. Can be useful at some point.
Re: Presenting: Lunadll for Lua!
Ah, I see. That makes a lot more sense and is super useful! Can I ask, though, is there a way to determine (or define) the order in which the APIs will be run, with respect to the main thread and the other APIs? It could potentially be important to be able to tweak this.Kevsoft wrote:Of course it isn't directly "parallel".





Re: Presenting: Lunadll for Lua!
Well like I already you can register your function before or after the main call. The api calls are orderd like the registeration order. So if the api is the first, which register its functions it gets the first event call in the event loop.
Re: Presenting: Lunadll for Lua!
Big update to v0.3.
Basically this update adds the new "Custom API"-Support. The wiki is already up to date with all necessary data.
I would love to see cinematX working with this new API. It makes probably some tasks for the user way easier. Also I would like to add it as a offical API when it is working together properly.
Basically this update adds the new "Custom API"-Support. The wiki is already up to date with all necessary data.
I would love to see cinematX working with this new API. It makes probably some tasks for the user way easier. Also I would like to add it as a offical API when it is working together properly.
Re: Presenting: Lunadll for Lua!
I'll update my trigger and shop APIs with it too, when I get the chance.Kevsoft wrote:Big update to v0.3.
Basically this update adds the new "Custom API"-Support. The wiki is already up to date with all necessary data.
I would love to see cinematX working with this new API. It makes probably some tasks for the user way easier. Also I would like to add it as a offical API when it is working together properly.





-
Rixithechao
- https://www.youtube.com/watch?v=IwLdM6ejGAM
- Posts: 1608
- Joined: 8 years ago
- First name: Mack
- https://rixithechao.talkhaus.com/
Re: Presenting: Lunadll for Lua!
Today is officially an awesome day.
I'll have cinematX working with the new API system sometime this weekend. For now, I finally have all of the NPC constants ready to copy & paste into LunaLuaMain.cpp.
And here's just the constant names for the documentation (could probably just go in a separate page like the player raw variables):
I'll have cinematX working with the new API system sometime this weekend. For now, I finally have all of the NPC constants ready to copy & paste into LunaLuaMain.cpp.
Last edited by Rixithechao 8 years ago, edited 1 time in total.
Delightful Adventure Enhanced is out now!

There's an official ASMT Discord server! Check it out to follow and/or contribute to A2XT Episode 2's 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)

There's an official ASMT Discord server! Check it out to follow and/or contribute to A2XT Episode 2's 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)
Re: Presenting: Lunadll for Lua!
I just fixed a small error in uservar.lua. I just overwrote the pack, no need to make a own version of it
.
Also I nearly completed the documentary of the current version. The only thing which is missing are the constants.
Also I nearly completed the documentary of the current version. The only thing which is missing are the constants.
