How can I see fields/members of an Actor/class?

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!)
malon3
Posts: 103
Joined: Fri Dec 26, 2008 4:41 pm

How can I see fields/members of an Actor/class?

Post by malon3 »

For example

Code: Select all

let p = players[e.player].mo;
like what is "mo"? What other fields can I access?

p.pos(x,y,z) members exist - what else exists? How can I know all the fields I can read/write on an actor/class?

Another one I want to examine is the PatrolPoint class (you probably saw my other post) - I have a feeling that theres some field called like "nextTid" or something where I put the tid for the next patrolpoint but I don't know how to find it
User avatar
Blue Shadow
Posts: 4903
Joined: Sun Nov 14, 2010 12:59 am
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: How can I see fields/members of an Actor/class?

Post by Blue Shadow »

I think your only option is just to do a search in the source.

About your example: players is an array of type PlayerInfo. mo is a member of PlayerInfo which is of type PlayerPawn.

This is the class definition of PatrolPoint.
malon3
Posts: 103
Joined: Fri Dec 26, 2008 4:41 pm

Re: How can I see fields/members of an Actor/class?

Post by malon3 »

Looking at the source shouldn't be an issue. I was kinda thinking that would be the case if I couldn't print the members of a class.

So I learned that one of the fields for PatrolPoint is "args", as in

Code: Select all

Actor pp = Actor.Spawn("PatrolPoint", (0,0,0));
pp.args[0] = nextPPTID;
I found PatrolPoints in the source here
https://github.com/coelckers/gzdoom/blo ... isc.zs#L24 (edit: just realized the previous post also linked to this)

But it says nothing about args field.

Where would I look in the source to find such info? I don't want to keep blowing up the forums with simple questions, so hopefully I can figure this stuff out on autopilot from now on if someone can just point me in the right area to find such info
User avatar
Blue Shadow
Posts: 4903
Joined: Sun Nov 14, 2010 12:59 am
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: How can I see fields/members of an Actor/class?

Post by Blue Shadow »

Trace the class's ancestry; PatrolPoint inherits from Actor, as seen from its definition.

Code: Select all

class PatrolPoint : Actor
The Args field is here.
malon3
Posts: 103
Joined: Fri Dec 26, 2008 4:41 pm

Re: How can I see fields/members of an Actor/class?

Post by malon3 »

Blue Shadow wrote:Trace the class's ancestry; PatrolPoint inherits from Actor, as seen from its definition.

Code: Select all

class PatrolPoint : Actor
The Args field is here.
Once again I thank you! And damn, that's a lot of fields to toy around with! My experience in OOP languages is minimal, but I think I'm getting an okay grasp on stuff thanks to helpful people like you
User avatar
Sir Robin
Posts: 392
Joined: Wed Dec 22, 2021 7:02 pm
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Re: How can I see fields/members of an Actor/class?

Post by Sir Robin »

Bookmarking this post - thank you Blue Shadow for the useful links!

When I'm looking for info I check a few places:
ZDoom Wiki - mostly useful, some things are not documented or documented in weird places
Doom Wiki - Generally less specific but has some info that ZDoom Wiki does not
ZDoom Docs - Mostly technically useful, not usually a lot in the way of explanations or examples
Source Code - obviously
GZDoom.pk3 - the file itself has a lot of zscript and other files to look at for examples and ideas

Return to “Scripting”