Page 63 of 76

Re: Need help with lua? - LunaLua General Help

Posted: Mon Jan 29, 2018 8:49 pm
by Chaotic Gaming
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.

Re: Need help with lua? - LunaLua General Help

Posted: Mon Jan 29, 2018 8:51 pm
by PixelPest
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

Re: Need help with lua? - LunaLua General Help

Posted: Thu Feb 01, 2018 2:23 pm
by IttaBaby
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?

Re: Need help with lua? - LunaLua General Help

Posted: Fri Feb 02, 2018 12:48 am
by Chaotic Gaming
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?

Re: Need help with lua? - LunaLua General Help

Posted: Fri Feb 02, 2018 2:19 am
by The0x539
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?

Re: Need help with lua? - LunaLua General Help

Posted: Fri Feb 02, 2018 9:31 pm
by Novarender
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.

Re: Need help with lua? - LunaLua General Help

Posted: Thu Feb 08, 2018 12:10 am
by WildW
cant figure out how to make luna.lua files
im just that dumb...
help?

im talking about saving files as .lua not .txt

Re: Need help with lua? - LunaLua General Help

Posted: Thu Feb 08, 2018 10:03 am
by The0x539
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

Re: Need help with lua? - LunaLua General Help

Posted: Thu Feb 08, 2018 11:11 am
by WildW
Thanks!

Re: Need help with lua? - LunaLua General Help

Posted: Thu Feb 08, 2018 11:22 am
by Taycamgame
Basically after beta 4's release, a lot of file names will need to be changed? What about file extensions?

Re: Need help with lua? - LunaLua General Help

Posted: Thu Feb 08, 2018 11:26 am
by PixelPest
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

Re: Need help with lua? - LunaLua General Help

Posted: Thu Feb 08, 2018 1:20 pm
by WildW

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

Re: Need help with lua? - LunaLua General Help

Posted: Thu Feb 08, 2018 1:42 pm
by The0x539
WildWEEGEE wrote:kill the player
player:kill()
it reaches 0
myCounter == 0
when

Code: Select all

if condition then
	doStuff()
end

Re: Need help with lua? - LunaLua General Help

Posted: Thu Feb 08, 2018 2:02 pm
by WildW
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!

Re: Need help with lua? - LunaLua General Help

Posted: Fri Feb 09, 2018 2:14 pm
by Novarender
Is there any way to at least rename blocks/npcs etc. in the editor?

Re: Need help with lua? - LunaLua General Help

Posted: Fri Feb 09, 2018 2:18 pm
by PixelPest
Notxarb wrote:Is there any way to at least rename blocks/npcs etc. in the editor?
For what reason?

Re: Need help with lua? - LunaLua General Help

Posted: Fri Feb 09, 2018 2:41 pm
by Taycamgame
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.

Re: Need help with lua? - LunaLua General Help

Posted: Fri Feb 09, 2018 2:48 pm
by The0x539
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

Re: Need help with lua? - LunaLua General Help

Posted: Fri Feb 09, 2018 2:58 pm
by HenryRichard
You should also be able to rename NPCs using .txt files, though you can't have spaces for some reason.

Re: Need help with lua? - LunaLua General Help

Posted: Sat Feb 10, 2018 12:17 pm
by Novarender
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.