Difference between revisions of "Talk:RemoveMe"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Quetzilla
(: no CTDs from OnAdd blocks, but other weird bug instead)
imported>Quetzilla
(: CTD after all)
Line 61: Line 61:
:::I haven't had any CTDs at all with that.  It seems OnAdd blocks run the frame after the item is added via script, but I didn't have any problems with executing a bunch of code and then calling removeme.  On the other hand I did just run into a weird bug where the item wouldn't actually remove itself right away, but would stick around in the container.  The weird thing about it is that they never accumulated... there was just always one still stuck in the container even if it more got added later, probably something weird with the 'removing from the top of the stack' thing.
:::I haven't had any CTDs at all with that.  It seems OnAdd blocks run the frame after the item is added via script, but I didn't have any problems with executing a bunch of code and then calling removeme.  On the other hand I did just run into a weird bug where the item wouldn't actually remove itself right away, but would stick around in the container.  The weird thing about it is that they never accumulated... there was just always one still stuck in the container even if it more got added later, probably something weird with the 'removing from the top of the stack' thing.
:::--[[User:Quetzilla|quetzilla]] 08:43, 9 August 2008 (EDT)
:::--[[User:Quetzilla|quetzilla]] 08:43, 9 August 2008 (EDT)
:::Argh, finally ran into this obnoxious problem.  Seems to be related to how many scripted items in the container/inventory are trying to remove themselves, at least for me.  If I add an item to the container with removeme in it's onAdd block, no problem.  If the onadd block adds another item to the same container which also has removeMe in that item's onAdd block, no problem.  But if I do it 3 levels down then I get CTD.  I thought it was my additem command right before the removeme lines for hours until I decided to try return instead of removeme.  *bangs head*
:::--[[User:Quetzilla|quetzilla]] 12:29, 16 August 2008 (EDT)

Revision as of 11:29, 16 August 2008

I've noticed some odd behavior with RemoveMe. If using a reference variable to specify the target container ID, the variable appears to be changed to a reference to the item that was moved, and no longer points to the target container. Can anyone confirm this, or is something really weird just happening to my scripting environment? -- Nezroy 23:47, 7 May 2006 (EDT)

Removeme isn't actually "Remove ME" but "Remove the top-most item from the stack where I'm in." So this might cause the problems.--JOG 04:18, 13 May 2006 (EDT)

Can anyone give some more specifics on when RemoveMe causes a CTD? I thought I had some problems with it when I first started modding, but now I can't even get a CTD when using RemoveMe and GetContainer is returning 0 (but still in a container) --Haama 14:18, 10 July 2007 (EDT)

I can't say exactly which situations will or will not cause CTD, but I can report instances where I've gotten consistent CTDs with removeMe:
  • Calling removeMe along with other functions within the same frame. For instance:
begin gameMode
  if ( someCondition )
    player.modAV health -1 ; these are just examples
    set gameHour to 10
    removeMe
    return
  endif
end
Resolving those types of CTDs meant making sure removeMe is the only function called within a frame and is always followed by a return:
begin gameMode
  if ( timeToRemoveTheItem )
    removeMe
    return
  endif
end
  • Calling removeMe immediately after the container/actor inventory has changed:
if ( timeToRemove )
  removeMe
  return
endif

thisContainer.addItem someItem ; or removeItem
set timeToRemove to 1
Fixed by adding a delay to the removeMe:
short timeToRemove
if ( timeToRemove < 0 )
  set timeToRemove to timeToRemove - 1
  if ( timeToRemove < -5 )
    removeMe
  endif
  return
endif

if ( someCondition )
  set timeToRemove to -1
endif
  • Calling removeMe when the item is in a creature's inventory, as opposed to an NPCs. Creatures always gave me more troubles. Adding a delay like above fixed it.
  • Calling removeMe as soon as the player enters the same cell as the container/actor which has the token (especially a problem with creatures). Fixed again by adding a delay.
:shrug: So, I always isolate the removeMe to a block of code all by itself at the top of the script, and always allow at least 5 frames to pass before calling it. Scruggs 17:17, 10 July 2007 (EDT)
That's what I've been doing too, think I'll shrink it from 10 to 5 frames though. Thanks for the info.
--Haama 17:41, 10 July 2007 (EDT)
I've been using removeme in onadd blocks like so:
begin onadd somecontainer
    do a whole bunch of stuff
    removeme
end
I haven't had any CTDs at all with that. It seems OnAdd blocks run the frame after the item is added via script, but I didn't have any problems with executing a bunch of code and then calling removeme. On the other hand I did just run into a weird bug where the item wouldn't actually remove itself right away, but would stick around in the container. The weird thing about it is that they never accumulated... there was just always one still stuck in the container even if it more got added later, probably something weird with the 'removing from the top of the stack' thing.
--quetzilla 08:43, 9 August 2008 (EDT)
Argh, finally ran into this obnoxious problem. Seems to be related to how many scripted items in the container/inventory are trying to remove themselves, at least for me. If I add an item to the container with removeme in it's onAdd block, no problem. If the onadd block adds another item to the same container which also has removeMe in that item's onAdd block, no problem. But if I do it 3 levels down then I get CTD. I thought it was my additem command right before the removeme lines for hours until I decided to try return instead of removeme. *bangs head*
--quetzilla 12:29, 16 August 2008 (EDT)