• 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.1 Problem

Felipe Monteiro

Webmaster
Joined
Feb 27, 2009
Messages
460
Reaction score
59
Location
Brasil
This kind of addEvent is valid on tfs 1.1 ?

addEvent(doSummonCreature, 62000+6*20*1000, "Deathstrike", posDeathstriker)
addEvent(doSendMagicEffect, 6*20*1000, posDeathstriker, CONST_ME_TELEPORT)
addEvent(TirarCristal, 6*20*1000)
addEvent(doCreateTeleport, 100+6*20*1000, 1387, salaDeathstriker, posdotp)
addEvent(removerTp, 60000+6*20*1000)
addEvent(doCreateItem, 61000+6*20*1000, 17999, posdotp)
addEvent(setGlobalStorageValue, 6*20*1000 + 30*60*1000, 96973, 0)
 
Code:
addEvent(function (arg1, arg2) print(arg1, arg2) end, 5 * 1000, arg1, arg2)
addEvent(externalFunction, 5 * 1000)

Use code tags.
 
Today my server crash, and log show Segmentation fault. This is the problem ?
removerTp
TirarCristal
Is what I would first look at (if the crash log says it's the addEvent function.
Imposible to say without the codes etc, if you want help then send me a pm with everything you know.
 
At the moment you cannot assume the validity of any of userdata passed to an event callback. Any access to "volatile" user data (in other words, things that can be removed from the game, like players or items) causes undefined behavior. Doing a reload will potentially invalidate userdata that would otherwise be safe to access (Spells, MonsterTypes etc.). I'm looking into modifying the scripting system so that all references would remain valid at all times (though they could still point to objects that are no longer used, for example dead players) and wouldn't crash the server.
 
At the moment you cannot assume the validity of any of userdata passed to an event callback. Any access to "volatile" user data (in other words, things that can be removed from the game, like players or items) causes undefined behavior. Doing a reload will potentially invalidate userdata that would otherwise be safe to access (Spells, MonsterTypes etc.). I'm looking into modifying the scripting system so that all references would remain valid at all times (though they could still point to objects that are no longer used, for example dead players) and wouldn't crash the server.

There isen't any reason to push userdata values to a scheduled event, just go with the unique id of the thing you are indexing and then validate it in an if statment.
 
Efficiency my dear Watson, efficiency... Obtaining userdata from an id requires O(logN) complexity (with considerable constants). If we used ref counting with objects passed to user data we could have amortized constant access to them.
 
Efficiency my dear Watson, efficiency... Obtaining userdata from an id requires O(logN) complexity (with considerable constants). If we used ref counting with objects passed to user data we could have amortized constant access to them.

Well that is the point of a userdata value, create an object that is valid for the period of time the object is there.
And it's bad practise to push userdata values to any scheduled events.
 
Back
Top