- Joined
- Mar 6, 2006
- Messages
- 9,243
This is aimed at GUI triggerers mostly, since in vjass we use linked lists mostly already. But in GUI, almost everyone uses dynamic indexing and I will show you why it is flawed.
Here are examples of dynamic and non dynamic indexing. They have similarities, both work like this.
So you see that even dynamic indexing isn't perfect since it messed up the order of the instances.
An even better way is to use a linked list.
Here is what happens, an example of four instances running
Instance 2 expires for some reason, we remove it from the list and link 1 and 3
The order is the same. Sweet.
There you have it.
Here are examples of dynamic and non dynamic indexing. They have similarities, both work like this.
When a spell is cast, the created instance is assinged a new index, always the last of the instance queue.
A spell is cast, no other instances are active:
A spell is cast, while other instances are active:
The indexes are looped through in the periodic trigger
---- However, the deindexing differs.
|
So you see that even dynamic indexing isn't perfect since it messed up the order of the instances.
An even better way is to use a linked list.
Here is what happens, an example of four instances running
Position in list | 1 | 2 | 3 | 4 |
Instance ID | 1 | 2 | 3 | 4 |
Instance 2 expires for some reason, we remove it from the list and link 1 and 3
Position in list | 1 | 2 | 3 |
Instance ID | 1 | 3 | 4 |
The order is the same. Sweet.
|
There you have it.
Attachments
Last edited: