Error in Library file

Post here for help and support regarding LunaLua and SMBX2's libraries and features.
mariobrigade2018
Ripper II
Ripper II
Posts: 320
Joined: Wed May 24, 2023 7:00 pm
Flair: Normie in coding who dreams of making a Mario game
Pronouns: he/him

Error in Library file

Postby mariobrigade2018 » Fri Nov 03, 2023 12:09 pm

I found an old post that made the boomerang flower before libraries were a thing. I am trying to turn it into a library, but I am getting this error:



Image

This is the code:

Code: Select all

local allBoomerang = {}

function allBoomerang.onInitAPI()
	registerEvents(allBoomerang, "onTick")
end

local BoomerangLock = 0

function allBoomerang.onTick()
	if player.powerup == PLAYER_HAMMER then
		if player.character == CHARACTER_MARIO or CHARACTER_LUIGI then
			if BoomerangLock == 0 then
				if(player.runKeyPressing) then
					for k,v in pairs(NPC.get(171,-1)) do
						v.id = 292
						v.width = 32
						v.height = 32
						v:mem(0x110,FIELD_DFLOAT,1)
						if BoomerangLock == 0 then
							if player:mem(0x106,FIELD_WORD) ~= -1 then
								BoomerangLock = 1
								v.x = v.x + 2
								v.speedX = 25
								v.speedY = -10
							else
								v.x = v.x - 2
								v.speedX = -25
								v.speedY = -10
								BoomerangLock = 1
							end
						end
					end
				end
			else
				local BoomerangCheck = NPC.get(292,-1)
				if table.getn(BoomerangCheck) == 0 then
					BoomerangLock = 0
				else
					player:mem(0x160,FIELD_WORD,2)
				end
			end
		end
	end
end

return allBoomerang
And this is the original post:
viewtopic.php?t=18010&hilit=Boomerang

Hope this helps.

Edit: It looks like a typo threw me off. It's

Code: Select all

register[b]Event[/b](allBoomerang, "onTick")
not

Code: Select all

register[b]Events[/b](allBoomerang, "onTick")
.

Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari