"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.

Re: "How do I ZScript?"

Postby Graf Zahl » Sat Mar 04, 2017 4:52 am

A dummy object is just the same as your thinker in terms of cost. If you need it repeatedly, store it in a local variable. The expensive action is to retrieve the global storage thinker, not to use it.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: "How do I ZScript?"

Postby Major Cooke » Sat Mar 04, 2017 6:47 am

What's with all the const function stuff and what is its purpose?
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: "How do I ZScript?"

Postby Matt » Sat Mar 04, 2017 1:58 pm

I'm sick of typing out this sort of thing constantly:
Code: Select allExpand view
      vel+=(
         cos(angle)*cos(pitch),
         sin(angle)*cos(pitch),
         -sin(pitch)
      )*10;
I'm seeing in the actor function list a bunch of things like "Vec3Angle". Can those be used instead?
Last edited by Matt on Sat Mar 04, 2017 2:08 pm, edited 1 time in total.
User avatar
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: "How do I ZScript?"

Postby ZZYZX » Sat Mar 04, 2017 2:02 pm

I think there are static methods in vector3... Its just that these are not defined anywhere in the ZScript files and are instead directly set on the C++ side.
Anyway I'd write a function here and forget about the overhead. Like vector3 GetRotatedUnitVector(double angle, double pitch, double roll).

There are methods in actor that can give you only angle (Vec3Angle), but not angle+pitch and certainly not roll.
User avatar
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine
Discord: ZZYZX#1394
Github ID: jewalky

Re: "How do I ZScript?"

Postby Major Cooke » Sat Mar 04, 2017 2:36 pm

Use A_ChangeVelocity with the CVF_RELATIVE flag.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: "How do I ZScript?"

Postby Ed the Bat » Sat Mar 04, 2017 2:49 pm

Just a quick question this time:
Code: Select allExpand view
class Key : Inventory
{
   Default
   {
      +DONTGIB;      // Don't disappear due to a crusher
      Inventory.InterHubAmount 0;
      Inventory.PickupSound "misc/k_pkup";
   }
   
   override bool HandlePickup (Inventory item)
   {
      // In single player, you can pick up an infinite number of keys
      // even though you can only hold one of each.
      if (multiplayer)
      {
         return Super.HandlePickup (item);
      }
      if (GetClass() == item.GetClass())
      {
         item.bPickupGood = true;
         return true;
      }
      return false;
   }

   override bool ShouldStay ()
   {
      return !!multiplayer;
   }
}

I notice in gzdoom.pk3, the definition for Key features a flag with a semicolon after it. I know it's not required, but does this mean it's optional? Does it hold any significance?
User avatar
Ed the Bat
I'm tired. I want to go home.
 
Joined: 03 May 2012
Location: Maryland, US

Re: "How do I ZScript?"

Postby Major Cooke » Sat Mar 04, 2017 2:50 pm

It holds no significance with flags and are completely optional.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: "How do I ZScript?"

Postby Ed the Bat » Sat Mar 04, 2017 2:51 pm

Alright, just checking. Wanna make sure I keep all my syntax proper and correct.
User avatar
Ed the Bat
I'm tired. I want to go home.
 
Joined: 03 May 2012
Location: Maryland, US

Re: "How do I ZScript?"

Postby Nash » Sun Mar 05, 2017 12:29 am

Probably a typo since everything else doesn't.

I'd still be careful because knowing ZDoom's history of 'IT USED TO WORK WTF NOW ITDOESN'T"
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: "How do I ZScript?"

Postby Major Cooke » Sun Mar 05, 2017 8:55 am

No, that's a feature. People requested if it could be done for consistency and Graf obliged.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: "How do I ZScript?"

Postby Major Cooke » Sun Mar 05, 2017 8:56 am

Graf: How does the versioning system work? What needs to be considered when using it? What will be enabled/disabled when (not) using it?
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: "How do I ZScript?"

Postby ZZYZX » Sun Mar 05, 2017 9:16 am

1.
Code: Select allExpand view
version "<latest gzdoom version goes here>"
at the top of your zscript.txt
2. Nothing
3. Only GZDoom 2.3 ZScript features with unspecified version

P.S. It's NOT DONE. It's literally not done, the latest master branch in GZDoom's repo is in an intermediate state, half there. Don't try to use versions just yet.
User avatar
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine
Discord: ZZYZX#1394
Github ID: jewalky

Re: "How do I ZScript?"

Postby Major Cooke » Sun Mar 05, 2017 9:55 am

I have no intention of doing it right now anyway. Considering how broken things are at the moment, I'm not updating my GZDoom to the latest git right now until after it's safer.

But the whole determination of the syntax for inserting play and ui keywords will definitely need clarification so I know what and when to use them with 2.4 features.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: "How do I ZScript?"

Postby Graf Zahl » Sun Mar 05, 2017 9:57 am

Major Cooke wrote:Graf: How does the versioning system work? What needs to be considered when using it? What will be enabled/disabled when (not) using it?



I can't tell you how something works that isn't even done yet.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: "How do I ZScript?"

Postby kodi » Sun Mar 05, 2017 1:25 pm

How do apply a player property to a pointer?
User avatar
kodi
Proscrastinator
 
 
 
Joined: 06 May 2013

PreviousNext

Return to Scripting

Who is online

Users browsing this forum: vidaritos and 0 guests