Need help with lua? - LunaLua General Help

Post here for help and support regarding LunaLua and SMBX2's libraries and features.

Moderator: Userbase Moderators

Lusho
Blooper
Blooper
Posts: 163
Joined: Wed Dec 25, 2019 11:39 pm
Flair: Intention is what matters
Pronouns: he/him

Re: Need help with lua? - LunaLua General Help

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

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

Goldenemerl64
Fighter Fly
Fighter Fly
Posts: 38
Joined: Tue Jul 07, 2020 3:50 pm

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?

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

Goldenemerl64
Fighter Fly
Fighter Fly
Posts: 38
Joined: Tue Jul 07, 2020 3:50 pm

Re: Need help with lua? - LunaLua General Help

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

ok

Goldenemerl64
Fighter Fly
Fighter Fly
Posts: 38
Joined: Tue Jul 07, 2020 3:50 pm

Re: Need help with lua? - LunaLua General Help

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

It's Still Not Working!

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

Goldenemerl64
Fighter Fly
Fighter Fly
Posts: 38
Joined: Tue Jul 07, 2020 3:50 pm

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

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

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.

Goldenemerl64
Fighter Fly
Fighter Fly
Posts: 38
Joined: Tue Jul 07, 2020 3:50 pm

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

DrMekar
Eerie
Eerie
Posts: 786
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
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.

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

Goldenemerl64
Fighter Fly
Fighter Fly
Posts: 38
Joined: Tue Jul 07, 2020 3:50 pm

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.

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

Goldenemerl64
Fighter Fly
Fighter Fly
Posts: 38
Joined: Tue Jul 07, 2020 3:50 pm

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?

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

Goldenemerl64
Fighter Fly
Fighter Fly
Posts: 38
Joined: Tue Jul 07, 2020 3:50 pm

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. :)

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 » Sat Jul 25, 2020 9:14 am

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

Goldenemerl64
Fighter Fly
Fighter Fly
Posts: 38
Joined: Tue Jul 07, 2020 3:50 pm

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 ';' "

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

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari