I'm assuming "all ZScript not in the latest release"Xaser wrote:Where is this idea coming from? What features in the current release build of GZDoom are considered "not stable and not recommended to use"?ZZYZX wrote:Non-DECORATE-like features are not stable and not recommended to use, especially for a newbie.
"How do I ZScript?"
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!)
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!)
-
- 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
Re: "How do I ZScript?"
-
-
- Posts: 1383
- Joined: Sun Oct 14, 2012 1:43 am
- Location: Ukraine
Re: "How do I ZScript?"
Event handlers, menus, statusbar (if any yet).Xaser wrote:Where is this idea coming from? What features in the current release build of GZDoom are considered "not stable and not recommended to use"?ZZYZX wrote:Non-DECORATE-like features are not stable and not recommended to use, especially for a newbie.
Especially event handlers. They are somewhat fixed compared to the very first merged version, but render part is still not decided.
Menus are somewhat complete but still subject to random modification according to what Graf said about devbuilds.
-
- Posts: 772
- Joined: Sun May 04, 2014 7:22 pm
Re: "How do I ZScript?"
So uh... is there a way to get a parent actor's pitch? It's probably one of the zscript actor functions that does it, but there's so many that I don't know where to look. I was thinking of giving a disc-shaped flatsprite projectile some depth using warped actors. For one of them I was simply using A_Warp and the COPYPITCH and it works really well for that one, but for the second I'll need to roll it to match the parent's pitch.
-
-
- Posts: 1383
- Joined: Sun Oct 14, 2012 1:43 am
- Location: Ukraine
Re: "How do I ZScript?"
You might want to use either my or Nash's code from this page that applies angle+pitch rotation to a flatsprite. It uses sector floor angle, but changing it to use angle/pitch variables from an actor is straightforward.
Also, parent's angles are received using master.angle/master.pitch/master.roll/whatever. Or target, or tracer, whatever you use for storing the parent pointer.
Also, parent's angles are received using master.angle/master.pitch/master.roll/whatever. Or target, or tracer, whatever you use for storing the parent pointer.
-
- 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
Re: "How do I ZScript?"
If I only need precision within 1 degree, but for possibly dozens of actors polling multiple times every tic, is it worth doing a lookup table for sine and cosine values? (I'm trying to keep a certain object directly in front of another at a fixed distance, or in other cases calculating a movement trajectory or a position relative to someone's FOV... well a lot of things really)
-
-
- Posts: 10772
- Joined: Sun Jul 20, 2003 12:15 pm
Re: "How do I ZScript?"
I think the sentiment we ought to be expressing is "try to shy away from dev builds," then. "Non-DECORATE-like features" seemingly refers to a wide range of features (custom functions, structs, iterators, etc.) which are stable in the latest official build, and we certainly don't want to be discourage use and exploration of those.ZZYZX wrote:Event handlers, menus, statusbar (if any yet).
-
-
- Posts: 1383
- Joined: Sun Oct 14, 2012 1:43 am
- Location: Ukraine
Re: "How do I ZScript?"
Yes. Sorry for the bad wording.
-
-
- Posts: 10772
- Joined: Sun Jul 20, 2003 12:15 pm
Re: "How do I ZScript?"
It's cool -- we're on the same page, so all's well. I point these things out not to be a meanie-butt (though it probably comes across that way sometimes D:) but because we're kinda in that critical early phase where the adoption rate hasn't really taken off yet. I don't think ZScript's at any particular risk, but every bit helps.
*reminds self to continue working on his ZScript projects at some point.*
*reminds self to continue working on his ZScript projects at some point.*
-
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
Re: "How do I ZScript?"
I know EventHandlers are new and still subject to change, and my grasp of them is very basic at this point anyway, but could I ask for help in making an event that plays with a keypress? For years now, I did this:
KEYCONF:ACS:
...and everything I can convert from ACS to ZScript is another victory in my book.
KEYCONF:
Code: Select all
addmenukey "Taunt" taunt
alias taunt "pukename MGTaunt"
Code: Select all
script "MGTaunt"(void)
{PlaySound(0,"*taunt",CHAN_VOICE);}
-
- Posts: 8144
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: "How do I ZScript?"
ZZYZX seriously needs to write something about that in the wiki, for whatever is good to go. Everything else it's understandable that they remain undocumented, a la the rendering stuff, since they're bound to change.
-
-
- Posts: 17394
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: "How do I ZScript?"
Ed:
Download this file [ https://mantis.zdoom.org/file_download. ... 3&type=bug ] or if hot-linking doesn't work, go here and scroll down to the comments and download sprint key.pk3 [ https://mantis.zdoom.org/view.php?id=362 ]
(PS don't mind the bug thread, the bug is already fixed with the latest devbuilds, well at least from all my testing)
The jist of it is, you now bind your control to "event xxx" or "netevent xxx" (should be self-explanatory which is which I hope). You then create an EventHandler that checks for those things. Just look inside sprint key.pk3.
I forgot to setup a MENUDEF for it in my example WAD, so you have to bind the key yourself. Open the console and type bind Shift "netevent SprintKeyHandler". In a real project, you'd it up in the Controls menu in MENUDEF, or KEYCONF or whatever.
You must setup any event handlers you want to be enabled inside the MAPINFO. You can add as many EventHandlers as you want inside MAPINFO, it's not limited to just one.
Download this file [ https://mantis.zdoom.org/file_download. ... 3&type=bug ] or if hot-linking doesn't work, go here and scroll down to the comments and download sprint key.pk3 [ https://mantis.zdoom.org/view.php?id=362 ]
(PS don't mind the bug thread, the bug is already fixed with the latest devbuilds, well at least from all my testing)
The jist of it is, you now bind your control to "event xxx" or "netevent xxx" (should be self-explanatory which is which I hope). You then create an EventHandler that checks for those things. Just look inside sprint key.pk3.
I forgot to setup a MENUDEF for it in my example WAD, so you have to bind the key yourself. Open the console and type bind Shift "netevent SprintKeyHandler". In a real project, you'd it up in the Controls menu in MENUDEF, or KEYCONF or whatever.
You must setup any event handlers you want to be enabled inside the MAPINFO. You can add as many EventHandlers as you want inside MAPINFO, it's not limited to just one.
-
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
Re: "How do I ZScript?"
Excellent, thank you! I've got a working EventHandler right now that replaces my old ACS ENTER script, but I was less certain about where to go from there on more complex things. Thanks again!
-
-
- Posts: 17394
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: "How do I ZScript?"
Graf Zahl wrote:Do I understand this correctly that you cannot access the fields of a function return value directly?
Code: Select all
class A : ZombieMan
{
Vector2 v2;
Vector2 GetVec2(void)
{
return v2;
}
void DoSomething(void)
{
Vector2 cool;
Vector3 blah;
cool = GetVec2();
// not possible
blah = (GetVec2().X, GetVec2().Y, 0);
}
}
-
-
- Posts: 10772
- Joined: Sun Jul 20, 2003 12:15 pm
Re: "How do I ZScript?"
@Nash: While this indeed seems like a bug (and therefore worth fixing for sure), it's worth emphasizing that for your particular case, it's better to keep the local variable so you don't have the overhead of calling the get function (BumiHandler._W_GetWind(), in your proper case) twice.
-
-
- Posts: 17394
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: "How do I ZScript?"
Alright, noted... just how expensive is calling the global thinker, by the way? Since the code only does the Init once and never again after that...