Difference between revisions of "Talk:Activation Functions"

Jump to navigation Jump to search
2,663 bytes added ,  15:12, 13 September 2007
no edit summary
imported>Guidobot
imported>Haama
Line 14: Line 14:
:::Interesting, but becareful about what you assume about the generality of 'activators'. I am still suspect about expecting an activator to be callable 1000 times in the same frame, especially if the OnActivate script is of any length. If this is true then you should be able to generate visible lag very easily (even w/o inventory redraws, etc.).
:::Interesting, but becareful about what you assume about the generality of 'activators'. I am still suspect about expecting an activator to be callable 1000 times in the same frame, especially if the OnActivate script is of any length. If this is true then you should be able to generate visible lag very easily (even w/o inventory redraws, etc.).
:::--[[User:Guidobot|Guidobot]] 12:27, 13 September 2007 (EDT)
:::--[[User:Guidobot|Guidobot]] 12:27, 13 September 2007 (EDT)
Not at all, I don't see any FPS drop until I run it 2000 times, and even then it's only 1 FPS. What seems to be important are the functions used, not the number of lines. Here's the script:
<pre>scn ITNumCheckerScript
ref  pItem
short ItemCount
short TempItemCount
short DiffNum
short InvPos
short LinkedListTotal
short LinkedListPos
begin onActivate
set LinkedListPos to (LinkedListPos + 1)
if pItem
set TempItemCount to (player.GetItemCount pItem)
if TempItemCount
set InvPos to (InvPos + 1)
endif
if (TempItemCount == ItemCount)
return ;Don't need to worry about changing ItemCount, it's the same as TempItemCount
elseif (TempItemCount < ItemCount) ;Lost Quantity
SetStage ITInvChangesDecreasedList 0
SetStage ITInvChangesRemovedList 0
ITInvChangesRemovedList.Changes
else ;if (TempItemCount > ItemCount) ;Gained Quantity
SetStage ITInvChangesIncreasedList 0
SetStage ITInvChangesAddedList 0
endif
set ItemCount to TempItemCount
;Setup new spot if needed
elseif (LinkedListPos > LinkedListTotal)
set pItem to (player.GetInventoryObject InvPos)
if (pItem == 0) ;No more items
set ITListManager.Counter to 254 ;Wraps everything up
return
elseif (ITLinkedListCont.GetItemCount pItem) ;If the player has picked up an item(s) that they've already picked up, then it won't be in the expected position above, and instead an item that's already in the linked list will be referenced, so check against a container full of linked list items
ITInvScanner.Activate player, 1
if (pItem == 0) ;No more items - just in case
set ITListManager.Counter to 254
return
endif
endif
set LinkedListTotal to (LinkedListTotal + 1)
ITLinkedListCont.AddItem pItem 1
set ITInvChangesNewList.Changes to (ITInvChangesNewList.Changes + 1)
SetStage ITInvChangesNewList ITInvChangesNewList.Changes
set TempItemCount to (player.GetItemCount pItem)
if TempItemCount
set InvPos to (InvPos + 1)
endif
if (TempItemCount == ItemCount)
return ;Don't need to worry about changing ItemCount, it's the same as TempItemCount
elseif (TempItemCount < ItemCount) ;Lost Quantity
SetStage ITInvChangesDecreasedList 0
SetStage ITInvChangesRemovedList 0
else ;if (TempItemCount > ItemCount) ;Gained Quantity
SetStage ITInvChangesIncreasedList 0
SetStage ITInvChangesAddedList 0
endif
set ItemCount to TempItemCount ;this will leave pItem's that have been nullified with a random number, this might matter if the ref is actually remembered past a mod being uninstalled and reinstalled
endif
end</pre>
--[[User:Haama|Haama]] 16:12, 13 September 2007 (EDT)
Anonymous user

Navigation menu