LunaLua Offical Thread

Description: Archive discussion
============================
Original description:
Official subforum for LunaLua - an extension framework for SMBX Engine Version 1.3 (which a core of SMBX 2.0). Share your creations that require the use of LunaLUA. You may also share info/tutorials on how to use LunaLUA.

Shall I stream some LunaLua live development?

Yes
15
tb1024, h2643, hacheipe399, Wohlstand, cramps-man, Lotus006, wes, Saronin, Super Mario Player, 9th_core, MomsResetti, S.Koopa0, 5438ASPGE71
100%
No
2
Toshiie, 6824
13%
 
Total voters: 15
Kevsoft M
Topic author, Angry developer
Angry developer
Avatar
Kevsoft M
Topic author, Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #61by Kevsoft » 17 Oct 2014, 19:24

Small update to v0.2.7.2

I just made some crash fixes. It shouldn't crash after a error message display anymore. I did made some test with error spamming, and it did crash. But as long you don't overreact with errors, it should be all fine ;)

Added after 6 hours 8 minutes:
Small update to v0.2.7.3

By request by Hoeloe I've moved the lua code, so the userbank is loaded before the onLoad-code.
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

Kevsoft M
Topic author, Angry developer
Angry developer
Avatar
Kevsoft M
Topic author, Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #62by Kevsoft » 23 Oct 2014, 20:23

Big update to v0.3.

Basically this update adds the new "Custom API"-Support. The wiki is already up to date with all necessary data.
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

Kevsoft M
Topic author, Angry developer
Angry developer
Avatar
Kevsoft M
Topic author, Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #63by Kevsoft » 27 Oct 2014, 15:41

LunaLua v0.3.1 is out!
Changes:
Spoiler
*Added Block class
** functions: Block:mem and Block:collidesWith
** fields: x,y,speedX,speedY,id,slippery,invisible

*Added function blocks() (returns all blocks in the level)
*Added function findblocks(int id) (returns all blocks with a specific id)
*Added function npcToCoins() (converts every npc to coins)

Example code with the new LunaLua:

Code: Select all

function onLoop()
   local smb3Box = findblocks(173)[0] --ID of SMW Blue Switch
   if(smb3Box)then
      if(smb3Box:collidesWith(player) == 3)then  --Ultimate Kill switch :D
         npcToCoins()
      end
   end
end


Documentary will be updated soon!
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

Kevsoft M
Topic author, Angry developer
Angry developer
Avatar
Kevsoft M
Topic author, Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #64by Kevsoft » 28 Oct 2014, 22:09

LunaLua v0.3.2 is now out!
Changes:
Spoiler
*Added VBStr Class
*Added several fields which access text (NPC Msg, NPC Layer Names, NPC Events)

Example, as usual:

Code: Select all

function onLoop()
   local myFriendlyNPC = findnpcs(1,player.section)[0]
   if(myFriendlyNPC)then
      printText("\""..myFriendlyNPC.msg.str.."\"",4,30,140)
   end
end


Documentary will be updated soon!
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

Kevsoft M
Topic author, Angry developer
Angry developer
Avatar
Kevsoft M
Topic author, Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #65by Kevsoft » 30 Oct 2014, 12:41

LunaLua v0.3.3 is out!

Changes:
Spoiler
*Added new class Layer (speedX, speedY, layerName and stop-function)
*Added better layer access from NPC and Block by returning now a Layer Object.

Example:

Code: Select all

i = 0
run = true
function onLoop()
   i = i + 1
   local myLayer = findlayer("MyLayer")
   if(myLayer)then
      printText(myLayer.layerName.str, 30, 200)
      if(i % 100 == 1)then
         run = not run
      end
      if(run)then
         myLayer.speedX = -1
      else
         myLayer:stop()
      end
   end
end

(requires a layer "MyLayer" added with some blocks :P)

Documentary will be updated soon!
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

Kevsoft M
Topic author, Angry developer
Angry developer
Avatar
Kevsoft M
Topic author, Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #66by Kevsoft » 1 Nov 2014, 17:08

LunaLua v0.3.4 is out!
Changes:
Spoiler
*Added the function exitLevel()
*Added getter and setter function winState()
*Added Animation class (I know it's called effect in SMBX but I got used to it)
*Added the function runAnimation(...) to run a SMBX Effect.

Example:

Code: Select all

function isCrabDead() return findnpcs(209, -1)[0] == nil end

function onLoop()
   if not isCrabDead() then return end
   local myBlocks = blocks()
   local plScreen = player.screen
   local k = 0
   for _,v in pairs(myBlocks) do
      k = k + 1
      local curX = v.x
      local curY = v.y
      if(k % math.random(1,2000) == 0)then
         if(player.y-plScreen.top < curY and player.y-plScreen.top+600 > curY and player.x-plScreen.left < curX and player.x-plScreen.left+800 > curX)then
            runAnimation(108, curX, curY+16, 1065353216)
         end
      end

   end
   earthquake(5)
end


Documentation will be updated soon! :P
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

Kevsoft M
Topic author, Angry developer
Angry developer
Avatar
Kevsoft M
Topic author, Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #67by Kevsoft » 2 Nov 2014, 12:54

LunaLua v0.3.4.1 is out!

Changes:
Spoiler
Added the function getInput() which returns a VBStr to cheat buffer.
Added field .length to VBStr. (Note it is always 2 bytes per character because of UNICODE)

Softcoded part:
Added library npcid.lua by Rockythechao.
Added library asmmod.lua by Kevsoft.

Example:

Code: Select all

asm = loadAPI("asmmod")

function onLoad()
   asm.setEndingAnimation(108) --Explosion Effect
   asm.setEndingCoinSound(56) --Sound id
   asm.setEndingCoinValue(13) --Coins per npc removal
end

function onLoop()
   printText(tostring(getInput().length).." "..getInput().str, 30, 190)
end


Added after 2 hours 32 minutes:
LunaLua v0.3.4.2 is out!
Changes:
Spoiler
*Changed that VBStr.length represent character length.
*Added VBStr.clear() to clear out a string.

Example:

Code: Select all

function onLoop()
   if(getInput().str:find("sometext"))then
      printText("Here some text for you :D", 30, 300)
   end
end

function onJump() --If player jumps the reset the cheat string buffer.
   getInput():clear()
end
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

elitalianoverde M
Honourable citizen
Honourable citizen
Avatar
elitalianoverde M
Honourable citizen
Honourable citizen
Reputation: 8
Posts: 35
Joined: 17 May 2014
Location: Spain

Post #68by elitalianoverde » 18 Nov 2014, 12:46

Really amazing work you're doing here, I can't wait to try this out. When the idea/creativity strikes. Btw I got a question from someone: Is this compatible with SMBX or just PGEG?
Image

If my English seems lazy or sloppy at times, that's because me vale bien y bonito soy Español :V

Kevsoft M
Topic author, Angry developer
Angry developer
Avatar
Kevsoft M
Topic author, Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #69by Kevsoft » 18 Nov 2014, 13:55

This is compatible with the modificated version of SMBX.
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

Sambo M
Count
Count
Avatar
Sambo M
Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #70by Sambo » 27 Nov 2014, 3:35

What version of LunaDLL does this work with?
Image
Current Project:
Image

Wohlstand M
Lead Developer
Lead Developer
Avatar
Wohlstand M
Lead Developer
Lead Developer
Age: 30
Reputation: 493
Posts: 1747
Joined: 15 Feb 2014
English Pronouns: he/him
Location: Moscow, Russia
Website Youtube channel URL Skype Tencent QQ

Post #71by Wohlstand » 27 Nov 2014, 4:23

Sambo wrote:What version of LunaDLL does this work with?
LunaDLL 8, latest. Kil sending us fixes and updates of main LunaDLL module into our source repo, and we have fresh LunaDLL version which we building with LunaLUA support

hacheipe399 M
Honourable citizen
Honourable citizen
Avatar
hacheipe399 M
Honourable citizen
Honourable citizen
Age: 24
Reputation: 14
Posts: 45
Joined: 24 Feb 2014

Post #72by hacheipe399 » 8 Dec 2014, 4:50

Can I use "ShowNPCLifeLeft" action with LUA?
I listen to energic music:
All kinds of metal.
Electronic music: Hard House, Hardstyle, Hardcore, Frenchcore, Terrorcore and anything that with ends in -core.
Best track of 2018: Cryogenic - Mot3rf$ck3r (wear earprotection when listenting to this).

I hope to be a major contributor of PGE when I'm more advanced in my engineering.

Sambo M
Count
Count
Avatar
Sambo M
Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #73by Sambo » 20 Dec 2014, 10:18

Is there a command I can use to hide the HUD, or has this not been implemented into lunaLUA yet?
Image
Current Project:
Image

Kevsoft M
Topic author, Angry developer
Angry developer
Avatar
Kevsoft M
Topic author, Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #74by Kevsoft » 20 Dec 2014, 11:45

Sambo wrote:Is there a command I can use to hide the HUD, or has this not been implemented into lunaLUA yet?
Is not implmented yet, will be available in the next big lunalua update.
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

Kevsoft M
Topic author, Angry developer
Angry developer
Avatar
Kevsoft M
Topic author, Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #75by Kevsoft » 21 Dec 2014, 11:43

v0.4 BETA is out.

Please read if you are an api-developer:
Spoiler
registerEvent has changed: The first argument has to be the api-table itself and not the api-string anymore!!!!

Code: Select all

registerEvent(table thisTable, string internalEventName, string functionToCall, boolean callBeforeMain)

This change is necessary to make a unique instance of a API.

In Addition for both api-developers and normal users:
Spoiler
* loadAPI is no longer using 'require'. I've writte my own loading function.
It will search in following paths for an API:
"{SMBXPath}\LuaScriptsLib\{apiName}.lua"
"{SMBXEpisodePath}\{apiName.lua}"
"{SMBXEpisodePath}\{CustomLevelFolder}\{apiName}.lua"
* loadSharedAPI added: Loads or gets (if already loaded) a shared instance of an API. (lunaworld.lua and lunadll.lua will reference the same API memory)
* hud(boolean displayHud) add: Toggle hud display on/off

Because there are lot of code changes I mark this version as "BETA". If there are any problems then please let me know!
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

Sambo M
Count
Count
Avatar
Sambo M
Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #76by Sambo » 24 Dec 2014, 2:03

What is the "type" parameter of the placeSprite function for? I can't find any information about it anywhere.

It seems that your link still downloads v 0.3.4.2.
Image
Current Project:
Image

Kevsoft M
Topic author, Angry developer
Angry developer
Avatar
Kevsoft M
Topic author, Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #77by Kevsoft » 24 Dec 2014, 13:11

Sambo wrote:What is the "type" parameter of the placeSprite function for? I can't find any information about it anywhere.
Unfortunatly I don't know much either. The only thing I can give over is that:

Code: Select all

////////////////////////////
/// BUILTIN SPRITE TYPES /// ****************************************************************************************************
////////////////////////////
//
// 1 = Static / HUD sprite      1: Type      2: Img code      3: Xpos      4: Ypos      5: Active lifetime   6:
// 2 = "In level" sprite      1: Type      2: Img code      3: Xpos      4: Ypos      5: Active lifetime   6:
// 3 = Collectible item         1: Type      2: Img code      3: Xpos      4: Ypos      5: Active lifetime   6: Lundll event to trigger
// 4 = Progress bar            1: Type      2: Img code      3: Xpos      4: Ypos      5: Active lifetime   6:
// 5 = Phanto               1: Type      2: Img code      3: Xpos      4: Ypos      5: Active lifetime   6:
//
//////////////////////////// ****************************************************************************************************

enum BUILTIN_SPRITE_TYPE {
   BST_Custom = 0,
   BST_Static = 1,
   BST_Normal = 2,
   BST_Item = 3,
   BST_Bar = 4,
   BST_Phanto
};


Sambo wrote:It seems that your link still downloads v 0.3.4.2.
Oh darn, fixed it.
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

Sambo M
Count
Count
Avatar
Sambo M
Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #78by Sambo » 25 Dec 2014, 23:58

That actually made me understand it better, though I have no idea what placing a sprite as a Phanto would do...
It seems that the loadImage function does not work in LunaLUA. At first I thought it was something I was doing wrong, but I tried to do the same thing in Autocode and it works just fine.
LUA codes:

Code: Select all

function onLoad()
  loadImage ("hud.bmp", 1, 0xff00dc);
  loadImage ("dcind.bmp", 2, 0xff00dc);
  loadImage ("dcslot.bmp", 3, 0xff00dc);
  PlaceSprite (1, 1, 174, 8)
end
function onLoop()
  hud(false)
end

Autocode:

Code: Select all

#-1
// --> Load image into slot 1 with transparency color FF00DC (Pink)
LoadImage,1,0xDC00FF,0,0,0,hud.bmp
PlaceSprite,1,1,0,0,0,0
#0
LunaControl,2,1,0,0,0,0
Image
Current Project:
Image

Kevsoft M
Topic author, Angry developer
Angry developer
Avatar
Kevsoft M
Topic author, Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #79by Kevsoft » 26 Dec 2014, 15:50

Very strange indeed... But the lua code does hide the hud, right?
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

Sambo M
Count
Count
Avatar
Sambo M
Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #80by Sambo » 27 Dec 2014, 0:06

Yes, it still hides the HUD and I can get the PrintText function to work. But the image codes don't work.
Image
Current Project:
Image


Return to “LunaLua - Extension Framework”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest