Page 13 of 15

Re: Need help with lua? - LunaLua General Help

Posted: Wed Jul 08, 2020 12:04 am
by CJ_RLushi
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

Re: Need help with lua? - LunaLua General Help

Posted: Wed Jul 08, 2020 1:15 am
by Hoeloe
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!

Re: Need help with lua? - LunaLua General Help

Posted: Thu Jul 09, 2020 2:20 pm
by Goldenemerl64
Image
Is This The Correct Version? or no?

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 10, 2020 12:24 am
by Hoeloe
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.

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 10, 2020 12:44 am
by Goldenemerl64
ok

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 10, 2020 10:05 pm
by Goldenemerl64
It's Still Not Working!

Re: Need help with lua? - LunaLua General Help

Posted: Sat Jul 11, 2020 8:09 am
by Enjl
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.

Re: Need help with lua? - LunaLua General Help

Posted: Sat Jul 11, 2020 10:10 am
by Goldenemerl64
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

Re: Need help with lua? - LunaLua General Help

Posted: Sat Jul 18, 2020 5:13 pm
by Fuyu
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.

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 24, 2020 8:52 am
by Goldenemerl64
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

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 24, 2020 8:57 am
by DrMekar
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.

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 24, 2020 12:36 pm
by Hoeloe
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.

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 24, 2020 6:34 pm
by Goldenemerl64
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.

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 24, 2020 8:00 pm
by Hoeloe
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.

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 24, 2020 11:10 pm
by Goldenemerl64
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?

Re: Need help with lua? - LunaLua General Help

Posted: Fri Jul 24, 2020 11:53 pm
by Hoeloe
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.

Re: Need help with lua? - LunaLua General Help

Posted: Sat Jul 25, 2020 1:39 am
by Goldenemerl64
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. :)

Re: Need help with lua? - LunaLua General Help

Posted: Sat Jul 25, 2020 9:14 am
by Hoeloe
You... don't need to copy the lua files, just load them using "require".

Re: Need help with lua? - LunaLua General Help

Posted: Sat Jul 25, 2020 8:06 pm
by Goldenemerl64
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 ';' "

Re: Need help with lua? - LunaLua General Help

Posted: Sun Jul 26, 2020 10:21 am
by Hoeloe
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.