Page 33 of 76

Re: Need help with lua? - LunaLua General Help

Posted: Wed Aug 24, 2016 6:29 pm
by PixelPest
It isn't, no. What are you trying to do?

Re: Need help with lua? - LunaLua General Help

Posted: Wed Aug 24, 2016 6:34 pm
by Nessquik
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.

Re: Need help with lua? - LunaLua General Help

Posted: Wed Aug 24, 2016 6:37 pm
by PixelPest
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?

Re: Need help with lua? - LunaLua General Help

Posted: Wed Aug 24, 2016 6:39 pm
by Nessquik
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.

Re: Need help with lua? - LunaLua General Help

Posted: Wed Aug 24, 2016 6:41 pm
by Emral
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.

Re: Need help with lua? - LunaLua General Help

Posted: Wed Aug 24, 2016 6:43 pm
by Nessquik
Oh, okay then. Thanks for clearing that up for me.

Re: Need help with lua? - LunaLua General Help

Posted: Wed Aug 24, 2016 6:44 pm
by DeMuZ
<There was a post here. But it wants to be deleted. I don't know how to/can't delete it.>

Re: Need help with lua? - LunaLua General Help

Posted: Wed Aug 24, 2016 6:54 pm
by Emral
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.

Re: Need help with lua? - LunaLua General Help

Posted: Sat Aug 27, 2016 12:55 pm
by DeMuZ
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! :)

Re: Need help with lua? - LunaLua General Help

Posted: Tue Aug 30, 2016 11:58 am
by LM280
This was probably answered already, but is there some way to convert lunadll code you've already made to lunalua?

Re: Need help with lua? - LunaLua General Help

Posted: Tue Aug 30, 2016 3:00 pm
by Hoeloe
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

Re: Need help with lua? - LunaLua General Help

Posted: Thu Sep 01, 2016 10:16 pm
by LM280
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.

Re: Need help with lua? - LunaLua General Help

Posted: Fri Sep 02, 2016 7:12 am
by PixelPest
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

Re: Need help with lua? - LunaLua General Help

Posted: Sun Sep 04, 2016 8:38 am
by World Star 9
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!

Re: Need help with lua? - LunaLua General Help

Posted: Sun Sep 04, 2016 8:42 am
by PixelPest
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

Re: Need help with lua? - LunaLua General Help

Posted: Sun Sep 04, 2016 8:55 am
by World Star 9
Thanks! I sadly don't know how to turn off AntiVirus

Re: Need help with lua? - LunaLua General Help

Posted: Sun Sep 04, 2016 8:58 am
by PixelPest
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

Re: Need help with lua? - LunaLua General Help

Posted: Mon Sep 05, 2016 8:08 am
by World Star 9
Turns out I have a different problem, it says something about Windows Smartscreen blocking the application.
Please help!

Re: Need help with lua? - LunaLua General Help

Posted: Mon Sep 05, 2016 8:11 am
by PixelPest
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

Re: Need help with lua? - LunaLua General Help

Posted: Mon Sep 05, 2016 8:34 am
by World Star 9
Thank You! Although my computer says MSVCP140.dll and VCRUNTIME140.dll are missing in order to run the software.