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?
metalluigimario
Spiny
Spiny
Posts: 26
Joined: Mon Jan 16, 2017 2:38 am

Re: Need help with lua? - LunaLua General Help

Postby metalluigimario » Wed Jan 18, 2017 7:58 pm

Ok...thank you for the reply, but I am not the only person(two of my local friends have received the same error trying to download it. I was merely trying to see if anyone else was having the problem and I also spoke with Jayce 777 and he was able to download it just fine. It must have something to do with the three of us living in SE Alaska, even tho its the only file I've ever downloaded to do this to me and I can download others(like SMBX2.0) just fine.

Not that it really matters, tho, because I have just determined that my GFX card is too old to use OpenGL 3, anyway.

Thanks again for helping me out.

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 » Thu Jan 19, 2017 2:54 am

metalluigimario wrote:Ok...thank you for the reply, but I am not the only person(two of my local friends have received the same error trying to download it. I was merely trying to see if anyone else was having the problem and I also spoke with Jayce 777 and he was able to download it just fine. It must have something to do with the three of us living in SE Alaska, even tho its the only file I've ever downloaded to do this to me and I can download others(like SMBX2.0) just fine.

Not that it really matters, tho, because I have just determined that my GFX card is too old to use OpenGL 3, anyway.

Thanks again for helping me out.
It's possible that some intermediate connecting node is problematic. The internet works by connecting you to a local node, which then connects to a slightly more remote note, which continues to connect to more neighbouring nodes until it hits the requested data. It's possible that your connection to the LunaLua download is being routed through a faulty node, which would explain why people local to you also have the issue.

Also, I'd be surprised if your card can't run OpenGL 2 (which is the one that's really necessary for 2.0), as it's over 10 years old at this point and a lot of hardware simply doesn't survive that long. It's far more likely you just haven't installed the correct drivers for your card, which causes it to use Microsoft own-brand drivers, which don't open up the full feature set.

metalluigimario
Spiny
Spiny
Posts: 26
Joined: Mon Jan 16, 2017 2:38 am

Re: Need help with lua? - LunaLua General Help

Postby metalluigimario » Thu Jan 19, 2017 2:11 pm

Hoeloe wrote:
metalluigimario wrote:Ok...thank you for the reply, but I am not the only person(two of my local friends have received the same error trying to download it. I was merely trying to see if anyone else was having the problem and I also spoke with Jayce 777 and he was able to download it just fine. It must have something to do with the three of us living in SE Alaska, even tho its the only file I've ever downloaded to do this to me and I can download others(like SMBX2.0) just fine.

Not that it really matters, tho, because I have just determined that my GFX card is too old to use OpenGL 3, anyway.

Thanks again for helping me out.
It's possible that some intermediate connecting node is problematic. The internet works by connecting you to a local node, which then connects to a slightly more remote note, which continues to connect to more neighbouring nodes until it hits the requested data. It's possible that your connection to the LunaLua download is being routed through a faulty node, which would explain why people local to you also have the issue.

Also, I'd be surprised if your card can't run OpenGL 2 (which is the one that's really necessary for 2.0), as it's over 10 years old at this point and a lot of hardware simply doesn't survive that long. It's far more likely you just haven't installed the correct drivers for your card, which causes it to use Microsoft own-brand drivers, which don't open up the full feature set.
Lol...I was thinking something along those lines. But, 2.0 only needs OpenGL 2?! I thought that I read somewhere on the forum(can't think of where, but I am going to do a bit more reading) that it needed 3? That would be awesome!

Also, when I open 2.0 and open the level editor, PGE opens just fine and it works perfectly. But clicking Lunatest(F5) launches SMBX1.3.0.2 from inside the files i got extracting 2.0 and if I close it PGE gets an error "failed to send level to LunaSMBX" or something. Clicking start game instead also launches 1.3.0.2 and when it loads, I have the selection of the new episodes, but they just load into blank or levelless worlds. ????????????????

Angelus
Tweeter
Tweeter
Posts: 132
Joined: Tue Jun 21, 2016 9:38 am

Re: Need help with lua? - LunaLua General Help

Postby Angelus » Fri Jan 20, 2017 10:00 am

Can't I resize a BGO with Lua? I've tried using the BGO (class) functions to change a BGO.width and BGO.height but nothing happened.

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 » Fri Jan 20, 2017 10:05 am

Just draw an image with lua at a priority of your choice. You can do it in a loop over all bgos of an id to essentially "resize" a bgo except you're just drawing over it.

Angelus
Tweeter
Tweeter
Posts: 132
Joined: Tue Jun 21, 2016 9:38 am

Re: Need help with lua? - LunaLua General Help

Postby Angelus » Sat Jan 21, 2017 6:37 pm

Ok, sorry for making so many questions, but can I use this code to suddenly change the section properties during a certain event?
Spoiler: show
if eventname == "Cutscene 5 - 55" then
for _,v in pairs (Section.get(14)) do
v.hasOffscreenExit = true;
It gives me an error for some reason. I just assumed it worked the same way as with NPCs, animations and blocks.

Devan2002
Chain Chomp
Chain Chomp
Posts: 304
Joined: Sun Oct 02, 2016 9:46 am

Re: Need help with lua? - LunaLua General Help

Postby Devan2002 » Sat Jan 21, 2017 7:52 pm

How would I change the sound effects with LunaLua? I do have it downloaded.

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 Jan 21, 2017 8:07 pm

Angelus wrote:Ok, sorry for making so many questions, but can I use this code to suddenly change the section properties during a certain event?
Spoiler: show
if eventname == "Cutscene 5 - 55" then
for _,v in pairs (Section.get(14)) do
v.hasOffscreenExit = true;
It gives me an error for some reason. I just assumed it worked the same way as with NPCs, animations and blocks.
You're getting Section 14 specifically. It's not a table, it's one section. You can modify its values without a for loop.
Devan2002 wrote:How would I change the sound effects with LunaLua? I do have it downloaded.
ini_examples folder. There's a sounds.ini file. Copy into your level/worlds folder and change directories. Directories are relative to the folder sounds.ini is in.

Enchlore
Spike
Spike
Posts: 272
Joined: Thu May 08, 2014 3:40 pm

Re: Need help with lua? - LunaLua General Help

Postby Enchlore » Sat Jan 21, 2017 8:55 pm

I can't get multipoints.lua to work, and I have no idea what I'm doing wrong. When I die after getting a checkpoint and restart the level, I respawn below the ground on section 1 and die instantly.

https://www.mediafire.com/?d62v9v4bviv89tm
Here's the level I'm trying to use multipoints on (I uploaded just the level file and the lunadll.lua file).

Devan2002
Chain Chomp
Chain Chomp
Posts: 304
Joined: Sun Oct 02, 2016 9:46 am

Re: Need help with lua? - LunaLua General Help

Postby Devan2002 » Sat Jan 21, 2017 11:34 pm

Devan2002 wrote:How would I change the sound effects with LunaLua? I do have it downloaded.
Enjl wrote:ini_examples folder. There's a sounds.ini file. Copy into your level/worlds folder and change directories. Directories are relative to the folder sounds.ini is in.
I couldn't find the folder ini_examples with the sounds.ini file. I have LunaLua version 0.7.3 beta update. Do I need to download a certain version of LunaLua for it to work?
Image

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 Jan 21, 2017 11:46 pm

It isn't in LuaScriptsLib if I remember correctly

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 » Sun Jan 22, 2017 3:15 pm

Devan2002 wrote:
Devan2002 wrote:How would I change the sound effects with LunaLua? I do have it downloaded.
Enjl wrote:ini_examples folder. There's a sounds.ini file. Copy into your level/worlds folder and change directories. Directories are relative to the folder sounds.ini is in.
I couldn't find the folder ini_examples with the sounds.ini file. I have LunaLua version 0.7.3 beta update. Do I need to download a certain version of LunaLua for it to work?
Image
Image
I can guarantee that it is in 2.0. I don't know if it's in the LunaLua download.

timocomsmbx2345
Foo
Foo
Posts: 853
Joined: Sat Feb 06, 2016 1:44 pm
Contact:

Re: Need help with lua? - LunaLua General Help

Postby timocomsmbx2345 » Sun Jan 22, 2017 3:37 pm

i do want to activate all the .lua files at the same time for an episode i'm about to work on. . . .

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 » Sun Jan 22, 2017 3:52 pm

timocomsmbx2345 wrote:i do want to activate all the .lua files at the same time for an episode i'm about to work on. . . .
LunaLua will only "activate" what you tell it to. It doesn't automatically run and load every API, it will just load the lunaworld.lua and lunadll.lua files for that episode and level. Those can then request APIs at will, but unless you explicitly ask for them, they won't be auto-loaded. The only exception is for files running game features like characters, npcs, and blocks, which will be loaded in, but won't do anything until it's necessary.

If you just make an episode without a lunaworld.lua, and a level without a lunadll.lua, it will behave the same as 1.3 (with the new characters and npcs and things). The addition of those .lua files allows extra code to be run, but nothing will happen unless you tell it to. The lunaworld.lua file can be placed in the episode folder to run code on every level in your episode. The lunadll.lua file should be placed in the level folder and will run code for a specific level. New features of 2.0 such as blocks, npcs, and characters are already ready to go so they can just be placed down in the editor, no code required.

donamarino
Goomba
Goomba
Posts: 2
Joined: Mon Jan 23, 2017 12:48 pm

How to implement a star coin counter in a variable?

Postby donamarino » Mon Jan 23, 2017 1:26 pm

Hello everyone,

I want to use a star coin counter. Some levels on the world-map or warps in the levels should only be passable, if the player has got enough star coins. The usual game just shows on the world-map how many star coins the player got. But I do not know how to get the access to that shown number for using it as a globale variable. Are there some fixed expression to get that number of star coins?

I do not want to count the collected star coins as a gloable variable in each level, because the counter also reaches for already collected star coins if you do the level a second time. I only thought about to give each star coin a new variable that dispose the layer the collected star coin is in. That would be a bit tiring and perhaps there are more comfortable ideas.

Maybe there are some tricks or easier ways I did not think about? I am looking forward to read your answers.

Fuyu
Fry Guy
Fry Guy
Posts: 3137
Joined: Sat Dec 21, 2013 2:40 pm
Pronouns: He/Him

Re: How to implement a star coin counter in a variable?

Postby Fuyu » Mon Jan 23, 2017 7:27 pm

donamarino wrote:
Spoiler: show
Hello everyone,

I want to use a star coin counter. Some levels on the world-map or warps in the levels should only be passable, if the player has got enough star coins. The usual game just shows on the world-map how many star coins the player got. But I do not know how to get the access to that shown number for using it as a globale variable. Are there some fixed expression to get that number of star coins?

I do not want to count the collected star coins as a gloable variable in each level, because the counter also reaches for already collected star coins if you do the level a second time. I only thought about to give each star coin a new variable that dispose the layer the collected star coin is in. That would be a bit tiring and perhaps there are more comfortable ideas.

Maybe there are some tricks or easier ways I did not think about? I am looking forward to read your answers.
For questions on how to do stuff on Lua post here. You don't need nor you are allowed to make individual threads for each issue or gimmick you have.

What exactly are Star Coins? I assume you're talking about Dragon Coins since really those are the only ones anybody would think to make collectibles related to stars out of. You need to use Data files in order to do this. By doing this you're storing data on text files that LunaLua will later read upon loading a level that is linked to the Data class. For a better idea on how Data class works watch this video tutorial by Pyro. They aren't up to date, but they will surely prove to be helpful in learning how to make your own Data files. Here are also all functions you may need while making your Data class.

donamarino
Goomba
Goomba
Posts: 2
Joined: Mon Jan 23, 2017 12:48 pm

Re: How to implement a star coin counter in a variable?

Postby donamarino » Mon Jan 23, 2017 8:04 pm

Intuition wrote:
donamarino wrote:
Spoiler: show
Hello everyone,

I want to use a star coin counter. Some levels on the world-map or warps in the levels should only be passable, if the player has got enough star coins. The usual game just shows on the world-map how many star coins the player got. But I do not know how to get the access to that shown number for using it as a globale variable. Are there some fixed expression to get that number of star coins?

I do not want to count the collected star coins as a gloable variable in each level, because the counter also reaches for already collected star coins if you do the level a second time. I only thought about to give each star coin a new variable that dispose the layer the collected star coin is in. That would be a bit tiring and perhaps there are more comfortable ideas.

Maybe there are some tricks or easier ways I did not think about? I am looking forward to read your answers.
[...]
What exactly are Star Coins? I assume you're talking about Dragon Coins since really those are the only ones anybody would think to make collectibles related to stars out of. You need to use Data files in order to do this. By doing this you're storing data on text files that LunaLua will later read upon loading a level that is linked to the Data class. For a better idea on how Data class works watch this video tutorial by Pyro. They aren't up to date, but they will surely prove to be helpful in learning how to make your own Data files. Here are also all functions you may need while making your Data class.
Thanks for your answer! :- )
I am a bit confused about the different versions of SMBX and I am not sure what version is usually used here. For claryfying, I use SBX 1.4.3 and there are e.g. star coins that can be collected. The game also counts them on the world map and gives the player the number of all.
I could still find out a solution that I prefere. By using sys(starcoincount) I can get the access to that number and I am able to use it as a variable.

But your links seems to be useful as well (and the syntax looks very intuitive ^^).

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

Re: How to implement a star coin counter in a variable?

Postby Emral » Tue Jan 24, 2017 11:05 am

Intuition wrote:
donamarino wrote:
Spoiler: show
Hello everyone,

I want to use a star coin counter. Some levels on the world-map or warps in the levels should only be passable, if the player has got enough star coins. The usual game just shows on the world-map how many star coins the player got. But I do not know how to get the access to that shown number for using it as a globale variable. Are there some fixed expression to get that number of star coins?

I do not want to count the collected star coins as a gloable variable in each level, because the counter also reaches for already collected star coins if you do the level a second time. I only thought about to give each star coin a new variable that dispose the layer the collected star coin is in. That would be a bit tiring and perhaps there are more comfortable ideas.

Maybe there are some tricks or easier ways I did not think about? I am looking forward to read your answers.
For questions on how to do stuff on Lua post here. You don't need nor you are allowed to make individual threads for each issue or gimmick you have.
Except you are allowed to. This thread is for general help that can be dealt with with a quick answer. Additional threads are still useful for when people think their requests and concerns are a bit more substantial.
Examples:
viewtopic.php?f=87&t=17653
viewtopic.php?f=87&t=17657
viewtopic.php?f=87&t=17674
viewtopic.php?f=87&t=17253
viewtopic.php?f=87&t=17654
viewtopic.php?f=87&t=17652
viewtopic.php?f=87&t=17587
viewtopic.php?f=87&t=17532
viewtopic.php?f=87&t=17514
viewtopic.php?f=87&t=17335
viewtopic.php?f=87&t=17452
This is only page 1.

If I'm wrong, please redirect me to the rule that states that asking for help outside of this thread is not allowed, and please tell me why such a rule is a necessary thing.
donamarino wrote:
Thanks for your answer! :- )
I am a bit confused about the different versions of SMBX and I am not sure what version is usually used here. For claryfying, I use SBX 1.4.3 and there are e.g. star coins that can be collected. The game also counts them on the world map and gives the player the number of all.
I could still find out a solution that I prefere. By using sys(starcoincount) I can get the access to that number and I am able to use it as a variable.

But your links seems to be useful as well (and the syntax looks very intuitive ^^).
This subforum is for LunaLua, the Lua-based extension module for SMBX 2.0. SMBX 38A (1.4.3) uses a different scripting language.

timocomsmbx2345
Foo
Foo
Posts: 853
Joined: Sat Feb 06, 2016 1:44 pm
Contact:

Re: Need help with lua? - LunaLua General Help

Postby timocomsmbx2345 » Sat Jan 28, 2017 8:52 pm

I loaded the custom lotus file and i have a npcdata.json file, and when i typed in "palm tree" literally nothing happened.
Image

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 Jan 28, 2017 8:56 pm

timocomsmbx2345 wrote:I loaded the custom lotus file and i have a npcdata.json file, and when i typed in "palm tree" literally nothing happened.
viewtopic.php?f=87&t=13826


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 5 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari