Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix onTime event #4846

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ArturKnopik
Copy link
Contributor

Pull Request Prelude

  • I have followed [proper The Forgotten Server code styling][code].
  • I have read and understood the [contribution guidelines][cont] before making this PR.
  • I am aware that this PR may be closed if the above-mentioned criteria are not fulfilled.

Changes Proposed

fix onTime event

Issues addressed:
#4841

@@ -138,12 +138,8 @@ void GlobalEvents::timer()
continue;
}

nextExecutionTime = 86400000;
Copy link
Contributor Author

@ArturKnopik ArturKnopik Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what it was for, maybe there's something I don't know about, actualy we set 24h interval

@ArturKnopik
Copy link
Contributor Author

ArturKnopik commented Nov 20, 2024

Additional note:

int LuaScriptInterface::luaGlobalEventTime(lua_State* L)

in lua we are using old style to retrieve time (time(nullptr) instead OTSYS_TIME())

Copy link
Contributor

@ramon-bernardo ramon-bernardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, to test just use:

local event = GlobalEvent("4846")

function event.onTime(interval)
	Game.broadcastMessage("1 second...", MESSAGE_STATUS_WARNING)
	return true
end

event:interval(1000)
event:register()

@ramon-bernardo ramon-bernardo mentioned this pull request Nov 23, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants