tgmengatto
New Member
- Joined
- Apr 14, 2023
- Messages
- 3
- Reaction score
- 0
Hello,
I am trying to implement the ModalWindow to an old TFS version (8.0).
Everything is working properly, except for the onModalWindow event.
So I can see the Window, but when clicking on buttons, nothing happens.
I have copied all things that I found related to ModalWindow, even the providing the CreatureEvent functions to the luascript.cpp
This is the error showing on the terminal:
And the error is exactly on following line on compat.lua
Since I had to implement it by myself, copying from TFS updated source, I may have missed something.
Can you please help me?
Thank you so much
_____
EDIT
I had progress.
The error now is on this snippet on creatureevent.cpp
Which is triggered by the last line of "modal_window_helper.lua"
The error:
I am trying to implement the ModalWindow to an old TFS version (8.0).
Everything is working properly, except for the onModalWindow event.
So I can see the Window, but when clicking on buttons, nothing happens.
I have copied all things that I found related to ModalWindow, even the providing the CreatureEvent functions to the luascript.cpp
Lua:
// CreatureEvent
registerClass("CreatureEvent", "", LuaScriptInterface::luaCreateCreatureEvent);
registerMethod("CreatureEvent", "type", LuaScriptInterface::luaCreatureEventType);
registerMethod("CreatureEvent", "register", LuaScriptInterface::luaCreatureEventRegister);
registerMethod("CreatureEvent", "onLogin", LuaScriptInterface::luaCreatureEventOnCallback);
registerMethod("CreatureEvent", "onLogout", LuaScriptInterface::luaCreatureEventOnCallback);
registerMethod("CreatureEvent", "onThink", LuaScriptInterface::luaCreatureEventOnCallback);
registerMethod("CreatureEvent", "onPrepareDeath", LuaScriptInterface::luaCreatureEventOnCallback);
registerMethod("CreatureEvent", "onDeath", LuaScriptInterface::luaCreatureEventOnCallback);
registerMethod("CreatureEvent", "onKill", LuaScriptInterface::luaCreatureEventOnCallback);
registerMethod("CreatureEvent", "onAdvance", LuaScriptInterface::luaCreatureEventOnCallback);
registerMethod("CreatureEvent", "onModalWindow", LuaScriptInterface::luaCreatureEventOnCallback);
registerMethod("CreatureEvent", "onTextEdit", LuaScriptInterface::luaCreatureEventOnCallback);
registerMethod("CreatureEvent", "onHealthChange", LuaScriptInterface::luaCreatureEventOnCallback);
registerMethod("CreatureEvent", "onManaChange", LuaScriptInterface::luaCreatureEventOnCallback);
registerMethod("CreatureEvent", "onExtendedOpcode", LuaScriptInterface::luaCreatureEventOnCallback);
This is the error showing on the terminal:
[Warning - Event::loadCallback] Event onModalWindow not found.
And the error is exactly on following line on compat.lua
Code:
elseif key == "onModalWindow" then
self:type("modalwindow")
self:onModalWindow(value) -- HERE
return
Since I had to implement it by myself, copying from TFS updated source, I may have missed something.
Can you please help me?
Thank you so much
_____
EDIT
I had progress.
The error now is on this snippet on creatureevent.cpp
Lua:
CreatureEvent* CreatureEvents::getEventByName(const std::string& name, bool forceLoaded /*= true*/)
{
auto it = creatureEvents.find(name); // ISSUE IS HERE on find()
if (it != creatureEvents.end()) {
if (!forceLoaded || it->second.isLoaded()) {
return &it->second;
}
}
return nullptr;
}
Which is triggered by the last line of "modal_window_helper.lua"
Lua:
creatureEvent:register()
The error:
Last edited: