Re: LunaLua Offical Thread [Streaming Question Poll]
Posted: Mon Aug 03, 2015 9:49 pm
Text.print not printText
Forums for SMBX
https://www.smbxgame.com/forums/
I have no idea why it won't Work!XerX wrote:Text.print not printText
Code: Select all
function onLoop()
--if player is holding glow
if(player.holdingNPC == 158) then
Text.print("Glow: Put me Down!", 0, 0)
end
end
This is actually right.cramps-man wrote:So as you can see in the documentation here: http://engine.wohlnet.ru/pgewiki/Player_%28class%29
The "player.holdingNPC" returns the NPC class. And as you can see in the NPC class documentation here: http://engine.wohlnet.ru/pgewiki/NPC_%28class%29
To get the NPC id, you will need to type,
if (player.holdingNPC.id == 158) then
/* blah code here */
Code: Select all
local player = Player();
function onLoop()
if(player.holdingNPC ~= nil) then
if(player.holdingNPC.id == 158) then
Text.print("Put me down!",0,0);
end
end
end
Which could be simplified toXerX wrote:Code: Select all
local player = Player(); function onLoop() if(player.holdingNPC ~= nil) then if(player.holdingNPC.id == 158) then Text.print("Put me down!",0,0); end end end
Code: Select all
function onLoop()
if(player.holdingNPC) then
if(player.holdingNPC.id == 158) then
Text.print("Put me down!",0,0);
end
end
end
That render bug has been fixed. Wait for the next LunaLua version, which will come up soon.HenryRichard wrote:Which could be simplified toXerX wrote:Code: Select all
local player = Player(); function onLoop() if(player.holdingNPC ~= nil) then if(player.holdingNPC.id == 158) then Text.print("Put me down!",0,0); end end end
Also, I found a bug with the OpenGL rendering - a level that looked perfectly fine before now looks like thisCode: Select all
function onLoop() if(player.holdingNPC) then if(player.holdingNPC.id == 158) then Text.print("Put me down!",0,0); end end end
It's got all these weird lines and lags a TON, whereas with the old rendering it looked fine.
That's good to know. I may have found another bug though - I'm getting an error with Graphics.drawImageToScene because it's apparently a nil value. This is my code:Kevsoft wrote:That render bug has been fixed. Wait for the next LunaLua version, which will come up soon.
Code: Select all
spritesheet = Graphics.loadImage("../spritesheet.png");
function onLoop()
Graphics.drawImageToScene(spritesheet, player.x, player.y, 0, 0, 100, 100);
end
Yes, in fact I was able to make be placed in the level by using Graphics.placeSprite. I just need the extra arguments Graphics.drawImageToScene has.XerX wrote:Is 'spritesheet.png' in the same directory as your code file? (lunadll.lua or lunaworld.lua)
And for those who use my Module Manager, it will update it for youKevsoft wrote:For unreleased versions I add a version number to the description. LunaLua v0.7.1 has not been released yet. Just wait a few days and you will get it in your hands!
...How did I miss that? I should really read the entire description before I try something. Thanks!Kevsoft wrote:For unreleased versions I add a version number to the description. LunaLua v0.7.1 has not been released yet. Just wait a few days and you will get it in your hands!
LunaDll is bundled for backwards compatibility reasons. So yes, you can download this and still run LunaDll's autocode and Luabigpotato wrote:Does this require lunaDLL to work? Or is it included?
I just fixed that and repacked everything, download the "Update only" and extract missed SDL2_mixer_ext.dll into your lunalua directory.HenryRichard wrote:You forgot to include SDL2_mixer_ext.dll, so SMBX doesn't start.