Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
manage objects automatically
(11-14-2023, 05:12 PM)aliensoldier Wrote: I have created two examples based on the one you have shown me of oop, one with a list and the other without a list 

The one that uses the list library works fine, but the one that doesn't use the list library I can't get the trigger to be eliminated when exiting the screen. 

I show you the two examples and you can tell me where the error is or you can make a version of your example without using the list library

Sorry for the delay, got busy yesterday, but I've had a look at your code now Smile

I replaced
free deadList[i]
in Father_Update with
free val fatherList, deadList[i]

The new line removes the object in deadList from fatherList. That is, 'free val x, y' removes any occurrence of y from the array/table x and re-indexes the array (removes any holes).

function Father_Update()
    if sizeof(fatherList)
        for i = 0 to sizeof(fatherList) -1
    if sizeof(deadList)
      for i = 0 to sizeof(deadList) -1
          ' Marcus
          'free deadList[i]
          free val fatherList, deadList[i]
    clear deadList

You should never use 'free' when working with arrays. Always use 'free val' (remove any occurrence of a value) or 'free key' (remove an index/key and its value).
Thank you very much for all the help, I really liked all the examples and I have learned a lot. Smile

Forum Jump:

Users browsing this thread: 1 Guest(s)