azerothcore / mod-eluna

Eluna Lua Engine © for WoW Emulators
https://elunaluaengine.github.io/
GNU General Public License v3.0
101 stars 131 forks source link

Scripts not being loaded #188

Closed Baudin999 closed 4 months ago

Baudin999 commented 4 months ago

My scripts do not load or are executed.

I have pulled the latest version from github of azerothcore (2 days ago). I have installed the mod like this (btw, I am on Windows):

cd modules
git clone https://github.com/azerothcore/mod-eluna.git mod-eluna

I rebuild by doing:

docker compose up --build -d

This builds and starts the server. The lua_scripts folder is successfully created.

When I add the following script to lua_scripts:

local function OnLogin(event, player)
    local playerName = player:GetName()
    player:SendBroadcastMessage("Hello " .. playerName .. "!")
    print("Player " .. playerName .. " has logged in. Hello message sent.")
end

RegisterPlayerEvent(3, OnLogin) 

Nothing happens when I start the server.

I can attach to my world server: docker attach ac-worldserver And execute: reload eluna nothing happens

AC> reload eluna
AC> AC>

I also, when the server starts, do not see any server logs in docker that the mod was picked up. The only evidence that something is happening is the creation of the lua_scripts folder.

55Honey commented 4 months ago

reload eluna nothing happens

Nothing at all? Or an error message indicating the command doesn't exist?

I'm guessing your server looks for lua scripts in the wrong folder. Try setting the folder to an absolute one instead of relative.

Baudin999 commented 4 months ago

Hi, when using reload eluna absolutely nothing happens.

When I start my server I see this, so some things are found:

2024-07-14 08:52:12 > Using configuration file       /azerothcore/env/dist/etc/worldserver.conf
2024-07-14 08:52:12 > Using SSL version:             OpenSSL 3.0.2 15 Mar 2022 (library: OpenSSL 3.0.2 15 Mar 2022)
2024-07-14 08:52:12 > Using Boost version:           1.74.0
2024-07-14 08:52:12  
2024-07-14 08:52:12 Can't set process priority class, error: Permission denied
2024-07-14 08:52:12  
2024-07-14 08:52:12 Loading Modules Configuration...
2024-07-14 08:52:12  
2024-07-14 08:52:12 Using modules configuration:
2024-07-14 08:52:12 > mod_LuaEngine.conf.dist

How can I setup my server to look in the correct folder? Should I do an env variable in the docker compose? Or would you advice something else?

55Honey commented 4 months ago

Go by the general guide for conf files in the wiki:

Baudin999 commented 4 months ago

I have made a copy and changed the name to mod_LuaEngine.conf. Strangely enough in the server I still see:

2024-07-14 09:07:28 Using modules configuration:
2024-07-14 09:07:28 > mod_LuaEngine.conf.dist

I have deleted the .dist version and it still gives the same message. I have removed all volumes and builds just to be sure that nothing is cached. I now have a clean install with only a \modules\conf\mod_LuaEngine.conf file and the output in the server is different. There is no message of the mod being loaded anymore, but instead, somewhere in the middle I now get:

2024-07-14 09:16:18 > Config: Missing property Eluna.ScriptPath in config file /azerothcore/env/dist/etc/worldserver.conf, add "Eluna.ScriptPath = lua_scripts" to this file or define 'AC_ELUNA_SCRIPT_PATH' as an environment variable.
2024-07-14 09:16:18 > Config: Missing property Eluna.Enabled in config file /azerothcore/env/dist/etc/worldserver.conf, add "Eluna.Enabled = 1" to this file or define 'AC_ELUNA_ENABLED' as an environment variable.

I have added the following to the worldserver.conf:

Eluna.Enabled = 1
Eluna.ScriptPath = "C:\Users\*******\Projects\azerothcore-wotlk\backend\lua_scripts"

My mod_LuaEngine.conf file has the following configuration:

Eluna.Enabled = true
Eluna.TraceBack = false
Eluna.ScriptPath = "C:\Users\*******\Projects\azerothcore-wotlk\backend\lua_scripts"
Eluna.PlayerAnnounceReload = false

Note: My project setup is that I have a azerothcore-wotlk folder and in that I have all the tools and client, including the backend. So my server is in the backend folder.

But still nothing....

Baudin999 commented 4 months ago

Oh my, I think I've solved it....feeling silly to admit this, but the path was incorrect, needed the path in the docker container which was:

Eluna.ScriptPath = "/azerothcore-wotlk/lua_scripts"

Now it seems to work

Baudin999 commented 4 months ago

@55Honey what is the best way for me to contribute this to the documentation? I would like to write this up so that others may benefit from my learnings.

55Honey commented 4 months ago

I now have a clean install with only a \modules\conf\mod_LuaEngine.conf file

You're not supposed to remove the .dist file. That should be in the docs already.

what is the best way for me to contribute this to the documentation?

The wiki accepts PRs here: https://github.com/azerothcore/wiki/