Message Evaluation (Execute Lua code in SMBX Messages!)

Share and discuss custom LunaLua code and content packs for SMBX2.
Core
Fuzzy
Fuzzy
Posts: 1110
Joined: Tue Apr 15, 2014 8:29 am
Flair: Bun~
Pronouns: she/her

Message Evaluation (Execute Lua code in SMBX Messages!)

Postby Core » Sat Apr 18, 2020 8:05 am

Salut folks, i've decided to upload a simple library, which lets you execute lua code in smbx messages!
Example:

Code: Select all

--#lua_execute#--
if player.speedX == 0 then player.speedX = -9 end
(you need to write `--#lua_execute#--` in the message so it could be executed)
Gif (Example in action):
Spoiler: show
Image
Download - https://drive.google.com/file/d/1BUc4tw ... sp=sharing

Don't forget to credit me, overall you are allowed to use it and modify it. Also be sure to report bugs if there are ones!

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9491
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Message Evaluation (Execute Lua code in SMBX Messages!)

Postby Enjl » Sat Apr 18, 2020 8:23 am

Why would someone want to use this over a regular lua script?

Archived
Van De Graf
Van De Graf
Posts: 2166
Joined: Tue Mar 13, 2018 6:15 pm

Re: Message Evaluation (Execute Lua code in SMBX Messages!)

Postby Archived » Sat Apr 18, 2020 9:18 am

Archived
Last edited by Archived on Sun Jan 29, 2023 2:31 pm, edited 1 time in total.

Novarender
Monty Mole
Monty Mole
Posts: 145
Joined: Sat Aug 06, 2016 6:59 pm
Flair: Whoa

Re: Message Evaluation (Execute Lua code in SMBX Messages!)

Postby Novarender » Sat Apr 18, 2020 9:29 am

Enjl wrote:
Sat Apr 18, 2020 8:23 am
Why would someone want to use this over a regular lua script?
I think it was just done for fun/screwing around.

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9491
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Message Evaluation (Execute Lua code in SMBX Messages!)

Postby Enjl » Sat Apr 18, 2020 10:12 am

Eclipsed wrote:
Sat Apr 18, 2020 9:18 am
Enjl wrote:
Sat Apr 18, 2020 8:23 am
Why would someone want to use this over a regular lua script?
They might be too lazy to create an event attached to the message, and create a lua file to answer your question. There’s really no long term benefits however to this method in the thread since it’s really hard to see your text in an smbx message.
Perhaps... I'm mostly concerned about how hard to find it will be in case something breaks, or how terrible the formatting in the message box window is. You don't even need an event either, just fill in a dummy message:

Code: Select all

function onMessageBox(eventObj, message)
	if message == "dummyMessage" then
		eventObj.cancelled = true
		player.speedX = -9
	end
end
And making a lua file is as simple as clicking a button in the editor, so it's arguably faster and easier to do it properly.

Yoshi021
Gold Yoshi Egg
Gold Yoshi Egg
Posts: 687
Joined: Thu Jan 21, 2016 9:06 pm
Flair: :)
Pronouns: He/Him

Re: Message Evaluation (Execute Lua code in SMBX Messages!)

Postby Yoshi021 » Sat Apr 18, 2020 7:35 pm

I like this. This is cool!

MegaDood
Torpedo Ted
Torpedo Ted
Posts: 1650
Joined: Wed Nov 01, 2017 2:43 am

Re: Message Evaluation (Execute Lua code in SMBX Messages!)

Postby MegaDood » Sat Apr 18, 2020 10:22 pm

Well done Core, I think you did a really good job with it. Makes accessing lua stuff a lot easier with messages.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest