ZScript Discussion

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!)
User avatar
DenisBelmondo
Posts: 379
Joined: Fri Jun 06, 2008 6:26 pm
Location: Two-Key Return
Contact:

Re: ZScript Discussion

Post by DenisBelmondo »

EDIT: moving to other topic.
Last edited by DenisBelmondo on Tue Mar 28, 2017 1:02 am, edited 1 time in total.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: ZScript Discussion

Post by Matt »

User avatar
DenisBelmondo
Posts: 379
Joined: Fri Jun 06, 2008 6:26 pm
Location: Two-Key Return
Contact:

Re: ZScript Discussion

Post by DenisBelmondo »

Oh my bad, I'll move the question over there. Thanks!
User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine
Contact:

Re: ZScript Discussion

Post by ZZYZX »

Just curious, is there going to be any line drawing under Screen? If so, when approximately?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript Discussion

Post by Graf Zahl »

The functions exist, they just have the small problem that the software versions do not clip the output so they are not suitable for user code.
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: ZScript Discussion

Post by Nash »

The line drawer IMO, should eventually be extended to allow a line thickness parameter... lines are almost invisible to me at 4k resolution.

/////////


Question about: https://mantis.zdoom.org/view.php?id=456
The Defaults make sense for actors which have to be spawned with a generic function, but for other classes the proper way should be a constructor.
Constructors sound like exactly what I was looking for. How do I do those or are they possible yet?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript Discussion

Post by Graf Zahl »

Constructors are not in yet.

And to be honest I need to take a break from more complex ZScript for now.
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: ZScript Discussion

Post by Nash »

No problem! The amount of work you did in 2017 alone is more than, like, oh I don't know, the past 2 years of progress combined or something. :mrgreen:

I will remind you about the constructor idea some other time. It's not urgent for me, and I have lots of other features to play with currently (not to mention learning how to actually script properly and generally improving my ZScript-fu)
User avatar
Caligari87
Admin
Posts: 6174
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him
Contact:

Re: ZScript Discussion

Post by Caligari87 »

So before I go crying wolf on a bug report, need to have someone else test this. It seems that overriding PostBeginPlay in Doomplayer disables look up/down.

File should be downloadable from this link. All it is, is a MAPINFO and ZScript that ZZYZX gave me to test new player classes.
https://cdn.discordapp.com/attachments/ ... sclass.pk3

MAPINFO:

Code: Select all

gameinfo
{
	PlayerClasses = "TestZSClass"
}
ZSCRIPT

Code: Select all

class TestZSClass : DoomPlayer
{
	override void PostBeginPlay()
	{
		Console.Printf("HI");
	}
}
8-)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript Discussion

Post by Graf Zahl »

You *MUST* call the super method!
PlayerPawn.PostBeginPlay performs some necessary setup without which you end up with an incompletely set up player.
User avatar
Caligari87
Admin
Posts: 6174
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him
Contact:

Re: ZScript Discussion

Post by Caligari87 »

Yeah, just found that out. Wasn't aware it did other stuff. Whoops.

8-)
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: ZScript Discussion

Post by Major Cooke »

User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript Discussion

Post by Graf Zahl »

More like overhead cost of pointers in general. This stuff was meant to be used to check pointer types but practical constraints basically limited it to checking if a pointer was supposed to be an object, and even that wasn't safe.

The problem with function calls is that the code is extremely generic and has to account for a lot of things. I don't really think that this can be streamlined much more without sacrificing functionality.

There's one thing in the VM which I also may scrap - and that is scripted exceptions. It's a typical pie-in-the-sky proposition but will probably totally go over the head of most scripters and offer very limited functionality, but also comes with quite a bit of overhead. On the language side this hasn't even been implemented yet and I have no plans to do so.

You have to consider that the only things ZDoom is using execptions for is to abort on errors and for FraggleScript to terminate scripts (but only because this was so badly implemented that it couldn't have been done in a saner fashion.)
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: ZScript Discussion

Post by Major Cooke »

Fair enough. I figured it wouldn't do much of a benefit towards subfunctions, just thought I'd check.

It does seem like this provided a minor speed boost in more 'sticky' situations with lots of ZScript heavy actors performing their stuff, so that's nice!
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: ZScript Discussion

Post by Major Cooke »

Out of curiosity, on the topic of subfunctions...

Does that just apply to whenever calling it from within a function like Tick(), or does that also include in anonymous functions?

I.e.

Code: Select all

TNT1 A 0 MyFunction();
TNT1 A 0 { MyFunction(); }
Does this also weigh upon the system more heavily than just executing the regular code?
Locked

Return to “Scripting”