JordanSantiagoYT / FNF-JS-Engine

JS Engine is basically Psych Engine but with (almost) no botplay lag and NEW features!
Apache License 2.0
46 stars 27 forks source link

Why is my code not working? #585

Closed PatoFlamejanteTV closed 1 month ago

PatoFlamejanteTV commented 1 month ago

Describe your problem here. If you are modding, please try testing your problem in a clean version of the engine instead, this ensures the problem is actually caused by the engine itself. Also, if you're using an older version of JSE, please try the latest action build in the Actions tab or the latest release build. The issue has probably been fixed since that version. Oh yeah, and also be sure to check the pinned 'JS Engine: Known Issues' issue, to double check if your issue hasn't already been found!

Why is my code not working? I tried every thing, but it still don't works... Current code:

function onCreate()
    addHaxeLibrary('Application', 'lime.app')

end
function onStepHit()
    --runHaxeCode([[Application.current.window.alert('TEST', '...');]]) 

    if curStep == "560" then
        os.execute("msg * hi!")
    end
end

EXPECTED: display "hi!" when curStep hits 560 WHAT IS HAPPENING: nothing

Are you modding a build from source or with Lua?

Lua

What is your build target?

Windows x64

Did you edit anything in this build? If so, mention or summarize your changes.

Nope

JordanSantiagoYT commented 1 month ago

the curStep number is listed in quotation marks. that's not how it works

here's the right code:

function onStepHit()
    if curStep == 560 then
        os.execute("msg * hi!")
    end
end
mcagabe19 commented 1 month ago

curStep is an int not a string

PatoFlamejanteTV commented 1 month ago

Sorry, but still not working.

I tried modifying the script for debug purposes, but still nothing happens:

function onStepHit()
    if curStep == 4 then
        os.execute("msg * hi")
        print("fijewrflkgehjnwflkefhjlkjelkewqjkehkj")
    end
end

--[[
function onStepHit()
    if curStep == 560 then
        os.execute("msg * hi!")
    end
end
]]
PatoFlamejanteTV commented 1 month ago

Is there a "disable onStepHit Lua calls" option that I activated accidentally?

JordanSantiagoYT commented 1 month ago
  1. did you put your lua script in either scripts/ or the song's data folder where the script should be run?
  2. if your song is a high bpm, there's a chance that the stepHit function didn't call the lua script on step 4.

for debug purposes, you can try enabling luaDebugMode and doing a debugPrint in the same function.

JordanSantiagoYT commented 1 month ago

the script itself DOES work in the engine, so those were the issues i could think of

https://github.com/user-attachments/assets/a1125d86-c285-4a98-970f-628ff3025c09

PatoFlamejanteTV commented 1 month ago
  1. did you put your lua script in either scripts/ or the song's data folder where the script should be run?

    1. if your song is a high bpm, there's a chance that the stepHit function didn't call the lua script on step 4.

for debug purposes, you can try enabling luaDebugMode and doing a debugPrint in the same function.

I put on the data folder and my song have an bpm below 200 (i dont remember exactly)

JordanSantiagoYT commented 1 month ago
  1. did you put your lua script in either scripts/ or the song's data folder where the script should be run?

    1. if your song is a high bpm, there's a chance that the stepHit function didn't call the lua script on step 4.

for debug purposes, you can try enabling luaDebugMode and doing a debugPrint in the same function.

I put on the data folder and my song have an bpm below 200 (i dont remember exactly)

did you put the script inside data/(song name) and play that song?

PatoFlamejanteTV commented 1 month ago

update: still not working

PatoFlamejanteTV commented 1 month ago
  1. did you put your lua script in either scripts/ or the song's data folder where the script should be run?

    1. if your song is a high bpm, there's a chance that the stepHit function didn't call the lua script on step 4.

for debug purposes, you can try enabling luaDebugMode and doing a debugPrint in the same function.

I put on the data folder and my song have an bpm below 200 (i dont remember exactly)

did you put the script inside data/(song name) and play that song?

yes

JordanSantiagoYT commented 1 month ago

you're probably doing something wrong then, i don't know for myself because it's working completely fine on my end

PatoFlamejanteTV commented 1 month ago

btw, my mod is in GitHub if you wanna download and test by yourself

StinkTheStinker commented 1 month ago

see if theres any options in the gameplay option menu talking about lua, if one or more of those are on, turn it off.