backIndex

Xelagot action script

Managing memory usage when building

When a xelagot builds, deletes or modifies objects in the world, a description of these objects is kept in it's memory lists. If these lists are not cleared regularly, the bot will use more and more memory. A way to handle this is shown in this example, which I used to patch my games (I had forgotten to check on memory usage!):

1) Add, at the beginning of the script, a statement to clear all RWX/COB objects from memory lists

ClearLists

you can also put ClearLists in the OnWorldEnterEvent (or in the obsolete OnWorldReconnectEvent) handler, never elsewhere because it can mess up 'objects in transit', i.e. commands to build, modify or delete objects sent to the world server but still not confirmed as done by the server.

2) Add the following:

any xelagot:

Sub ClearConfirmed
  ClearListAS
  ClearListAF
  ClearListDS
  ClearListDF
EndSub

xelagot 3.607 or newer has the following statement:

ClearConfirmedLists

that does the same.

3) and call it periodically, for example at the begining of each game

Gosub ClearConfirmed

or if you use the 3.607 statement, just

ClearConfirmedLists

This will clear all objects stored in the confimed lists (AddSuccess, AddFailed, DeleteSuccess, DeleteFailed)


backIndex