Jump to content

trigger.action.<MARK> bug: DCS Backend remembers old ID numbers even after you've done 'removeMark()'


Recommended Posts

Posted

I have a table of id numbers. Every time I do a new 'mark' I increment the last ID number by 1. 

When the script needs to remove all marks, it does a for loop where 
 

  for id = 1, #activeDrawings do

    trigger.action.removeMark(id)

	activeDrawings[id] = nil

  end

This wipes the table 'activeDrawings' empty.

Then later, if the script adds a new 'mark' it will obviously restart at 1 (as all previous ID's have been removed and deleted).

However, DCS Backend won't render the mark. 

It won't render any more marks until the new ID number is one more than the previous max ID numbers before my table of used ID numbers was wiped. 

This means the backend is retaining what ID numbers were used, and despite 'removeMark(id)' it doesn't 'free' that up for reuse.

Thus, until this is fixed my table of used ID numbers has to keep increasing forever. 

 

  • Like 1
Posted

It would be great to free up these IDs. I think the way that most of us use this is to choose a high arbitrary starting ID that won't conflict with other marks (from other scripts, users, etc.).

+1 to get a new API method for this

Posted

You are not the only one creating IDs. And with your loop you also deleting IDs from other players or scripts. So you have to test if every ID is yours. Or... you do not delete them. So your request makes no sense. 

Posted
On 2/20/2023 at 10:28 PM, buur said:

You are not the only one creating IDs. And with your loop you also deleting IDs from other players or scripts. So you have to test if every ID is yours. Or... you do not delete them. So your request makes no sense. 

Wrong. 

Because I create a mark using ID number 1.

It shows on the map.
 

I remove it using trigger.action.removeMark(1).

It goes away.

Then I create a new mark on the map using ID number 1. 

The 'event' table says 'mark added' but nothing renders. 

If I increment it to 2 then it renders and I can remove it. 

If I try later to add another mark, now with either 1 or 2 they wont render, but 3 will.

So on, so on. 

 

Posted
7 hours ago, Elphaba said:

You don't allow missions with scripts in and this happens from scripting so...

I don't know what made you think this.

When reporting a script issue, the best way to get the issue reported is to attach a miz containing the malfunctioning script.

---

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...