How do i use actor pointers? (Or whatever they're called)

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
XASSASSINX
Posts: 377
Joined: Tue Dec 20, 2016 4:53 pm
Location: MURICAA BROTHER! Just kidding, Brazil.

How do i use actor pointers? (Or whatever they're called)

Post by XASSASSINX »

How do i use actor pointers? I'm talking about these things:

Code: Select all

A_Chase(0,0,CHF_NOPLAYACTIVE|CHF_NIGHTMAREFAST)
How do i make them true or false? Or change their values? Trying to make something like this:

Code: Select all

A_Chase(0,0,CHF_NOPLAYACTIVE(TRUE)|CHF_NIGHTMAREFAST)
Won't work! Any help?
User avatar
Mikk-
Posts: 2274
Joined: Tue Jun 30, 2009 1:31 pm
Location: Somewhere off Kanagawa

Re: How do i use actor pointers? (Or whatever they're called

Post by Mikk- »

Those are called 'flags' - to use them you simply have them in the arguments like in your first example. They're disabled by default - so you don't need to use them if they're not needed.
XASSASSINX
Posts: 377
Joined: Tue Dec 20, 2016 4:53 pm
Location: MURICAA BROTHER! Just kidding, Brazil.

Re: How do i use actor pointers? (Or whatever they're called

Post by XASSASSINX »

The symbol in the middle of the 2 flags, it's separate the flag and the setting? so what is the true or false option?
User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm
Contact:

Re: How do i use actor pointers? (Or whatever they're called

Post by Arctangent »

It separates flags, and only flags as flags don't have settings.

The first example is completely correct; like Mikk said, if you want to turn a flag off, you don't include it at all. So, if you wanted to disable CHF_NIGHTMAREFAST in the first example, you'd replace CHF_NOPLAYACTIVE|CHF_NIGHTMAREFAST with just CHF_NOPLAYACTIVE. Or CHF_NOPLAYACTIVE|CHF_FASTCHASE, in the case that you wanted to both turn off CHF_NIGHTMAREFAST and enable CHF_FASTCHASE.
XASSASSINX
Posts: 377
Joined: Tue Dec 20, 2016 4:53 pm
Location: MURICAA BROTHER! Just kidding, Brazil.

Re: How do i use actor pointers? (Or whatever they're called

Post by XASSASSINX »

hmmm... last thing, i was trying to make a monster that uses A_Fadeout alot, and according to the wiki, when a monster reaches alpha 0 it get removed. but there is a flag that can remove that. It says that "it's equivalent to using TRUE. to prevent this from occuring, use 0" what does that mean? i put the flag and it removes that? (i'm pretty sure i got the information wrong, so i reccomend checking the A_FadeOut wiki page)
User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm
Contact:

Re: How do i use actor pointers? (Or whatever they're called

Post by Arctangent »

What it's referring to is that, in previous versions of ZDoom, the flags argument wasn't a flags argument; instead, it was just a boolean that only did what FTF_REMOVE does now.

If you want to know the technical mumbo-jumbo behind it, flags are just integers read in binary rather than in decimal, then special meaning is put to particular places in the binary string. So for example, FTF_REMOVE is ( cutting down the word size to 8-bit instead of the more likely 32-bit or 64-bit as it doesn't really matter here ) equivalent to 00000001 in binary, or 1 in decimal, and FTF_CLAMP is equivalent to 00000010 in binary, or 2 in decimal. Since it's the placement that's important and not the end decimal number, inputting 00000011 ( 3 ), 10000011 ( 131 ), or 01100111 ( 103 ) will all result in FTF_REMOVE and FTF_CLAMP being enabled ... though you really shouldn't type in flags as an integer as it's a lot less readable, and you certainly shouldn't enable more binary places than you need in case more flags are added in the future - else unintended behavior could occur in future versions.

But again, FTF_REMOVE is the equivalent to 00000001, or 1, and in Decorate, true is also equal to 1. So it's very easy to expand a boolean argument into a flags argument while keeping compatibility with old mods, as long as the old functionality is transferred into the flag that represents 00000001. Subsequently, though, you shouldn't use values other than false or true ( or 0 or 1, if you dig it that way ) in boolean arguments, as they might just be converted into a flag argument in future versions and again cause unintended behavior.
Post Reply

Return to “Scripting”