mario fan games galaxyirc.cat.biopge project

happy birthday talkhaus!!!!

LunaDLL/LunaLUA help thread

The second SMBX collab!
User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 2 years ago

Re: LunaDLL/LunaLUA help thread

Postby Kevsoft » 1 year ago

Try to remove the "

Code: Select all

 cinematX.configExt ({hudBox=false, overrideNpcText=true, imageUi=false, textbloxSub=true}) 

User avatar
Karatekid5
Welcome to the resort!
Posts: 33
Joined: 7 years ago
Location: Pennsylvania
Contact:

Re: LunaDLL/LunaLUA help thread

Postby Karatekid5 » 1 year ago

I tried removing the quotation marks and I ended up getting another error. Also, I do want to set a few things so removing the config line wouldn't be an option.
Attachments
lunaerror2.png
lunaerror2.png (5.12 KiB) Viewed 1103 times
Yoshi Ambassador!
Image

User avatar
WasabiJellyfish
Posts: 117
Joined: 2 years ago

Re: LunaDLL/LunaLUA help thread

Postby WasabiJellyfish » 1 year ago

Okay what you have there is the basic true false thing that is prepackaged anyway but okay. Did you get rid of the cinematX before .configExt? Idk why that would happen otherwise

User avatar
Karatekid5
Welcome to the resort!
Posts: 33
Joined: 7 years ago
Location: Pennsylvania
Contact:

Re: LunaDLL/LunaLUA help thread

Postby Karatekid5 » 1 year ago

I just tried that but I got the same error.
Yoshi Ambassador!
Image

User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 2 years ago

Re: LunaDLL/LunaLUA help thread

Postby Kevsoft » 1 year ago

The error says that the function does not exists. Either you have typo or a too old version of cinematX.

User avatar
Karatekid5
Welcome to the resort!
Posts: 33
Joined: 7 years ago
Location: Pennsylvania
Contact:

Re: LunaDLL/LunaLUA help thread

Postby Karatekid5 » 1 year ago

I update my copy of LunaLUA whenever an update is released, but I redownloaded/installed the most recent version just in case. I tried it out and still got the same error.

For reference, here's the current code:

Code: Select all

cinematX = loadSharedAPI("cinematX")

cinematX.configExt ({hudBox=false, overrideNpcText=true, imageUi=false, textbloxSub=true})

function scene_1 ()
    cinematX.startDialogExt (bellossom1, Bellossom, "Hello there! Welcome to the Starlight Resort!")
  cinematX.waitForDialog()
end
Yoshi Ambassador!
Image

User avatar
Rockythechao
Shapemorph the titlecard into the video, Hoeloe
Posts: 479
Joined: 3 years ago
First name: Michael
Pronouns: he/him/his
Location: Yes

Re: LunaDLL/LunaLUA help thread

Postby Rockythechao » 1 year ago

Are you using the latest version of cinematX from the github repo (0.0.8l5) or the latest stable/devkit version (0.0.7)?
0.0.7 didn't have configExt () along with a ton of other features I've been adding to simplify things.
I am fairly involved in A2XT's development as a content creator, wiki contributor and programmer, but I am not the project lead nor am I responsible for half the things people keep attributing to me lol

Useful posts, discussions & resources for SMBX and A2XT

My art & audio thread
Tumblr, SoundCloud

Image

User avatar
Karatekid5
Welcome to the resort!
Posts: 33
Joined: 7 years ago
Location: Pennsylvania
Contact:

Re: LunaDLL/LunaLUA help thread

Postby Karatekid5 » 1 year ago

Ah, that must be the problem! I have the latest devkit version but not the github repo version. Where can I download that version of CinematX?

EDIT: I found the Github link and installed that version, so the error disappeared!

Though, I've run into some new problems. When trying to play my level I got this odd error that mentions the Multipoints LUA file. After this error, my level's LUA won't run either.

EDIT 2: Actually, it seems like this problem isn't specific to my level, as I get this error when I try to load any level using LUA but not using multipoints.
Attachments
multipoints.png
multipoints.png (13.57 KiB) Viewed 1280 times
Yoshi Ambassador!
Image

User avatar
7NameSam
hey
Posts: 217
Joined: 2 years ago
Pronouns: he/him/his

Re: LunaDLL/LunaLUA help thread

Postby 7NameSam » 1 year ago

How do you use a PNG? I want to use one to make the screen darker in a section.
Image

