Grouped action specials in DECORATE

Moderator: GZDoom Developers

User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: Grouped action specials in DECORATE

Post by randi »

Snarboo wrote:Will grouped action functions be added to the main branch, or will we need to wait for DoomScript before we see this change added?
Yes. ;)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Grouped action specials in DECORATE

Post by Graf Zahl »

Best non-answer ever... :mrgreen:
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: Grouped action specials in DECORATE

Post by randi »

I did another thing. And in so doing, I think I found some errors in FxConditional::Emit() that need fixing.
Blzut3
 
 
Posts: 3215
Joined: Wed Nov 24, 2004 12:59 pm
Operating System Version (Optional): Kubuntu
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

Re: Grouped action specials in DECORATE

Post by Blzut3 »

Yes, the braces are required. Because I see too many instances where somebody writes an if statement in ACS and doesn't understand why it doesn't work right because they forgot braces.
A little harsh I think. Granted I probably don't read as much of the forums, but I would think just making sure an if statement is not followed by a semicolon would solve most cases. That's usually the error I see since most beginner tutorials use the braces all the time (or at least they probably should).

More importantly right now it looks like there's no elegant "else if".
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: Grouped action specials in DECORATE

Post by randi »

Blzut3 wrote:More importantly right now it looks like there's no elegant "else if".
Humbug. You're right. I suppose maybe I should change that. I don't want to spend too much time buffing up DECORATE, though.
User avatar
Nash
 
 
Posts: 17506
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Grouped action specials in DECORATE

Post by Nash »

I'm curious as to how a clean (or expected) identation style would look like for this stuff. Does this look correct?

Code: Select all

Actor Heh
{
    States
    {
        POSS G 3
        {
            if (health > 1000)
            {
                A_Scream;
            }
            else
            {
                A_XScream;
            }
        }
        POSS F 3
        Stop
    }
}
 
or perhaps like this?

Code: Select all

Actor Heh
{
    States
    {
        POSS G 3
                {
                    if (health > 1000)
                    {
                        A_Scream;
                    }
                    else
                    {
                        A_XScream;
                    }
                }
        POSS F 3
        Stop
    }
}
 
Blzut3
 
 
Posts: 3215
Joined: Wed Nov 24, 2004 12:59 pm
Operating System Version (Optional): Kubuntu
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

Re: Grouped action specials in DECORATE

Post by Blzut3 »

I think in this case using the brace on the same line style would be preferrable:

Code: Select all

POSS G 3 {
    if (health > 1000) {
        A_Scream;
    } else {
        A_XScream;
    }
}
POSS F 3
stop
At the very least putting the first brace on the same line as the state would make it clear that it's an action function even if everything else is separate line. If you really feel like putting the opening brace on a separate line then your first example or a single tab should do. Don't try to align like your second example, large indentations become problematic to read eventually.
User avatar
Fishytza
Posts: 794
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: They/Them
Contact:

Re: Grouped action specials in DECORATE

Post by Fishytza »

Blzut3 wrote:More importantly right now it looks like there's no elegant "else if".
...That and it looks like if statements within if statements are not yet possible(?) Nevermind.
Last edited by Fishytza on Fri Jan 09, 2015 7:01 am, edited 1 time in total.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Grouped action specials in DECORATE

Post by Gez »

Also, it doesn't include autoarrays, codepointer overloading, multiple inheritance, and multithreading. Boohoohoo.
Edward-san
Posts: 1774
Joined: Sat Oct 17, 2009 9:40 am

Re: Grouped action specials in DECORATE

Post by Edward-san »

Don't forget all the ownership thing. Bwheheheheee.
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: Grouped action specials in DECORATE

Post by randi »

Gez wrote:Also, it doesn't include autoarrays, codepointer overloading, multiple inheritance, and multithreading.
And it never will.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Grouped action specials in DECORATE

Post by Gez »

Oh noes!
User avatar
Major Cooke
Posts: 8215
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: Grouped action specials in DECORATE

Post by Major Cooke »

Thank god for that, that's one thing I never enjoyed when programming within ZDooM's source code.
User avatar
Major Cooke
Posts: 8215
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: Grouped action specials in DECORATE

Post by Major Cooke »

Also, fellas, it appears for a single action it doesn't need braces.

Code: Select all

    // If it's not a '{', then it should be a single action. 
    // Otherwise, it's a sequence of actions.
    if (!sc.Compare("{"))
    {
        tcall->Code = ParseAction(sc, state, statestring, bag);
        return;
    }
So you could do this:

Code: Select all

POSS G 3
{
	if (health > 1)
		A_Jump(256,"Alive") //Or perhaps Goto Alive could work?
	else
		A_Jump(256,"Dead") //Or perhaps Goto Dead could work?
}
Except I dont know if gotos are allowed like that. Randi, does that seem like something which would work?

Oh man I'm excited to see this put into the main branch. :D
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Grouped action specials in DECORATE

Post by NeuralStunner »

Since Goto is not a frame action, I don't see a reason for it to work as part of a frame.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”