[H E L P] Retrieving a thing's sector tag

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
Jimmy
 
 
Posts: 4728
Joined: Mon Apr 10, 2006 1:49 pm
Preferred Pronouns: He/Him
Contact:

[H E L P] Retrieving a thing's sector tag

Post by Jimmy »

Surely. Surely there's a way to retrieve the tag of the sector a certain thing is standing in. But either I've forgotten or it hasn't existed all along.
RaveYard
Posts: 200
Joined: Fri Apr 12, 2013 10:51 am

Re: [H E L P] Retrieving a thing's sector tag

Post by RaveYard »

I am sure there isn't such feature. :?

But you can substitute with a very ugly hack...
Spoiler:
Or you can just rethink what you are trying to do and try to think of an another way to do it.

If you work with a grid pattern of equally sized sectors, then the solution is using your actor's X Y position.
User avatar
Jimmy
 
 
Posts: 4728
Joined: Mon Apr 10, 2006 1:49 pm
Preferred Pronouns: He/Him
Contact:

Re: [H E L P] Retrieving a thing's sector tag

Post by Jimmy »

That's helpful though, thank you! Honestly ugly hacks are pretty much all I'm doing at this point. :?

Though I'm a bit concerned about runaway. How likely is this to happen? I realise doing 10,000 checks in one tic is already pushing it...
User avatar
KeksDose
 
 
Posts: 596
Joined: Thu Jul 05, 2007 6:13 pm
Location: my laboratory
Contact:

Re: [H E L P] Retrieving a thing's sector tag

Post by KeksDose »

There is no danger of runaway here, as far as I know. The instruction limit lies at 500,000 per tic. If this is inside of your own maps, you can do the fairly trivial optimisation of setting MAX_SECTOR_TAG to the highest sector tag in your map. If they are not inductive, use an array and cycle through that. You can use acsprofile in the console to see if the trade-off is worthwhile!

I think ThingCount can also use const in the first argument to reduce instructions being pushed (I am unaware of the details here, but if you do not use expressions, you may use const to lower the probability of runaway happening). May be worth trying for ThingCount_Sector, if it does work for that function.
RaveYard
Posts: 200
Joined: Fri Apr 12, 2013 10:51 am

Re: [H E L P] Retrieving a thing's sector tag

Post by RaveYard »

Jimmy wrote:That's helpful though, thank you! Honestly ugly hacks are pretty much all I'm doing at this point. :?
I wouldn't worry too much about it. You probably will not end up needing to write custom collision and hitscan detection in ACS... :oops:
KeksDose wrote:There is no danger of runaway here, as far as I know. The instruction limit lies at 500,000 per tic.
True, but even without getting terminated, it can still cause frame-rate drops.
KeksDose wrote: I think ThingCount can also use const in the first argument to reduce instructions being pushed (I am unaware of the details here, but if you do not use expressions, you may use const to lower the probability of runaway happening). May be worth trying for ThingCount_Sector, if it does work for that function.
As my knowledge goes, you can use const, only when all arguments are constants :(
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: [H E L P] Retrieving a thing's sector tag

Post by Nevander »

I always wonder why it can't be as simple as a function to do exactly this, something like "checkThingSector(TID)" and you put in the TID and the function returns the sector number.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: [H E L P] Retrieving a thing's sector tag

Post by NeuralStunner »

I'm pretty sure it would be possible, but nobody's done it yet.
User avatar
cocka
Posts: 1520
Joined: Sat Jul 02, 2011 7:21 am
Location: Hungary

Re: [H E L P] Retrieving a thing's sector tag

Post by cocka »

Yes, the main problem here is that you cannot retrieve the sector tags at all, so the only option to circumvent the problem is to use the previously written for loop to test whether the thing with an actual tid exists in a sector with given tag or not.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [H E L P] Retrieving a thing's sector tag

Post by Graf Zahl »

Besides, what should it return for sectors with multiple tags?

Threads like this exist because people try to use some information for doing stuff it was never meant for.
And instead of asking how to do what they really intend to do, they ask how they can implement it in the broken way they cooked up.

(In clear English: What is missing here is, why the hell do you need this information to begin with?)
User avatar
cocka
Posts: 1520
Joined: Sat Jul 02, 2011 7:21 am
Location: Hungary

Re: [H E L P] Retrieving a thing's sector tag

Post by cocka »

sectors with multiple tags
Have I missed something here? I don't know anything about sectors with multiple tags. :roll:
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [H E L P] Retrieving a thing's sector tag

Post by Graf Zahl »

Yes, you have missed something there. That feature has been available for more than a year.
User avatar
cocka
Posts: 1520
Joined: Sat Jul 02, 2011 7:21 am
Location: Hungary

Re: [H E L P] Retrieving a thing's sector tag

Post by cocka »

And is there a wiki article or a description about it?
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: [H E L P] Retrieving a thing's sector tag

Post by Accensus »

http://zdoom.org/wiki/tag
The Wiki wrote:ZDoom, using UDMF maps, have the ability to read in multiple tags per line or sector. Doom and Hexen map types will not work with this, however, and neither can things.
User avatar
Jimmy
 
 
Posts: 4728
Joined: Mon Apr 10, 2006 1:49 pm
Preferred Pronouns: He/Him
Contact:

Re: [H E L P] Retrieving a thing's sector tag

Post by Jimmy »

Graf Zahl wrote:Besides, what should it return for sectors with multiple tags?

Threads like this exist because people try to use some information for doing stuff it was never meant for.
And instead of asking how to do what they really intend to do, they ask how they can implement it in the broken way they cooked up.

(In clear English: What is missing here is, why the hell do you need this information to begin with?)
I apologise for astounding you with my idiocy. Geez.

Say you want to quickly place things in a bunch of sectors, and affect only the sectors those things are placed in. Like have a torch that sets the sector color to red, for a crude example. You probably don't want to hear what I was originally planning on doing, it'd take way too long to explain and I quickly found it wasn't going to work out anyway. My initial query was just vague because I wasn't aware that there was apparently a lack of connectivity between thing and sector, and wanted confirmation on that. It sounds like the sort of thing that should be possible, is all.

Maybe something like ActivatorSector() would be more useful. Like ActivatorTID(), except it would only return the singular sector the actor is currently in. Sector tags needn't be involved. I'm not familiar with ZDoom's internals on any conceivable level but if the sector number a thing is currently in could be exposed to ACS, then this, I imagine, would be handy to have as a quick void function.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [H E L P] Retrieving a thing's sector tag

Post by Graf Zahl »

Since ACS has no access to single entities like that it simply cannot be done. This is very deep in WFDS territory.
Locked

Return to “Editing (Archive)”