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?
Chaotic Gaming
Buster Beetle
Buster Beetle
Posts: 99
Joined: Mon Jan 23, 2017 7:11 pm
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.

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 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

IttaBaby
Bot
Bot
Posts: 55
Joined: Sat Apr 08, 2017 8:19 pm

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?

Chaotic Gaming
Buster Beetle
Buster Beetle
Posts: 99
Joined: Mon Jan 23, 2017 7:11 pm
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?

The0x539
Eerie
Eerie
Posts: 751
Joined: Fri Jan 22, 2016 8:02 pm

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?

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

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.

WildW
Rocky Wrench
Rocky Wrench
Posts: 676
Joined: Thu Dec 14, 2017 2:21 pm
Flair: C# more like Db
Pronouns: he/him

Re: Need help with lua? - LunaLua General Help

Postby WildW » 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

The0x539
Eerie
Eerie
Posts: 751
Joined: Fri Jan 22, 2016 8:02 pm

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

WildW
Rocky Wrench
Rocky Wrench
Posts: 676
Joined: Thu Dec 14, 2017 2:21 pm
Flair: C# more like Db
Pronouns: he/him

Re: Need help with lua? - LunaLua General Help

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

Thanks!

Taycamgame
Gold Yoshi Egg
Gold Yoshi Egg
Posts: 1483
Joined: Mon Jun 19, 2017 11:35 am
Flair: Stargard
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?

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 » 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

WildW
Rocky Wrench
Rocky Wrench
Posts: 676
Joined: Thu Dec 14, 2017 2:21 pm
Flair: C# more like Db
Pronouns: he/him

Re: Need help with lua? - LunaLua General Help

Postby WildW » 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

The0x539
Eerie
Eerie
Posts: 751
Joined: Fri Jan 22, 2016 8:02 pm

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

WildW
Rocky Wrench
Rocky Wrench
Posts: 676
Joined: Thu Dec 14, 2017 2:21 pm
Flair: C# more like Db
Pronouns: he/him

Re: Need help with lua? - LunaLua General Help

Postby WildW » 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!

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

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?

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 » 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?

Taycamgame
Gold Yoshi Egg
Gold Yoshi Egg
Posts: 1483
Joined: Mon Jun 19, 2017 11:35 am
Flair: Stargard
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.

The0x539
Eerie
Eerie
Posts: 751
Joined: Fri Jan 22, 2016 8:02 pm

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

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 » 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.

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

Re: Need help with lua? - LunaLua General Help

Postby Novarender » Sat Feb 10, 2018 12:17 pm

The0x539 wrote:
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
Ok thanks. That's really useful, but I don't understand what all the tags mean. I'm experimenting with replacing graphics and some of them will need renamed, such as replacing a graphic with something completely different.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 2 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari