Re: Need help with lua? - LunaLua General Help
Posted: Wed Aug 24, 2016 6:29 pm
It isn't, no. What are you trying to do?
Forums for SMBX
https://www.smbxgame.com/forums/
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 wrote:It isn't, no. What are you trying to do?
What do you mean a "capturebuffer"? Like, are you trying to get the screen as a Lua Image Resource or something?Nessquik wrote: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 wrote:It isn't, no. What are you trying to do?
Yes, but the constructor of the capturebuffer object, Graphics.CaptureBuffer(int width, int height), keeps throwing the error I posted.PixelPest wrote:What do you mean a "capturebuffer"? Like, are you trying to get the screen as a Lua Image Resource or something?Nessquik wrote: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 wrote:It isn't, no. What are you trying to do?
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 wrote: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 wrote:It isn't, no. What are you trying to do?
Just asked around. The Nightly Build actually does have the capture buffer: http://wohlsoft.ru/LunaLua/Nessquik wrote:Oh, okay then. Thanks for clearing that up for me.
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
http://wohlsoft.ru/pgewiki/How_To:_Autocode_to_LunaLuaLuigimario280 wrote:This was probably answered already, but is there some way to convert lunadll code you've already made to lunalua?
0x13E counts up from 0 to 150 when the player dies. So you would check if player:mem(0x13E, FIELD_WORD) > 0Luigimario280 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.
https://www.bing.com/search?q=how+to+tu ... 730ABB911BWorld Star 9 wrote:Thanks! I sadly don't know how to turn off AntiVirus
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-faqWorld Star 9 wrote:Turns out I have a different problem, it says something about Windows Smartscreen blocking the application.
Please help!