Need help with lua? - LunaLua General Help

This is the place for discussion and support for LunaLua and related modifications and libraries.
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?
User avatar
The0x539
Nipper Plant
Nipper Plant
Posts: 751
Joined: Fri Jan 22, 2016 8:02 pm
Current Project: SMBX2

Re: Need help with lua? - LunaLua General Help

Postby The0x539 » Mon Jan 29, 2018 6:05 pm

CC_Comedic_Comentator wrote:
The0x539 wrote:
CC_Comedic_Comentator wrote:On OnStart() which runs at the beginning of each level and beginning of the overworld, it does not work! So no.
OnStart does not. onStart does. These things are important.
Correction: I forgot to edit my post last night. turns out I was saving the changes as a .lua.txt file by accident. Apparently Notepad on Windows 7 got confused which file format I had. XD

In sum, Adding mem(0x00B2C5AC, FIELD_FLOAT, 99) as suggested works to a degree. The world map shows the lost life, it is restored to 99 when you enter a level again. Can Lua edit the overworld yet? Maybe that could fix it if the code could be injected during the overworld?
lunaoverworld.lua (map.lua in beta 4) will run on the overworld, generally using the same event names.

User avatar
Chaotic Gaming
Rex
Rex
Posts: 99
Joined: Mon Jan 23, 2017 7:11 pm
Current Project: Let's Play of Super Mario Forever X
Chat Username: Chaotic
Contact:

Re: Need help with lua? - LunaLua General Help

Postby Chaotic Gaming » Mon Jan 29, 2018 8:49 pm

The Dwarven Digger wrote:
The0x539 wrote:
CC_Comedic_Comentator wrote:On OnStart() which runs at the beginning of each level and beginning of the overworld, it does not work! So no.
OnStart does not. onStart does. These things are important.
Ah yes, the classic programmer's error of incorrect capitalisation/format. Can be very hard to debug if you don't spot it.
Sorry didn't realize I was programming directly in the forum. (sarcasm) Lmao! As long as it is known what construct is what and what code is what and what it's for, it shouldn't have to be in a 100% correct format unless you are programming the forum with lua using this thread directly.
My Youtube Channel:
Chaotic Gaming[/center]
Knux wrote: "i honestly thought it boys"

a honetly thought this bottle of glayva was 20% but it was actually 35% i drank the whole lot help
Kley wrote: Knux, it's best to stay off the forums when you're drunk.

PixelPest
Link
Link
Posts: 7116
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Current Project: Boom Boom Evolution
Chat Username: PixelPest
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Mon Jan 29, 2018 8:51 pm

CC_Comedic_Comentator wrote:
The Dwarven Digger wrote:
The0x539 wrote: OnStart does not. onStart does. These things are important.
Ah yes, the classic programmer's error of incorrect capitalisation/format. Can be very hard to debug if you don't spot it.
Sorry didn't realize I was programming directly in the forum. (sarcasm) Lmao! As long as it is known what construct is what and what code is what and what it's for, it shouldn't have to be in a 100% correct format unless you are programming the forum with lua using this thread directly.
How do you expect us to help you if you don't use the correct format? Syntax is very important and you have to assume that the people helping you are interpreting what you're writing as exactly what you understand and/or have written

User avatar
IttaBaby
Koopa Troopa
Koopa Troopa
Posts: 28
Joined: Sat Apr 08, 2017 8:19 pm
Chat Username: IttaBaby

Re: Need help with lua? - LunaLua General Help

Postby IttaBaby » Thu Feb 01, 2018 2:23 pm

I just want to change the kind of bullet ludwig throws from fire to hammer, but I'm too dumb to figure it out <:c
Would someone be kind enough to tell me what code would do that?

User avatar
Chaotic Gaming
Rex
Rex
Posts: 99
Joined: Mon Jan 23, 2017 7:11 pm
Current Project: Let's Play of Super Mario Forever X
Chat Username: Chaotic
Contact:

Re: Need help with lua? - LunaLua General Help

Postby Chaotic Gaming » Fri Feb 02, 2018 12:48 am

