"How do I ZScript?"

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!)
Locked
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: "How do I ZScript?"

Post by Matt »

What's the ZScript equivalent to DrawSelectedInventory? (i.e., no bar, instantly use the moment you hit the use item key)
EDIT: add "cplayer.inventorytics=0;" so that the inventory bar popup lifetime is always zero so you never have to wait.

Also is there any sort of list of all the various status bar commands?
Last edited by Matt on Fri Jun 30, 2017 12:56 am, edited 1 time in total.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: "How do I ZScript?"

Post by Graf Zahl »

JPL wrote:Is there a way I can use TexMan.CheckForTexture to determine if a sky texture has been defined in a PWAD versus the IWAD? A bit more context on what I'm trying to do here. I notice there are lots of settings you can pass in for the second and third arguments for CheckForTexture (such as TEX_FirstDefined, TEXMAN_Overridable etc) and it's not clear from looking at the FTextureManager source code what they all do.

No. This is a very fishy thing anyway. Consider two TEXTUREx lumps, both defining SKY1 the same way. It then will report it as a PWAD texture but it's only so because originally these lumps were not cumulative.
ZzZombo
Posts: 317
Joined: Mon Jul 16, 2012 2:02 am

Re: "How do I ZScript?"

Post by ZzZombo »

Eh, wrong destination, Graf.
User avatar
Nash
 
 
Posts: 17501
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: "How do I ZScript?"

Post by Nash »

ZzZombo wrote:Eh, wrong destination, Graf.
What's so wrong about that post? JPL asked the question in this thread and Graf's answering the question in this thread.
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: "How do I ZScript?"

Post by Blue Shadow »

Vaecrius wrote:What's the ZScript equivalent to DrawSelectedInventory? (i.e., no bar, instantly use the moment you hit the use item key)

Also is there any sort of list of all the various status bar commands?
I don't think there's one, but this (https://github.com/coelckers/gzdoom/blo ... r.txt#L156) block of code, for instance, handles that.

As for your other question, check the base status bar class: https://github.com/coelckers/gzdoom/blo ... tusbar.txt
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: "How do I ZScript?"

Post by Matt »

:/

That's what I was using just before I asked... this still requires you to hit the use key twice before the item is actually used.

I'll keep looking in the source code to see how DrawSelectedInventory works... (unless I'm totally off base and the single-tap use was enabled by some other thing I did outside of SBARINFO)
Pink Baron
Posts: 33
Joined: Wed Mar 16, 2016 4:19 pm

Re: "How do I ZScript?"

Post by Pink Baron »

Is it possible to have "A_RadiusGive" deliver an inventory item with some of its variables already defined, without resorting to ThinkerIterator and stuff? (For example, give enemies an item with caller PlayerNum as a var)
Spoiler:
Also, is it possible to alter ammo capacity via ZScript only, as looking around I didn't find anything about it?
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: "How do I ZScript?"

Post by Blue Shadow »

Pink Baron wrote:Also, is it possible to alter ammo capacity via ZScript only, as looking around I didn't find anything about it?
This might do it:

Code: Select all

let blah = FindInventory(<ammoitem>);

if(blah != null)
{
    blah.MaxAmount += 3; // Increase the capacity by 3.
} 
Pink Baron
Posts: 33
Joined: Wed Mar 16, 2016 4:19 pm

Re: "How do I ZScript?"

Post by Pink Baron »

Blue Shadow wrote:This might do it:

Code: Select all

let blah = FindInventory(<ammoitem>);

if(blah != null)
{
    blah.MaxAmount += 3; // Increase the capacity by 3.
} 
Didn't know can directly edit ammo like that, thanks!

Sill no clue about passing "custom" items to actors in a radius...guess it's time to use that damn Thinker...
User avatar
Silentdarkness12
Posts: 1555
Joined: Thu Aug 15, 2013 5:34 pm
Location: Plains of Pride

Re: "How do I ZScript?"

Post by Silentdarkness12 »

I am considering trying to remake my godawful HUD in ZScript, but I do need to ask first, in it's current state, is ZScript capable of doing all the important things with a hud, that could normally be done in SBARINFO? Conditional draws, querying inventory, cvars, so on and so forth?
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: "How do I ZScript?"

Post by Blue Shadow »

Speaking from experience, I would say yes.
User avatar
Silentdarkness12
Posts: 1555
Joined: Thu Aug 15, 2013 5:34 pm
Location: Plains of Pride

Re: "How do I ZScript?"

Post by Silentdarkness12 »

Alright, so I just need to.............somehow.......gain a basic understanding of ZScript.

I still have no idea where to start, even after looking up the GZDoom pk3 and the ZDoom wiki....
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: "How do I ZScript?"

Post by Matt »

I think Graf might have has solved the one major blocker preventing me from upgrading HD's HUD to ZScript, so...
Pink Baron
Posts: 33
Joined: Wed Mar 16, 2016 4:19 pm

Re: "How do I ZScript?"

Post by Pink Baron »

Hi again!

Is it possible (for bookeeping purposes and such) to declare a multi-dimensional constant string array via ZScript, akin to ACSes?

Code: Select all

str SomeNames[6][2] = {				 // ACS array, works just fine
	{"NiceName1",	"EvilName1"},
	{"NiceName2",	"EvilName2"},
	{"NiceName3",	"EvilName3"},
	{"NiceName4",	"EvilName4"},
	{"NiceName5",	"EvilName5"},
	{"NiceName6",	"EvilName6"},
};

static const String SomeNames[] = 	// This mono-sized array inside an anonymous function works, too
{	
	"NiceName1",
	"NiceName2",
	"NiceName3",
	"NiceName4",
	"NiceName5",
	"NiceName6"
};

static const String SomeNames[] = 	// This one does not
{ 
	{"NiceName1",	"EvilName1"},
	{"NiceName2",	"EvilName2"},
	{"NiceName3",	"EvilName3"},
	{"NiceName4",	"EvilName4"},
	{"NiceName5",	"EvilName5"},
	{"NiceName6",	"EvilName6"}
};
What I did wrong? .-.
User avatar
Rip and Tear
Posts: 187
Joined: Tue May 02, 2017 3:54 pm

Re: "How do I ZScript?"

Post by Rip and Tear »

Is it okay to override PostBeginPlay() on an actor without calling Super.PostBeginPlay()? What kind of issues would it cause, if any?

Edit: The Super is just inheriting from actor.
Locked

Return to “Scripting”