User avatar
Hoeloe
One of them Lua people
Posts: 826
Joined: 5 years ago
Location: Spaaace

Re: LunaDLL/LunaLUA help thread

Postby Hoeloe » 1 year ago

Karatekid5 wrote: EDIT 2: Actually, it seems like this problem isn't specific to my level, as I get this error when I try to load any level using LUA but not using multipoints.
I think I may know what the problem is.

Could you find your multipoints.lua file in the LuaScriptsLib folder and check the version number? If it's not 3.0.11, then you'll need to download the newest version from the wiki.
Image
Image
Image
Image

User avatar
Karatekid5
Welcome to the resort!
Posts: 33
Joined: 7 years ago
Location: Pennsylvania
Contact:

Re: LunaDLL/LunaLUA help thread

Postby Karatekid5 » 1 year ago

Hoeloe wrote:I think I may know what the problem is.

Could you find your multipoints.lua file in the LuaScriptsLib folder and check the version number? If it's not 3.0.11, then you'll need to download the newest version from the wiki.
There we go, that fixed it! ^_^ (I had version 3.0.6)

So, going back to CinematX, the NPC gives me the "press up to talk" message at the bottom of the screen when touching them, but pressing up does nothing.

The code is in an earlier post, and here are the NPC tags:

Code: Select all

{key=bellossom1, name=Bellossom, routine=function_scene1}
Yoshi Ambassador!
Image

User avatar
Holy
Posts: 92
Joined: 6 years ago

Re: LunaDLL/LunaLUA help thread

Postby Holy » 1 year ago

So I'm trying to save a number to the local data, and then I want to get that number back next time and add it to another number. But Mr. Lua keeps telling me I'm trying to add a string, and I've tried a buncha stuff but none of it seems to work. HELP MEEEEEE

edit: yeah no matter how many ways I shove it in tonumber() don't work none.

User avatar
Wohlstand
PGE and LunaLUA developer
Posts: 153
Joined: 3 years ago

Re: LunaDLL/LunaLUA help thread

Postby Wohlstand » 1 year ago

7NameSam wrote:How do you use a PNG? I want to use one to make the screen darker in a section.
For this case you don't need for PNG BGO's, you can apply fader library and set black screen with half alpha-channel. However you still can make some foreground BGO with semitransparency and save it into PNG format (LunaLUA-SMBX supports mask-less true-transparency PNG images)

User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 2 years ago

Re: LunaDLL/LunaLUA help thread

Postby Kevsoft » 1 year ago

Holy wrote:So I'm trying to save a number to the local data, and then I want to get that number back next time and add it to another number. But Mr. Lua keeps telling me I'm trying to add a string, and I've tried a buncha stuff but none of it seems to work. HELP MEEEEEE

edit: yeah no matter how many ways I shove it in tonumber() don't work none.
Could you paste the code, which throws the error?

User avatar
gameguy888
Man, I dunno.
Posts: 17
Joined: 2 years ago
Contact:

Re: LunaDLL/LunaLUA help thread

Postby gameguy888 » 1 year ago