PixelPest wrote:
CC_Comedic_Comentator wrote:
The Dwarven Digger wrote: Ah yes, the classic programmer's error of incorrect capitalisation/format. Can be very hard to debug if you don't spot it.
Sorry didn't realize I was programming directly in the forum. (sarcasm) Lmao! As long as it is known what construct is what and what code is what and what it's for, it shouldn't have to be in a 100% correct format unless you are programming the forum with lua using this thread directly.
How do you expect us to help you if you don't use the correct format? Syntax is very important and you have to assume that the people helping you are interpreting what you're writing as exactly what you understand and/or have written
You guys are really that strict? What is this, a forum for Super Mario Bros X or coding format class?
My Youtube Channel:
Chaotic Gaming[/center]
Knux wrote: "i honestly thought it boys"

a honetly thought this bottle of glayva was 20% but it was actually 35% i drank the whole lot help
Kley wrote: Knux, it's best to stay off the forums when you're drunk.

User avatar
The0x539
Nipper Plant
Nipper Plant
Posts: 751
Joined: Fri Jan 22, 2016 8:02 pm
Current Project: SMBX2

Re: Need help with lua? - LunaLua General Help

Postby The0x539 » Fri Feb 02, 2018 2:19 am

CC_Comedic_Comentator wrote:
PixelPest wrote:
CC_Comedic_Comentator wrote: Sorry didn't realize I was programming directly in the forum. (sarcasm) Lmao! As long as it is known what construct is what and what code is what and what it's for, it shouldn't have to be in a 100% correct format unless you are programming the forum with lua using this thread directly.
How do you expect us to help you if you don't use the correct format? Syntax is very important and you have to assume that the people helping you are interpreting what you're writing as exactly what you understand and/or have written
You guys are really that strict? What is this, a forum for Super Mario Bros X or coding format class?
If there's a difference between the code you write and the code you share, how is anyone supposed to find the real problems?

User avatar
Novarender
Bit
Bit
Posts: 130
Joined: Sat Aug 06, 2016 6:59 pm
Flair: Whoa
Current Project: MMX - Mario Maker X, patent pending
Chat Username: Novarender

Re: Need help with lua? - LunaLua General Help

Postby Novarender » Fri Feb 02, 2018 9:31 pm

IttaBaby wrote:I just want to change the kind of bullet ludwig throws from fire to hammer, but I'm too dumb to figure it out <:c
Would someone be kind enough to tell me what code would do that?
You could maybe kill the fireball once it spawns and spawn in a hammer. I don't know how to do that though, sorry.
CC_Comedic_Comentator wrote:
PixelPest wrote:
CC_Comedic_Comentator wrote: Sorry didn't realize I was programming directly in the forum. (sarcasm) Lmao! As long as it is known what construct is what and what code is what and what it's for, it shouldn't have to be in a 100% correct format unless you are programming the forum with lua using this thread directly.
How do you expect us to help you if you don't use the correct format? Syntax is very important and you have to assume that the people helping you are interpreting what you're writing as exactly what you understand and/or have written
You guys are really that strict? What is this, a forum for Super Mario Bros X or coding format class?
PixelPest is right. I guess you don't have to always use perfect formatting, but it would make things a lot easier for everyone if you did. It just helps to clear up misunderstandings and/or errors.

Is there any way to run .lua scripts while in the editor/ modify the editor? I want to make it easier to use.
I believe and I accept Jesus Christ as my Lord and Savior. If you do, put this in your signature.

Hagrid: "You're a wizard, Harry!"
Harry: "You're a hairy wizard!"

The FitnessGram Pacer Test is a multistage aerobic capacity test that progressively gets more difficult as it continues. The 20 meter pacer test will begin in 30 seconds. Line up at the start. The running speed starts slowly but gets faster each minute after you hear this signal bodeboop.

FYRENOVA IS A FAKE!

User avatar
WildWEEGEE
Koopa Shell
Koopa Shell
Posts: 664
Joined: Thu Dec 14, 2017 2:21 pm
Current Project: things
Chat Username: WildWEEGEE

Re: Need help with lua? - LunaLua General Help

Postby WildWEEGEE » Thu Feb 08, 2018 12:10 am

