• 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!

RevScripts onEquip C++ Exception

Xikini

I whore myself out for likes
Senator
Premium User
Joined
Nov 17, 2010
Messages
6,788
Solutions
581
Reaction score
5,354
Basically just using a bare-bones script to make sure it was working.. and it isn't. xD

It's such a generic error google was basically no help.

Only thing I could think to try was to download and install a fresh tfs 1.3, but still getting the same error.
Code:
The Forgotten Server - Version 1.3

Compiled with Microsoft Visual C++ version 14.2
Compiled on Aug 23 2020 08:20:14 for platform x64
Linked with LuaJIT 2.0.5 for Lua support

A server developed by Mark Samman
Visit our forum for updates, support, and resources: https://otland.net/.

Error (occurs during server start or /reload)
Code:
Lua Script Error: [Scripts Interface]
C:\Xikini_OTS\forgottenserver\data\scripts\movements\vocational_item_bonus.lua
C++ exception
> vocational_item_bonus.lua [error]
^
code
Lua:
local moveEvent = MoveEvent()

moveEvent:type("equip")

function moveEvent.onEquip(player, item, slot)
    print(player, item, slot)
    if player:getName() == "Xikini" then
        return true
    end
    return false
end

moveEvent:register()

Not sure what to do.

Anyone got some idea's?
Post automatically merged:

It seems that it was my fault.

You need to add the itemid parameters to it. xD
Lua:
local moveEvent = MoveEvent()

moveEvent:type("equip")

function moveEvent.onEquip(player, item, slot)
    print(player, item, slot)
    if player:getName() == "Xikini" then
        return true
    end
    return false
end

moveEvent:id(2651)
moveEvent:register()

And oddly, I think the multi-equip issue still persists in TFS 1.3?

Easy to get around after checking source and seeing 'isCheck' is the 4th parameter.
Lua:
userdata: 0x04db5200    userdata: 0x04d5aaf0    4       true
userdata: 0x0490ee90    userdata: 0x04c5d5d0    4       true
userdata: 0x049201c0    userdata: 0x049635f8    4       false

So to fix the above issue, just wrap everything inside isCheck
Lua:
local moveEvent = MoveEvent()

moveEvent:type("equip")

function moveEvent.onEquip(player, item, slot, isCheck)
    if not isCheck then
        print(player, item, slot, isCheck)
        if player:getName() == "Xikini" then
            return true
        end
        return false
    end
    return true
end

moveEvent:id(2651)
moveEvent:register()
 
Last edited:
Back
Top