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

TFS 1.4.2 onMoveItem does not react?

Marko999x

999x era
Premium User
Joined
Dec 14, 2017
Messages
2,864
Solutions
82
Reaction score
1,967
Location
Germany
For some reason item can still be moved, idk why.
It worked perfect on TFS 1.5 while TFS 1.4.2 react weird.
Maybe you guys can see the problem here :D

Lua:
local ids = {9999, 6000}

local ec = EventCallback

ec.onMoveItem = function(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
    if table.contains(ids, item:getActionId()) and toPosition.x ~= CONTAINER_POSITION then
        self:sendTextMessage(MESSAGE_INFO_DESCR, 'This item can not be moved.')
        return RETURNVALUE_NOTPOSSIBLE
    end
    return RETURNVALUE_NOERROR

end
ec:register()
 
Last edited:
I just found something we could attribute the weird behavior on the system
The system uses pairs as the iterator to iterate through an array, it should be ipairs to fully guaranteed the order of execution.


Even if you apply the fix I mentioned? For the onMoveItem

That is a helluva catch. Now I am undecided which version I want to use, I suppose the nekiro version is still better once switched to ipairs.

The thing is this, 1.4.2 is the version we were talking about having the problem on, not nekiro's downgrade. So now I am curious what server @Xikini is using?
 
Both systems are pretty much the same, they use the same base (at least nekiro's).
I would definitely choose 1.5 version over 1.4.2, yep!
 
That is a helluva catch. Now I am undecided which version I want to use, I suppose the nekiro version is still better once switched to ipairs.

The thing is this, 1.4.2 is the version we were talking about having the problem on, not nekiro's downgrade. So now I am curious what server @Xikini is using?
Default 1.4.2
But I mean, I'm not really using it. xD
Only installed it to do the free scripting service.
 
My base has been modified and updated with 123 commits by Evil Punker. Now it's at 70 commits, totaling 193 that have been updated in my source. I've tested it several times and haven't noticed anything strange; everything seems to be working well. However, can someone confirm if everything is okay or not? I've tried inputting -1, -2, -3 all the way to -99999, and it has worked fine; I didn't notice anything unusual. If I don't use negative numbers, it doesn't work; it's necessary to use -1 or -3 and so on. I've attached a video for you to better understand.

If I use a strange negative number like '-1231545', is there no problem? If not, I'll feel relieved and can create other systems the way I want. Thank you!

 
Last edited:
Just apply the fixes I mentioned or update your eventcallback.lua as Evil Hero suggested and all should be ok.

If I don't use negative numbers, it doesn't work; it's necessary to use -1 or 2- and so on
Assuming that you only have that callback and the default callback, could be possible that the callback with negative index is being executed after the default callback <index: 0> due the use of pairs instead of ipairs
 
Assuming that you only have that callback and the default callback, could be possible that the callback with negative index is being executed after the default callback <index: 0> due the use of pairs instead of ipairs
My TFS 1.4.3 base was updated three months ago, so everything is fine, thank God.

1712968785019.png
 
Back
Top