Need help with lua? - LunaLua General Help

Post here for help and support regarding LunaLua and SMBX2's libraries and features.
User avatar
CJ_RLushi
Hoopster
Hoopster
Posts: 150
Joined: Wed Dec 25, 2019 11:39 pm
Flair: Intention is what matters
Current Project: Another Super Mario Bros. 3 Remake [SMBX2]

Re: Need help with lua? - LunaLua General Help

Postby CJ_RLushi » Wed Jul 08, 2020 12:04 am

I noticed you have that "other not it the tab" custom tileset, turns out those are not in the tab because they are just hidden, those dudes are unfinished, thats why you aren't supposed to use them, and so, thats why the devs hid them

If I had to say something, its probably due to those other NPCs, might be wrong and this could be just because of another thing, but you shouldnt use those unfinished things
My episode lol:
Image

User avatar
Hoeloe
Kamikaze Koopa
Kamikaze Koopa
Posts: 1236
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Current Project: A2XT Episode 2

Re: Need help with lua? - LunaLua General Help

Postby Hoeloe » Wed Jul 08, 2020 1:15 am

I believe that error can occur if you're using an old version of Beta 4. Make sure you have the most recent version downloaded!

User avatar
Goldenemerl64
Cheep-Cheep
Cheep-Cheep
Posts: 15
Joined: Tue Jul 07, 2020 3:50 pm
Current Project: Super Mario Adventure (not the best, but fun to make)

Re: Need help with lua? - LunaLua General Help

Postby Goldenemerl64 » Thu Jul 09, 2020 2:20 pm

Image
Is This The Correct Version? or no?

User avatar
Hoeloe
Kamikaze Koopa
Kamikaze Koopa
Posts: 1236
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Current Project: A2XT Episode 2

Re: Need help with lua? - LunaLua General Help

Postby Hoeloe » Fri Jul 10, 2020 12:24 am

Checking PGE for updates isn't going to update your engine. SMBX2 Beta 4 patch 2.1 is the latest version, which you can download from http://codehaus.moe.

User avatar
Goldenemerl64
Cheep-Cheep
Cheep-Cheep
Posts: 15
Joined: Tue Jul 07, 2020 3:50 pm
Current Project: Super Mario Adventure (not the best, but fun to make)

Re: Need help with lua? - LunaLua General Help

Postby Goldenemerl64 » Fri Jul 10, 2020 12:44 am

ok

User avatar
Goldenemerl64
Cheep-Cheep
Cheep-Cheep
Posts: 15
Joined: Tue Jul 07, 2020 3:50 pm
Current Project: Super Mario Adventure (not the best, but fun to make)

Re: Need help with lua? - LunaLua General Help

Postby Goldenemerl64 » Fri Jul 10, 2020 10:05 pm

It's Still Not Working!

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8735
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Need help with lua? - LunaLua General Help

Postby Enjl » Sat Jul 11, 2020 8:09 am

Goldenemerl64 wrote:
Fri Jul 10, 2020 10:05 pm
It's Still Not Working!
Did you try CJ's advice of not using unfinished content? Check first post on this page.
Ideas are useless if you can't make them real.
Image

User avatar
Goldenemerl64
Cheep-Cheep
Cheep-Cheep
Posts: 15
Joined: Tue Jul 07, 2020 3:50 pm
Current Project: Super Mario Adventure (not the best, but fun to make)

Re: Need help with lua? - LunaLua General Help

Postby Goldenemerl64 » Sat Jul 11, 2020 10:10 am

I didn't add any of them in my levels. It shows that error for all of my levels.

Added in 12 minutes 17 seconds:
I finally Found Out The Problem! It seems like i have to Update my Levels,

Added in 3 minutes 46 seconds:
:) Thanks for helping,

:( Guess i have to make a new Project

Added in 10 minutes 49 seconds:
Sorry if i wasted your time :(

Added in 15 seconds:
Sorry if i wasted your time :(

Added in 5 minutes 27 seconds:
Turns Out I didn't have make a new episode after all I just had to add test to my level's names

User avatar
Fuyu
Wart
Wart
Posts: 3059
Joined: Sat Dec 21, 2013 2:40 pm
Current Project: Super Mario Fantasy
Chat Username: take a guess

Re: Need help with lua? - LunaLua General Help

Postby Fuyu » Sat Jul 18, 2020 5:13 pm

The Wiki seems to be down for some reason. Although it looks like it's a file problem.
Spoiler: show
Image
Added in 3 minutes 9 seconds:
Nvm, seems to be back up.
Image

User avatar
Goldenemerl64
Cheep-Cheep
Cheep-Cheep
Posts: 15
Joined: Tue Jul 07, 2020 3:50 pm
Current Project: Super Mario Adventure (not the best, but fun to make)

Re: Need help with lua? - LunaLua General Help

Postby Goldenemerl64 » Fri Jul 24, 2020 8:52 am

I'm having problems with the Auto scroll. Here is The Code

Code: Select all

local autoscroll = require("autoscroll")

function onStart()
    autoscroll.scrollRight(1)
end

function onTick()
    if player.deathTimer > 0 then return end
    if player;mem(0x148, FIELD_WORD) > 0
    and player;mem(0x14C, FIELD_WORD) > 0 then
        player;kill()

    end
end
When I didn't have the autoscroll on "level On Start", It did nothing.

But when i have the autoscroll on "Level on Start", It Moves To the End Of Section Immediately.

I need some help Please

User avatar
DrMekar
Koopa Shell
Koopa Shell
Posts: 663
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Current Project: Mario Heroes: The First Chapter Remade (MH1.5)
Chat Username: Doc
Contact:

Re: Need help with lua? - LunaLua General Help

Postby DrMekar » Fri Jul 24, 2020 8:57 am

Goldenemerl64 wrote:
Fri Jul 24, 2020 8:52 am
I'm having problems with the Auto scroll. Here is The Code

Code: Select all

local autoscroll = require("autoscroll")

function onStart()
    autoscroll.scrollRight(1)
end

function onTick()
    if player.deathTimer > 0 then return end
    if player;mem(0x148, FIELD_WORD) > 0
    and player;mem(0x14C, FIELD_WORD) > 0 then
        player;kill()

    end
end
When I didn't have the autoscroll on "level On Start", It did nothing.

But when i have the autoscroll on "Level on Start", It Moves To the End Of Section Immediately.

I need some help Please
I'm not sure why your Code is so long, so here's what I use:

Code: Select all

local autoscroll = require("autoscroll") 
function onLoadSection0() 
    autoscroll.scrollRight(.9) 
end
Feel free to just copy and paste it and change the Speed (.9) and Section to your needs.
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

User avatar
Hoeloe
Kamikaze Koopa
Kamikaze Koopa
Posts: 1236
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Current Project: A2XT Episode 2

Re: Need help with lua? - LunaLua General Help

Postby Hoeloe » Fri Jul 24, 2020 12:36 pm

Goldenemerl64 wrote:
Fri Jul 24, 2020 8:52 am
player;kill()
If your code isn't erroring, it's not running.

This should be player:kill(). A semicolon (;) is used as a marker for the end of a line, not as a member function. For that, you'd use a full colon (:), which is used similarly to a period (.) in Lua.

User avatar
Goldenemerl64
Cheep-Cheep
Cheep-Cheep
Posts: 15
Joined: Tue Jul 07, 2020 3:50 pm
Current Project: Super Mario Adventure (not the best, but fun to make)

Re: Need help with lua? - LunaLua General Help

Postby Goldenemerl64 » Fri Jul 24, 2020 6:34 pm

Oh ok, I'll see if it works.

Added in 15 minutes 47 seconds:
It's still not working It still Moves To the End Of Section Immediately.

User avatar
Hoeloe
Kamikaze Koopa
Kamikaze Koopa
Posts: 1236
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Current Project: A2XT Episode 2

Re: Need help with lua? - LunaLua General Help

Postby Hoeloe » Fri Jul 24, 2020 8:00 pm

Goldenemerl64 wrote:
Fri Jul 24, 2020 6:50 pm
Oh ok, I'll see if it works.

Added in 15 minutes 47 seconds:
It's still not working It still Moves To the End Of Section Immediately.
Was it producing an error message before? If it wasn't, then your Lua code wasn't even running. You likely didn't save the file correctly.

User avatar
Goldenemerl64
Cheep-Cheep
Cheep-Cheep
Posts: 15
Joined: Tue Jul 07, 2020 3:50 pm
Current Project: Super Mario Adventure (not the best, but fun to make)

Re: Need help with lua? - LunaLua General Help

Postby Goldenemerl64 » Fri Jul 24, 2020 11:10 pm

Hoeloe wrote:
Fri Jul 24, 2020 8:00 pm
Goldenemerl64 wrote:
Fri Jul 24, 2020 6:50 pm
Oh ok, I'll see if it works.

Added in 15 minutes 47 seconds:
It's still not working It still Moves To the End Of Section Immediately.
Was it producing an error message before? If it wasn't, then your Lua code wasn't even running. You likely didn't save the file correctly.
It wasn't producing an error message. How do i save the file Correctly?

User avatar
Hoeloe
Kamikaze Koopa
Kamikaze Koopa
Posts: 1236
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Current Project: A2XT Episode 2

Re: Need help with lua? - LunaLua General Help

Postby Hoeloe » Fri Jul 24, 2020 11:53 pm

Goldenemerl64 wrote:
Fri Jul 24, 2020 11:10 pm
It wasn't producing an error message. How do i save the file Correctly?
How did you create it? There should be a button in the editor under Scripts that allows you to open the local level script. That should create the correct file.

User avatar
Goldenemerl64
Cheep-Cheep
Cheep-Cheep
Posts: 15
Joined: Tue Jul 07, 2020 3:50 pm
Current Project: Super Mario Adventure (not the best, but fun to make)

Re: Need help with lua? - LunaLua General Help

Postby Goldenemerl64 » Sat Jul 25, 2020 1:39 am

Hoeloe wrote:
Fri Jul 24, 2020 11:53 pm
Goldenemerl64 wrote:
Fri Jul 24, 2020 11:10 pm
It wasn't producing an error message. How do i save the file Correctly?
How did you create it? There should be a button in the editor under Scripts that allows you to open the local level script. That should create the correct file.
I copied the autoscroll file and put in the code. When I open the Local Level Script and put the code in, It Worked, Thanks for the Help. :)

User avatar
Hoeloe
Kamikaze Koopa
Kamikaze Koopa
Posts: 1236
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Current Project: A2XT Episode 2

Re: Need help with lua? - LunaLua General Help

Postby Hoeloe » Sat Jul 25, 2020 9:14 am

You... don't need to copy the lua files, just load them using "require".

User avatar
Goldenemerl64
Cheep-Cheep
Cheep-Cheep
Posts: 15
Joined: Tue Jul 07, 2020 3:50 pm
Current Project: Super Mario Adventure (not the best, but fun to make)

Re: Need help with lua? - LunaLua General Help

Postby Goldenemerl64 » Sat Jul 25, 2020 8:06 pm

Oh, ok.

Added in 6 hours 12 minutes 35 seconds:

Code: Select all

local autoscroll = require("autoscroll") 
function onLoadSection0() 
    autoscroll.scrollRight(.5) 
end

function onTick()
    if player.deathTimer > 0 then return end
    if player;mem(0x148, FIELD_WORD) > 0
    and player;mem(0x14C, FIELD_WORD) > 0 then;
        player:kill()

    end
end

i Don't know what it means by "luna.lua:8: 'then' expected near ';' "

User avatar
Hoeloe
Kamikaze Koopa
Kamikaze Koopa
Posts: 1236
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Current Project: A2XT Episode 2

Re: Need help with lua? - LunaLua General Help

Postby Hoeloe » Sun Jul 26, 2020 10:21 am

Goldenemerl64 wrote:
Sun Jul 26, 2020 2:19 am

i Don't know what it means by "luna.lua:8: 'then' expected near ';' "

Like I said before, ; is NOT used to access functions. You should NOT be writing player;mem, but player:mem. You've used semicolons where they don't make sense.


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 0 guests