Need help with lua? - LunaLua General Help

This is the place for discussion and support for LunaLua and related modifications and libraries.

Moderator: Userbase Moderators

Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?
PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Wed Aug 24, 2016 6:29 pm

It isn't, no. What are you trying to do?

Nessquik
Shy Guy
Shy Guy
Posts: 6
Joined: Sun Jun 22, 2014 12:00 am

Re: Need help with lua? - LunaLua General Help

Postby Nessquik » Wed Aug 24, 2016 6:34 pm

PixelPest wrote:It isn't, no. What are you trying to do?
I'm mostly experimenting with the OpenGL drawing functionality, as I recently discovered it in the documentation. I just want to use a capturebuffer as a texture, but that line right there causes an error, even if it's the only line in the whole lua file.

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Wed Aug 24, 2016 6:37 pm

Nessquik wrote:
PixelPest wrote:It isn't, no. What are you trying to do?
I'm mostly experimenting with the OpenGL drawing functionality, as I recently discovered it in the documentation. I just want to use a capturebuffer as a texture, but that line right there causes an error, even if it's the only line in the whole lua file.
What do you mean a "capturebuffer"? Like, are you trying to get the screen as a Lua Image Resource or something?

Nessquik
Shy Guy
Shy Guy
Posts: 6
Joined: Sun Jun 22, 2014 12:00 am

Re: Need help with lua? - LunaLua General Help

Postby Nessquik » Wed Aug 24, 2016 6:39 pm

PixelPest wrote:
Nessquik wrote:
PixelPest wrote:It isn't, no. What are you trying to do?
I'm mostly experimenting with the OpenGL drawing functionality, as I recently discovered it in the documentation. I just want to use a capturebuffer as a texture, but that line right there causes an error, even if it's the only line in the whole lua file.
What do you mean a "capturebuffer"? Like, are you trying to get the screen as a Lua Image Resource or something?
Yes, but the constructor of the capturebuffer object, Graphics.CaptureBuffer(int width, int height), keeps throwing the error I posted.

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9890
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Need help with lua? - LunaLua General Help

Postby Emral » Wed Aug 24, 2016 6:41 pm

Nessquik wrote:
PixelPest wrote:It isn't, no. What are you trying to do?
I'm mostly experimenting with the OpenGL drawing functionality, as I recently discovered it in the documentation. I just want to use a capturebuffer as a texture, but that line right there causes an error, even if it's the only line in the whole lua file.
The version of lunalua you're using doesn't have the capture buffer yet. It was added recently, though I don't know if it's available to the public yet.

Nessquik
Shy Guy
Shy Guy
Posts: 6
Joined: Sun Jun 22, 2014 12:00 am

Re: Need help with lua? - LunaLua General Help

Postby Nessquik » Wed Aug 24, 2016 6:43 pm

Oh, okay then. Thanks for clearing that up for me.

DeMuZ
Fighter Fly
Fighter Fly
Posts: 37
Joined: Thu Aug 18, 2016 2:35 pm

Re: Need help with lua? - LunaLua General Help

Postby DeMuZ » Wed Aug 24, 2016 6:44 pm

<There was a post here. But it wants to be deleted. I don't know how to/can't delete it.>
Last edited by DeMuZ on Sat Aug 27, 2016 12:53 pm, edited 3 times in total.

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9890
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Need help with lua? - LunaLua General Help

Postby Emral » Wed Aug 24, 2016 6:54 pm

Nessquik wrote:Oh, okay then. Thanks for clearing that up for me.
Just asked around. The Nightly Build actually does have the capture buffer: http://wohlsoft.ru/LunaLua/

You can initialise it like you did before and then do:
captureBuffer:captureAt(priority)
to capture the frame at the given priority and all priorities below that.
This can then be used in a draw call.

DeMuZ
Fighter Fly
Fighter Fly
Posts: 37
Joined: Thu Aug 18, 2016 2:35 pm

Re: Need help with lua? - LunaLua General Help

Postby DeMuZ » Sat Aug 27, 2016 12:55 pm

Hello, I need a little help again. My custom API always sets data to 1 at the start of levels. Help! ;-;

Code: Select all

local demuz_hp_system = {}
local hurt = 0
local time = 100
local max_hp = 1000

local encrypt = loadSharedAPI("encrypt")
hpData = encrypt.Data(Data.DATA_WORLD,true)

---------------------------------------------------------------------------------
function demuz_hp_system.onInitAPI()
	registerEvent(demuz_hp_system,"onStart","onStart")
	registerEvent(demuz_hp_system,"onTick","showHP")
	registerEvent(demuz_hp_system,"onNPCKill","onNPCKill")
	registerEvent(demuz_hp_system,"onEvent","onEvent")
	registerEvent(demuz_hp_system,"onExitLevel","onExitLevel")
end

---------------------------------------------------------------------------------
function demuz_hp_system.onEvent(name)
	if name == "checkpoint" and hpData:get("hp") < max_hp and time == 0 then
		hpData:set("hp",hpData:get("hp")+1)
		hpData:save()
	end
	
end

---------------------------------------------------------------------------------
function demuz_hp_system.setAmmount(value)
	if value > 0 then
		max_hp = value
	end
end

function demuz_hp_system.onStart()
	if hpData:get("hp") == nil or hpData:get("hp") == 0 then
		hpData:set("hp",1)
		hpData:save()
	end