Is there a way to trigger some code every time the player collects a powerup (even if they're already fully powered and it would thus "do nothing")?
Words go here sometimes.

User avatar
Duker
The man with the fairy
Posts: 50
Joined: 7 years ago
Location: The Cold North

Re: LunaDLL/LunaLUA help thread

Postby Duker » 1 year ago

gameguy888 wrote:Is there a way to trigger some code every time the player collects a powerup (even if they're already fully powered and it would thus "do nothing")?
You could probably use onNPCKill for that, I'll try it out once I get home from work.

Right-o, I probably overcomplicated it but it seems to work at least:

Code: Select all

local Cam
function onLoad()
	Cam = Camera.get()[1]
end

function onNPCKill(eventObj, killedNPC, killReason)
	--killreason 9 = "Despawn or NPC eaten (ie powerups) = Vanish"
	if (killReason == 9) then
		--Check if the NPC is on screen, otherwise it must have despawned
		if(killedNPC.x > Cam.x 
			and killedNPC.x < Cam.x+Cam.width 
			and killedNPC.y > Cam.y 
			and killedNPC.y < Cam.y+Cam.height) 
		then 
			--[[Code to run here]]
		end
	end
end
You might want to check the ID of the killedNPC too as 1-ups also "die" the same way as actual power-ups.
Occasionally I bring chipmunkcow into the mortal timespace: https://www.youtube.com/playlist?list=P ... D-ruRHC4ei

User avatar
Rednaxela
Maker of Shenanigans
Posts: 659
Joined: 3 years ago

Re: LunaDLL/LunaLUA help thread

Postby Rednaxela » 1 year ago

Duker wrote:
gameguy888 wrote:Is there a way to trigger some code every time the player collects a powerup (even if they're already fully powered and it would thus "do nothing")?
You could probably use onNPCKill for that, I'll try it out once I get home from work.

Right-o, I probably overcomplicated it but it seems to work at least:

Code: Select all

local Cam
function onLoad()
	Cam = Camera.get()[1]
end

function onNPCKill(eventObj, killedNPC, killReason)
	--killreason 9 = "Despawn or NPC eaten (ie powerups) = Vanish"
	if (killReason == 9) then
		--Check if the NPC is on screen, otherwise it must have despawned
		if(killedNPC.x > Cam.x 
			and killedNPC.x < Cam.x+Cam.width 
			and killedNPC.y > Cam.y 
			and killedNPC.y < Cam.y+Cam.height) 
		then 
			--[[Code to run here]]
		end
	end
end
You might want to check the ID of the killedNPC too as 1-ups also "die" the same way as actual power-ups.[/spoiler]
Less complicated and would probably work would be:

Code: Select all

function onNPCKill(eventObj, killedNPC, killReason)
   --killreason 9 = "Despawn or NPC eaten (ie powerups) = Vanish"
   if (killReason == 9) then
      --Check if the NPC is on screen, otherwise it must have despawned
      if killedNPC:mem(0x12A, FIELD_WORD) > 0 then
         --[[Code to run here]]
      end
   end
end
Don't need to be checking it's location, and that code you have to check that is slightly incorrect anyway due to the effect of height/width. Besides, at offset 0x12A there's a despawn countdown. Just check that hasn't triggered.

As a note, onNPCKill only works with very new versions of LunaLua.
Currently LPing: Ys Origin

User avatar
Duker
The man with the fairy
Posts: 50
Joined: 7 years ago
Location: The Cold North

Re: LunaDLL/LunaLUA help thread

Postby Duker » 1 year ago

Rednaxela wrote:
Duker wrote:
gameguy888 wrote:Is there a way to trigger some code every time the player collects a powerup (even if they're already fully powered and it would thus "do nothing")?
You could probably use onNPCKill for that, I'll try it out once I get home from work.

Right-o, I probably overcomplicated it but it seems to work at least:

Code: Select all

local Cam
function onLoad()
	Cam = Camera.get()[1]
end

function onNPCKill(eventObj, killedNPC, killReason)
	--killreason 9 = "Despawn or NPC eaten (ie powerups) = Vanish"
	if (killReason == 9) then
		--Check if the NPC is on screen, otherwise it must have despawned
		if(killedNPC.x > Cam.x 
			and killedNPC.x < Cam.x+Cam.width 
			and killedNPC.y > Cam.y 
			and killedNPC.y < Cam.y+Cam.height) 
		then 
			--[[Code to run here]]
		end
	end
end
You might want to check the ID of the killedNPC too as 1-ups also "die" the same way as actual power-ups.[/spoiler]
Less complicated and would probably work would be:

Code: Select all

function onNPCKill(eventObj, killedNPC, killReason)
   --killreason 9 = "Despawn or NPC eaten (ie powerups) = Vanish"
   if (killReason == 9) then
      --Check if the NPC is on screen, otherwise it must have despawned
      if killedNPC:mem(0x12A, FIELD_WORD) > 0 then
         --[[Code to run here]]
      end
   end
end
Don't need to be checking it's location, and that code you have to check that is slightly incorrect anyway due to the effect of height/width. Besides, at offset 0x12A there's a despawn countdown. Just check that hasn't triggered.

As a note, onNPCKill only works with very new versions of LunaLua.
It's new enough in the current devkit, though I did download it decently recently so worth checking yeah.

Anyway, that is absolutely better (forgot to check mem offsets for relevant stuff) but for whatever reason enemies falling out of the level (but not powerups) gets through that check. Easily solved with an ID check though so it's still the better solution.

Curious though, what part of it is incorrect? What exactly do you mean with "the effect of height/width"? Just trying to learn from my mistakes.
Last edited by Duker on 04 Dec 2015, 21:32, edited 1 time in total.
Occasionally I bring chipmunkcow into the mortal timespace: https://www.youtube.com/playlist?list=P ... D-ruRHC4ei

User avatar
Holy
Posts: 92
Joined: 6 years ago

Re: LunaDLL/LunaLUA help thread

Postby Holy » 1 year ago

Kevsoft wrote:
Holy wrote:So I'm trying to save a number to the local data, and then I want to get that number back next time and add it to another number. But Mr. Lua keeps telling me I'm trying to add a string, and I've tried a buncha stuff but none of it seems to work. HELP MEEEEEE

edit: yeah no matter how many ways I shove it in tonumber() don't work none.
Could you paste the code, which throws the error?
Here's the relevant parts, I think

Code: Select all

local myLevelData = Data(Data.DATA_LEVEL, "myData")
coinCounted = 0
coinCounted2 = 0
coinAdd = 0

function onEvent(eventname)
	if eventname == "logFirst" then
		myLevelData:set("coyn",tostring(coinCount))
		myLevelData:save()
	end
end

function onLoadSection3()
	coinCounted = myLevelData:get("coyn");
end

function onLoopSection3()
	coinAdd = coinCounted2 + tonumber(coinCounted)
	Text.print(coinAdd,200,360)
end

User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 2 years ago

Re: LunaDLL/LunaLUA help thread

Postby Kevsoft » 1 year ago

Could you also copy the error or make a screenshot of it? Currently this code seems to be right, so the error message and especially the line number, where the error happend is important.

User avatar
Hoeloe
One of them Lua people
Posts: 826
Joined: 5 years ago
Location: Spaaace

Re: LunaDLL/LunaLUA help thread

Postby Hoeloe » 1 year ago

Holy wrote:

Code: Select all

tostring(coinCount)
Is that supposed to be countCounted? Because if it is, that would mean you're storing "nil" in the data class, and it's failing when trying to convert it back to a number.
Image
Image
Image
Image

User avatar
Holy
Posts: 92
Joined: 6 years ago

Re: LunaDLL/LunaLUA help thread

Postby Holy » 1 year ago

coinCount's a diff variable, from another part of the code. Anyway, it works now for some reason!! I think all my manual messing with the savefile was screwing with it or something.

User avatar
Karatekid5
Welcome to the resort!
Posts: 33
Joined: 7 years ago
Location: Pennsylvania
Contact:

Re: LunaDLL/LunaLUA help thread

Postby Karatekid5 » 1 year ago

An update on the CinematX issue I was having earlier, I tried a few things with the NPC's tags, and seems like the key was changing the NPC's routine tag to "routine=function scene_1". Now, when I press up to talk to the NPC, it seems to be running some code now, but instead of the intended message I just get this error. My LunaLUA is the most recent version and my version of CinematX is the most recent Github version.
Attachments
cinematxerror.png
cinematxerror.png (13.87 KiB) Viewed 1122 times
Yoshi Ambassador!
Image

User avatar
Rockythechao
Shapemorph the titlecard into the video, Hoeloe
Posts: 479
Joined: 3 years ago
First name: Michael
Pronouns: he/him/his
Location: Yes

Re: LunaDLL/LunaLUA help thread

Postby Rockythechao » 1 year ago

It should be just the name of the function, so routine=scene_1, though if you want it to play as a cutscene, I suggest using scene=scene_1 instead.
I am fairly involved in A2XT's development as a content creator, wiki contributor and programmer, but I am not the project lead nor am I responsible for half the things people keep attributing to me lol

Useful posts, discussions & resources for SMBX and A2XT

My art & audio thread
Tumblr, SoundCloud

Image

User avatar
7NameSam
hey
Posts: 217
Joined: 2 years ago
Pronouns: he/him/his

Re: LunaDLL/LunaLUA help thread

Postby 7NameSam » 1 year ago

Wohlstand wrote:
7NameSam wrote:How do you use a PNG? I want to use one to make the screen darker in a section.
For this case you don't need for PNG BGO's, you can apply fader library and set black screen with half alpha-channel. However you still can make some foreground BGO with semitransparency and save it into PNG format (LunaLUA-SMBX supports mask-less true-transparency PNG images)
I'm sorry, but I'm unfamiliar with Fader Libraries, and google doesn't give me any good results.
Image


Return to “A2XT”

Who is online

Users browsing this forum: No registered users and 1 guest

cron