- Joined
- Oct 24, 2012
- Messages
- 6,545
Updated and moved to spell section.
Last edited:
^ Its pauses timer in the code right?
ive been told do not pause repeating timers. if u pause them destroy them and remake them. what should i do then ?
If you pause a periodic timer and then resume it, it won't be periodic anymore. I think if you restart it again as a periodic, it will work ok.
struct Items extends array
function PauseItemTimer takes boolean b returns nothing
function DoNotRemoveItem takes item itm, boolean b returns nothing
function RemoveItemWithDiffTime takes item i, integer T returns nothing
DoNotRemoveItem
isn't a proper function name in any programming/scripting language.struct Items
is too vague. The name should be referring to some sort of recycler or recycling unit.ItemSweeper
or MapItemCleaner
or whatever. Anything specific to this library would be good.PauseItemTimer
is also a pretty bad name as it can be referring to any timer that deals with items.struct ItemSweeper extends array
static method start takes nothing returns nothing
static method pause takes nothing returns nothing
static method resume takes nothing returns nothing
static method isPaused takes nothing returns boolean
static method isRunning takes nothing returns boolean
static method protectItem takes item it returns nothing
static method unprotectItem takes item it returns nothing
static method isItemProtected takes item it returns boolean
static method setItemExpiration takes item it, real time returns nothing
static method getItemExpiration takes item it returns real
endstruct
CreateItem
or at least provide a function for creating items that would index the items on its own. static method createItemPlusIndex takes integer id, real x, real y returns item // better name ?
local item itm
local thistype this
set itm = CreateItem( id, x, y)
call this.create( itm)
return itm
endmethod
globals
private item tempItem = null
endglobals
function CreateItemEx takes integer itemId, real x, real y returns item
set tempItem = CreateItem(itemId, x, y)
call thistype.create(tempItem)
return tempItem
endfunction
deathismyfriend said:Also how fast is Getwidgetlife ? i am using this every second. so if you think tht is too much to do in a second then i will have to change tht.
deathismyfriend said:which one is the way i should do it in my system ? i could put it in as a struct or a function.
Almia said:Mag
ItemDex?
deathismyfriend said:the other thing to take in as consideration is how fast is enumerating through items with a condition tht checks if its in Table ?
deathismyfriend said:the only other thing to deal w after this is to decide whats the best way to add items to the system tht drop on unit death. i could put a requirement tht all item drops tht deal w a unit death have to be triggered. which i believe most are triggered anyways. i do not believe this will affect when a unit has an inventory and drops items on death.
ItemTable.has( GetHandleID( item))
if GetItemTypeId != 0 then
block around RemoveItem and SetWidgetLife.static method addItem takes item itm returns nothing
local thistype data = thistype.create( itm)
endmethod
static method addItem takes item itm returns nothing
call create(itm)
endmethod
TriggerRegisterAnyUnitEventBJ
private static method addManipItem takes nothing returns boolean
/* passes manipulated items to AddItem method and checks if timer is running */
local item itm = GetManipulatedItem()
local thistype data
if not itemTable.has(GetHandleId( itm)) and not dontRemoveItem.has(GetHandleId( itm)) then
call data.create( itm)
endif
return false
endmethod
GetPlayableMapRect()
BJ call create(itm)
.if not itemTable.has( id) or not dontRemoveItem.has( id) then
call itemTable.remove( id)
call dontRemoveItem.remove( id)
endif
RemoveItemTimed
with TimedHandles.I don't see the point in this since there's no (accurate) item indexing.
People should just use a simple timer + item queue (or dynamic timers) orRemoveItemTimed
with TimedHandles.