• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua [TFS 1.3] [Error - CreatureEvent::configureEvent] - Modal windows error

Kuantikum

Member
Joined
Jul 3, 2015
Messages
201
Solutions
1
Reaction score
15
Hello,

Im using TFS 1.3 and i get this error:

Lua:
[Error - CreatureEvent::configureEvent] Invalid type for creature event: Modal_tpsystem
[Warning - BaseEvents::loadFromXml] Failed to configure event

Using this script:
Lua:
<event type="ModalWindow" name="Modal_tpsystem" script="others/teleport.lua"/>
Lua:
local function check_cond(p, t)
    local pg = t.pago
    if (pg) then
        local ct = t.custo
        if not (p:removeMoney(ct)) then
            p:sendCancelMessage(TP_MODAL_SYSTEM.msgs.mny:format(t.custo))
            return false
        end
    end
    p:getPosition():sendMagicEffect(CONST_ME_POFF)
    p:teleportTo(t.pos)
    p:getPosition():sendMagicEffect(CONST_ME_BATS)
end

local function rem_pl(p)
    if (TP_MODAL_SYSTEM.locais_wp[p:getGuid()]) then
        TP_MODAL_SYSTEM.locais_wp[p:getGuid()] = nil
    end
end

function onModalWindow(player, modalWindowId, buttonId, choiceId)
    player:unregisterEvent("Modal_tpsystem")
    if (modalWindowId == TP_MODAL_SYSTEM.id) then
        if (buttonId == 101) then
            local tp_tgt = TP_MODAL_SYSTEM.locais[choiceId]
            if (tp_tgt) then
                check_cond(player, tp_tgt)
            else
                local tp_tgt_w = TP_MODAL_SYSTEM.locais_wp[player:getGuid()]
                if (tp_tgt_w) then
                    check_cond(player, TP_MODAL_SYSTEM.locais_wp[player:getGuid()][choiceId - #TP_MODAL_SYSTEM.locais])
                end
            end
        end
        rem_pl(player)
    end
    return true
end

Can you help me?
 

Snavy

Bakasta
Senator
Joined
Apr 1, 2012
Messages
1,243
Solutions
71
Reaction score
570
Location
Hell
OP
OP
Kuantikum

Kuantikum

Member
Joined
Jul 3, 2015
Messages
201
Solutions
1
Reaction score
15

Snavy

Bakasta
Senator
Joined
Apr 1, 2012
Messages
1,243
Solutions
71
Reaction score
570
Location
Hell
Sorry, but I did not understand where the change should be made

View attachment 55815

Here:
XML:
<event type="ModalWindow" name="Modal_tpsystem" script="others/teleport.lua"/>
change to:
XML:
<event type="modalwindow" name="Modal_tpsystem" script="others/teleport.lua"/>

Edit:
The error msg did not appear on console when I tried it with both modalwindow and ModalWindow.
... which is the expected behaviour since it's converted to lowercase in sources:
std::string tmpStr = asLowerCaseString(typeAttribute.as_string());

hmmmm 🤔
 
Last edited:
OP
OP
Kuantikum

Kuantikum

Member
Joined
Jul 3, 2015
Messages
201
Solutions
1
Reaction score
15
Here:
XML:
<event type="ModalWindow" name="Modal_tpsystem" script="others/teleport.lua"/>
change to:
XML:
<event type="modalwindow" name="Modal_tpsystem" script="others/teleport.lua"/>

Edit:
The error msg did not appear on console when I tried it with both modalwindow and ModalWindow.
... which is the expected behaviour since it's converted to lowercase in sources:
std::string tmpStr = asLowerCaseString(typeAttribute.as_string());

hmmmm 🤔

Same error:

[Error - CreatureEvent::configureEvent] Invalid type for creature event: Modal_tpsystem
[Warning - BaseEvents::loadFromXml] Failed to configure event
 
Top