cant figure out how to make luna.lua files
im just that dumb...
help?

im talking about saving files as .lua not .txt
I have absolutely no idea what my current project is... My interests always seem to shift
I support: show
ImageImage
Looking back at every one of my posts, I cringe, hard, very hard.

User avatar
The0x539
Nipper Plant
Nipper Plant
Posts: 751
Joined: Fri Jan 22, 2016 8:02 pm
Current Project: SMBX2

Re: Need help with lua? - LunaLua General Help

Postby The0x539 » Thu Feb 08, 2018 10:03 am

WildWEEGEE wrote:cant figure out how to make luna.lua files
im just that dumb...
help?

im talking about saving files as .lua not .txt
Until Beta 4, the file needs to be named lunadll.lua rather than luna.lua.
Image

User avatar
WildWEEGEE
Koopa Shell
Koopa Shell
Posts: 664
Joined: Thu Dec 14, 2017 2:21 pm
Current Project: things
Chat Username: WildWEEGEE

Re: Need help with lua? - LunaLua General Help

Postby WildWEEGEE » Thu Feb 08, 2018 11:11 am

Thanks!
I have absolutely no idea what my current project is... My interests always seem to shift
I support: show
ImageImage
Looking back at every one of my posts, I cringe, hard, very hard.

User avatar
Taycamgame
Gold Yoshi Egg
Gold Yoshi Egg
Posts: 1369
Joined: Mon Jun 19, 2017 11:35 am
Flair: Stargard
Current Project: Mario's Kingdom Adventure
Chat Username: Taycamgame
Contact:

Re: Need help with lua? - LunaLua General Help

Postby Taycamgame » Thu Feb 08, 2018 11:22 am

Basically after beta 4's release, a lot of file names will need to be changed? What about file extensions?
Official Level Reviewer (My Gold Yoshi Egg rank replaced the level reviewer icon, but i am still a level reviewer).
Image
Image
Image
Image
Check out the World Map Service that i host:
viewtopic.php?p=316733#p316733
Check out the projects i support:
Spoiler: show
ImageImage
Image
Image
Quotes: show
xDestroy wrote:
Wellington Games wrote:Taycamgame, I know how to take screenshots in the SMBX.
https://nsmbx.proboards.com/
------
Tower Mario Bros.

PixelPest
Link
Link
Posts: 7116
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Current Project: Boom Boom Evolution
Chat Username: PixelPest
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Thu Feb 08, 2018 11:26 am

Taycamgame wrote:Basically after beta 4's release, a lot of file names will need to be changed? What about file extensions?
All files will still be Lua files. Why would we change the file extension? Also SMBX2 is backwards-compatible with previous versions (with a few minor exceptions) and lunadll.lua files, etc. will still work

User avatar
WildWEEGEE
Koopa Shell
Koopa Shell
Posts: 664
Joined: Thu Dec 14, 2017 2:21 pm
Current Project: things
Chat Username: WildWEEGEE

Re: Need help with lua? - LunaLua General Help

Postby WildWEEGEE » Thu Feb 08, 2018 1:20 pm

Code: Select all

local myCounter = 16000

function onLoop()
	myCounter = myCounter - 1

	Text.print(myCounter,0,0)
	
end
I'm trying to make a timer but I don't know how to make it kill the player when it reaches 0
I have absolutely no idea what my current project is... My interests always seem to shift
I support: show
ImageImage
Looking back at every one of my posts, I cringe, hard, very hard.

User avatar
The0x539
Nipper Plant
Nipper Plant
Posts: 751
Joined: Fri Jan 22, 2016 8:02 pm
Current Project: SMBX2

Re: Need help with lua? - LunaLua General Help

Postby The0x539 » Thu Feb 08, 2018 1:42 pm

WildWEEGEE wrote:kill the player
player:kill()
it reaches 0
myCounter == 0
when

Code: Select all

if condition then
	doStuff()
end

User avatar
WildWEEGEE
Koopa Shell
Koopa Shell
Posts: 664
Joined: Thu Dec 14, 2017 2:21 pm
Current Project: things
Chat Username: WildWEEGEE

Re: Need help with lua? - LunaLua General Help

Postby WildWEEGEE » Thu Feb 08, 2018 2:02 pm

The0x539 wrote:
WildWEEGEE wrote:kill the player
player:kill()
it reaches 0
myCounter == 0
when

Code: Select all

if condition then
	doStuff()
end
Wow I did not expect it to work so well
thank you!
I have absolutely no idea what my current project is... My interests always seem to shift
I support: show
ImageImage
Looking back at every one of my posts, I cringe, hard, very hard.

User avatar
Novarender
Bit
Bit
Posts: 130
Joined: Sat Aug 06, 2016 6:59 pm
Flair: Whoa
Current Project: MMX - Mario Maker X, patent pending
Chat Username: Novarender

Re: Need help with lua? - LunaLua General Help

Postby Novarender » Fri Feb 09, 2018 2:14 pm

Is there any way to at least rename blocks/npcs etc. in the editor?
I believe and I accept Jesus Christ as my Lord and Savior. If you do, put this in your signature.

Hagrid: "You're a wizard, Harry!"
Harry: "You're a hairy wizard!"

The FitnessGram Pacer Test is a multistage aerobic capacity test that progressively gets more difficult as it continues. The 20 meter pacer test will begin in 30 seconds. Line up at the start. The running speed starts slowly but gets faster each minute after you hear this signal bodeboop.

FYRENOVA IS A FAKE!

PixelPest
Link
Link
Posts: 7116
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Current Project: Boom Boom Evolution
Chat Username: PixelPest
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Fri Feb 09, 2018 2:18 pm

Notxarb wrote:Is there any way to at least rename blocks/npcs etc. in the editor?
For what reason?

User avatar
Taycamgame
Gold Yoshi Egg
Gold Yoshi Egg
Posts: 1369
Joined: Mon Jun 19, 2017 11:35 am
Flair: Stargard
Current Project: Mario's Kingdom Adventure
Chat Username: Taycamgame
Contact:

Re: Need help with lua? - LunaLua General Help

Postby Taycamgame » Fri Feb 09, 2018 2:41 pm

Notxarb wrote:Is there any way to at least rename blocks/npcs etc. in the editor?
If it's because you need help with understanding what the blocks are / do, then don't worry:
In beta 4, blocks will have proper descriptions and so you won't have to look for any definition etc.

Renaming blocks may be possible, but you may have to dive deep into the game's source code in order to achieve this.
Official Level Reviewer (My Gold Yoshi Egg rank replaced the level reviewer icon, but i am still a level reviewer).
Image
Image
Image
Image
Check out the World Map Service that i host:
viewtopic.php?p=316733#p316733
Check out the projects i support:
Spoiler: show
ImageImage
Image
Image
Quotes: show
xDestroy wrote:
Wellington Games wrote:Taycamgame, I know how to take screenshots in the SMBX.
https://nsmbx.proboards.com/
------
Tower Mario Bros.

User avatar
The0x539
Nipper Plant
Nipper Plant
Posts: 751
Joined: Fri Jan 22, 2016 8:02 pm
Current Project: SMBX2

Re: Need help with lua? - LunaLua General Help

Postby The0x539 » Fri Feb 09, 2018 2:48 pm

Taycamgame wrote:
Notxarb wrote:Is there any way to at least rename blocks/npcs etc. in the editor?
If it's because you need help with understanding what the blocks are / do, then don't worry:
In beta 4, blocks will have proper descriptions and so you won't have to look for any definition etc.

Renaming blocks may be possible, but you may have to dive deep into the game's source code in order to achieve this.
in data/PGE/configs/SMBX2-Integration/items there should be folders containing .ini files
these are the editor's equivalent of npc.txt files, except the default values are there, rather than being hardcoded
putting copies of these in the level folder should mean that the editor reads those, if memory serves

User avatar
HenryRichard
Ludwig von Koopa
Ludwig von Koopa
Posts: 2846
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 » Fri Feb 09, 2018 2:58 pm

You should also be able to rename NPCs using .txt files, though you can't have spaces for some reason.
Jesus is my savior.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 2 guests