end

---------------------------------------------------------------------------------
function demuz_hp_system.onNPCKill(eventObj, npcObj, npcKillReason)
	if hpData:get("hp") < max_hp and npcObj.id == 9 and npcKillReason == 9 then
		hpData:set("hp", hpData:get("hp")+1)
		hpData:save()
	end
end

---------------------------------------------------------------------------------
function demuz_hp_system.showHP()
	Text.print("HP:",0,48)
	Text.print(hpData:get("hp"),64,48)
	
	if time > 0 then
		time = time - 1
	end
	
	if player.powerup == PLAYER_HAMMER then
		player.powerup = PLAYER_BIG
	end

	if player:mem(0x158, FIELD_WORD) == 9 then
		player:mem(0x158, FIELD_WORD,0)
	end
	
	if player:mem(0x13E, FIELD_WORD) > 0 and hurt == 0 then
		hpData:set("hp",0)
		hpData:save()
	end
	
	if hurt == 0 then
		if player:mem(0x122, FIELD_WORD) == 2 then
			hpData:set("hp", hpData:get("hp")-1)
			hpData:save()
			hurt = 1
		end
	end
	
	if player:mem(0x122, FIELD_WORD) ~= 2 and hurt > 0 then
		hurt = 0
	end
	
	if  hpData:get("hp") > 1 and player.powerup == PLAYER_SMALL then
		player.powerup = PLAYER_BIG
		player:mem(0x122,FIELD_WORD,12)
	end
end

---------------------------------------------------------------------------------
function demuz_hp_system.onExitLevel()
	hpData:save()
end

---------------------------------------------------------------------------------
return demuz_hp_system
Problem solved. Yoshi021, thank you! :)

LM280
Monty Mole
Monty Mole
Posts: 121
Joined: Wed Jan 15, 2014 7:10 pm

Re: Need help with lua? - LunaLua General Help

Postby LM280 » Tue Aug 30, 2016 11:58 am

This was probably answered already, but is there some way to convert lunadll code you've already made to lunalua?

Hoeloe
Phanto
Phanto
Posts: 1465
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: Need help with lua? - LunaLua General Help

Postby Hoeloe » Tue Aug 30, 2016 3:00 pm

Luigimario280 wrote:This was probably answered already, but is there some way to convert lunadll code you've already made to lunalua?
http://wohlsoft.ru/pgewiki/How_To:_Autocode_to_LunaLua

LM280
Monty Mole
Monty Mole
Posts: 121
Joined: Wed Jan 15, 2014 7:10 pm

Re: Need help with lua? - LunaLua General Help

Postby LM280 » Thu Sep 01, 2016 10:16 pm

How can I trigger code to run when the player dies? When I tried it both player mem 0x13C and 0x13E didn't change from 0 when I died.

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Fri Sep 02, 2016 7:12 am

Luigimario280 wrote:How can I trigger code to run when the player dies? When I tried it both player mem 0x13C and 0x13E didn't change from 0 when I died.
0x13E counts up from 0 to 150 when the player dies. So you would check if player:mem(0x13E, FIELD_WORD) > 0

World Star 9
Swooper
Swooper
Posts: 63
Joined: Wed Jun 29, 2016 12:52 am

Re: Need help with lua? - LunaLua General Help

Postby World Star 9 » Sun Sep 04, 2016 8:38 am

I finally got the software that everyone else seems to have! I have a problem though, whenever I click on "smbx" it says "Windows protected your PC". Is Lua dangerous? Please help!

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Sun Sep 04, 2016 8:42 am

It's not dangerous. I think AntiVirus scans just sometimes detect a few of the .dll files as suspicious. If your AntiVirus is acting over-protective just turn it down a bit, off, or if you can access advanced settings, you might be able to tell it for a bit to just not scan certain file types

World Star 9
Swooper
Swooper
Posts: 63
Joined: Wed Jun 29, 2016 12:52 am

Re: Need help with lua? - LunaLua General Help

Postby World Star 9 » Sun Sep 04, 2016 8:55 am

Thanks! I sadly don't know how to turn off AntiVirus

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Sun Sep 04, 2016 8:58 am

World Star 9 wrote:Thanks! I sadly don't know how to turn off AntiVirus
https://www.bing.com/search?q=how+to+tu ... 730ABB911B

World Star 9
Swooper
Swooper
Posts: 63
Joined: Wed Jun 29, 2016 12:52 am

Re: Need help with lua? - LunaLua General Help

Postby World Star 9 » Mon Sep 05, 2016 8:08 am

Turns out I have a different problem, it says something about Windows Smartscreen blocking the application.
Please help!

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Mon Sep 05, 2016 8:11 am

World Star 9 wrote:Turns out I have a different problem, it says something about Windows Smartscreen blocking the application.
Please help!
Why aren't you just doing a quick Internet search? I literally typed in "windows smartscreen" and this is the first thing that came up and it has your answer I'm pretty sure: https://support.microsoft.com/en-us/hel ... filter-faq

World Star 9
Swooper
Swooper
Posts: 63
Joined: Wed Jun 29, 2016 12:52 am

Re: Need help with lua? - LunaLua General Help

Postby World Star 9 » Mon Sep 05, 2016 8:34 am

Thank You! Although my computer says MSVCP140.dll and VCRUNTIME140.dll are missing in order to run the software.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 3 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari