Need help with lua? - LunaLua General Help

This is the place for discussion and support for LunaLua and related modifications and libraries.

Moderator: Userbase Moderators

Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?
PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Sat May 14, 2016 6:27 pm

MECHDRAGON777 wrote:I should learn more about tables.
http://lua-users.org/wiki/StringsTutorial
http://lua-users.org/wiki/TablesTutorial

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9890
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Need help with lua? - LunaLua General Help

Postby Emral » Sat May 14, 2016 8:31 pm

HenryRichard wrote:Is there a way to use multi-channel music?
No. You can try playing one of the tracks through a sound channel, but sound tends to cut off and loading such a big sound effect can cause the game to hiccup for a second.

NoodlesButt
Shy Guy
Shy Guy
Posts: 5
Joined: Sun Oct 11, 2015 9:01 am

Re: Need help with lua? - LunaLua General Help

Postby NoodlesButt » Mon May 16, 2016 7:55 am

I downloaded LunaLua, full installation, vanilla+launcher but when I try to run the smbx application I get an application error.
"The application was unable to start correctly (0xc000007b). Click OK to close the application."

Mario_and_Luigi_55
Spike
Spike
Posts: 270
Joined: Sat Feb 27, 2016 12:01 pm

Re: Need help with lua? - LunaLua General Help

Postby Mario_and_Luigi_55 » Mon May 16, 2016 8:09 am

NoodlesButt wrote:I downloaded LunaLua, full installation, vanilla+launcher but when I try to run the smbx application I get an application error.
"The application was unable to start correctly (0xc000007b). Click OK to close the application."
The error appears if you haven't got C++ configuration package. There should be file named something like vcredist.exe or something like that. Run it.

NoodlesButt
Shy Guy
Shy Guy
Posts: 5
Joined: Sun Oct 11, 2015 9:01 am

Re: Need help with lua? - LunaLua General Help

Postby NoodlesButt » Mon May 16, 2016 8:11 am

Mario_and_Luigi_55 wrote: The error appears if you haven't got C++ configuration package. There should be file named something like vcredist.exe or something like that. Run it.
Oh, that simple. :)
Thanks!

Ghostly_Guy
Bot
Bot
Posts: 55
Joined: Thu Jun 11, 2015 10:46 pm

Re: Need help with lua? - LunaLua General Help

Postby Ghostly_Guy » Mon May 16, 2016 10:15 pm

Is there a code you can use to trigger a cheat when you collect [npc]?
As in, can you make an item that, after you collect it, triggers supermario4 and then immediately redigitiscool?

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Mon May 16, 2016 10:22 pm

Ghostly_Guy wrote:Is there a code you can use to trigger a cheat when you collect [npc]?
As in, can you make an item that, after you collect it, triggers supermario4 and then immediately --?
http://wohlsoft.ru/pgewiki/SMBX_Fields

I'm also working on an API for cheats that in the future will make this even simpler

Ghostly_Guy
Bot
Bot
Posts: 55
Joined: Thu Jun 11, 2015 10:46 pm

Re: Need help with lua? - LunaLua General Help

Postby Ghostly_Guy » Mon May 16, 2016 11:58 pm

PixelPest wrote:
Ghostly_Guy wrote:Is there a code you can use to trigger a cheat when you collect [npc]?
As in, can you make an item that, after you collect it, triggers supermario4 and then immediately --?
http://wohlsoft.ru/pgewiki/SMBX_Fields

I'm also working on an API for cheats that in the future will make this even simpler
Sorry, but that didn't really work for me. I entered this as a test:

Code: Select all

function onStart()
  Defines.cheat_supermario4 = TRUE
  Defines.player_hasCheated = FALSE
end
Correct me if I'm wrong, but I thought that this would, when I started the level, activate the supermario4 cheat.
But nothing happened.
Am I doing something wrong? The code Defines.cheat_supermario4 wasn't one of the Defines listed in the website your link went to.

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9890
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Need help with lua? - LunaLua General Help

Postby Emral » Tue May 17, 2016 1:09 am

If it's not on the list you can't activate it. The hook just doesn't exist yet.

Hoeloe
Phanto
Phanto
Posts: 1465
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: Need help with lua? - LunaLua General Help

Postby Hoeloe » Tue May 17, 2016 3:24 am

Enjl wrote:If it's not on the list you can't activate it. The hook just doesn't exist yet.
Not just that, but "TRUE" is not the same thing as "true". When programming, case matters.

Ghostly_Guy
Bot
Bot
Posts: 55
Joined: Thu Jun 11, 2015 10:46 pm

Re: Need help with lua? - LunaLua General Help

Postby Ghostly_Guy » Tue May 17, 2016 10:44 am

Enjl wrote:If it's not on the list you can't activate it. The hook just doesn't exist yet.
However, is there a way to activate cheats not on the list?
Hoeloe wrote:Not just that, but "TRUE" is not the same thing as "true". When programming, case matters.
Okay, that was absolutely my fault. I changed it.

S1eth
Bot
Bot
Posts: 54
Joined: Sat Apr 23, 2016 10:44 am

Re: Need help with lua? - LunaLua General Help

Postby S1eth » Tue May 17, 2016 10:55 am

Ghostly_Guy wrote:
Enjl wrote:If it's not on the list you can't activate it. The hook just doesn't exist yet.
However, is there a way to activate cheats not on the list?
Hoeloe wrote:Not just that, but "TRUE" is not the same thing as "true". When programming, case matters.
Okay, that was absolutely my fault. I changed it.
You can use

Code: Select all

Misc.cheatBuffer("moneytree"); -- example cheat


to activate cheats.
But be careful.

Setting the cheatBuffer makes the game think you were typing for example "moneytre" and exactly this frame, you type the last "e".

So you can not just type:

Code: Select all

Misc.cheatBuffer("myCheat1");
Misc.cheatBuffer("myCheat2");


If you do that, you overwrite the cheatBuffer before the game has a chance to execute your first cheat, so only the second cheat will be activated. You can only execute one cheat per frame this way.
You could use eventu to schedule another cheat exactly 1 frame later if you want.

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Tue May 17, 2016 6:01 pm

How do I get the event I want to use in Event.cancelled?

HenryRichard
Reznor
Reznor
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: Need help with lua? - LunaLua General Help

Postby HenryRichard » Tue May 17, 2016 6:41 pm

It should be in the function's arguments.

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Tue May 17, 2016 6:53 pm

HenryRichard wrote:It should be in the function's arguments.
Wait. Is event referring to, like, function onTick(), function onLoop(), etc.?! If so nm my question

Ghostly_Guy
Bot
Bot
Posts: 55
Joined: Thu Jun 11, 2015 10:46 pm

Re: Need help with lua? - LunaLua General Help

Postby Ghostly_Guy » Tue May 17, 2016 7:11 pm

Well, now that my first question is answered (thank you S1eth, Enjl, Hoeloe, and Pixelpest), I have a second, follow-up question.
Is it possible to make it so that consuming a power-up that came from a ?-Block triggers Lua code?
Last edited by Ghostly_Guy on Wed May 18, 2016 10:14 am, edited 1 time in total.

HenryRichard
Reznor
Reznor
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: Need help with lua? - LunaLua General Help

Postby HenryRichard » Tue May 17, 2016 11:47 pm

PixelPest wrote:
HenryRichard wrote:It should be in the function's arguments.
Wait. Is event referring to, like, function onTick(), function onLoop(), etc.?! If so nm my question
the event refers to the thing that's happening in SMBX, i.e. an enemy being killed. But you can only get them in a few LunaLua events, like onNPCKill and onEventDirect. (At least, I'm pretty sure that's how it works)

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9890
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Need help with lua? - LunaLua General Help

Postby Emral » Wed May 18, 2016 3:53 am

eventObj in the arguments for onNPCKill and onEventDirect refers to the killing of the NPC and execution of the event respectively. They're cancellable through lua with eventObj.cancelled = true

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Wed May 18, 2016 6:38 am

Enjl wrote:eventObj in the arguments for onNPCKill and onEventDirect refers to the killing of the NPC and execution of the event respectively. They're cancellable through lua with eventObj.cancelled = true
Oh. That makes sense. Thanks

NoodlesButt
Shy Guy
Shy Guy
Posts: 5
Joined: Sun Oct 11, 2015 9:01 am

Re: Need help with lua? - LunaLua General Help

Postby NoodlesButt » Wed May 18, 2016 8:37 pm

Is there a method to activate the yellow yoshi stomp when the player isn't on the mount?
So for example when the player lands the thwomp sound is played and nearby enemies are killed.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari