File "WARNING" when QuitGame

Started by Baguettator, Tue 11/08/2020 13:20:13

Previous topic - Next topic

Baguettator

Hello !

I got a question : using and testing my game, I compiled it, test it for a while, and when I quit the game, a warnings.txt appears, and it's written inside :

QuoteScript : (room:1)[G 2788] Dynamic sprite 290 was never deleted
Script : (room:1)[G 2788] Dynamic sprite 291 was never deleted

In Room 1, I don't use any dynamic sprite, but I use some in other rooms, and when I quit the game, it is always in Room 1. That's maybe why it is written "room 1" in the "warnings.txt" file.

But I don't know what is it and what does it mean. Anyone has an idea ?

It is like now it is written "Dynamic Sprite 290", but the previous time I tested the game it was "Dynamic Sprite 288", etc... Maybe I have a hundred of Dynamic Sprites that I have to delete because it takes a lot in the memory of the game ? I don't know anything about that...

Matti

After using a dynamic sprite you need to call DynamicSprite.Delete();

It indeed says room 1 because you quit the game in room 1. The sprite number increases every time you play the game (but I'm not quite sure why that is).

Baguettator

When you say "after using", you mean after "dynamicSprite.release" ? Or just before quitting the game ?

Because it takes place in the memory of the game, and it is getting more and more space in memory until I play the game and don't delete the dynamicsprite ?

Crimson Wizard

#3
Just delete dynamic sprites when you no longer need them.

If you use them temporary for some complex drawing, then delete them when drawing is finished.
If you use them as a sprite for an object temporarily before changing to another sprite, then delete them when this change happens (unless you plan to use them again later).
If you use them only inside 1 room, then delete them when leaving the room (OnLeave room event).
If you use them through chapter 1 of the game, then delete when player proceeds to chapter 2, etc.

If you use a dynamic sprite throughout whole game, then ignore these warnings, as AGS deletes them automatically on exit (besides it is not always possible to detect in script when game is closed by player).

SMF spam blocked by CleanTalk