[SCRIPTING] SWITCH/CASE for DECORATE

Moderator: GZDoom Developers

Post Reply
User avatar
Mikk-
Posts: 2274
Joined: Tue Jun 30, 2009 1:31 pm

[SCRIPTING] SWITCH/CASE for DECORATE

Post by Mikk- »

I think it would be neat if we could use Switch/Case inside Anonymous Functions

For example: (a very simple and silly pseudocode)

Code: Select all

ACTOR THING 
    {
    CONST INT SOME_CONSTANT = 3;
    {
    STATES
        {
        SPAWN:
            TNT1 A 0 NODELAY
            { 
            SWITCH(CALLACS("SOME_SCRIPT"))
                {
                CASE 1:
                    { A_PRINT("CATS ARE FUN"); }

                CASE 2:
                    { A_SPAWNITEMEX("DOOMIMP",RANDOM(-32,32),RANDOM(-32,32)); }

                CASE SOME_CONSTANT:
                    { A_LOGINT(USER_VARIABLE1); }

                [...]
                }
            }
        }
    } 
Would such a request be feasable? I think it would be a lot cleaner than a lot of If() statements. It's not the end of the world if this isn't doable, however it would be nice.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [SCRIPTING] SWITCH/CASE for DECORATE

Post by Graf Zahl »

Sorry, but this won't see any further extensions, we'd rather focus on making the real scripting language work now.
User avatar
Mikk-
Posts: 2274
Joined: Tue Jun 30, 2009 1:31 pm

Re: [SCRIPTING] SWITCH/CASE for DECORATE

Post by Mikk- »

Okay that's fine! I look forward to that in the future!
User avatar
Major Cooke
Posts: 8206
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: [SCRIPTING] SWITCH/CASE for DECORATE

Post by Major Cooke »

Graf Zahl wrote:Sorry, but this won't see any further extensions, we'd rather focus on making the real scripting language work now.
Finally! I'm looking forward to this.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [SCRIPTING] SWITCH/CASE for DECORATE

Post by Graf Zahl »

It still will take a lot of time. I just started analyzing the compiler code, now that I finally have some code to play around with.
User avatar
Major Cooke
Posts: 8206
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: [SCRIPTING] SWITCH/CASE for DECORATE

Post by Major Cooke »

Ah, from randi I presume? Well, still, at least we're starting up again.

Something tells me that if it should come, it'll be ZDoom 3.0 I reckon. I mean, what a perfect number for a release candidate introducing doomscript.

(Let fate smile on us for ZDoom 3.0 to be before Doom's 30th birthday...)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [SCRIPTING] SWITCH/CASE for DECORATE

Post by Graf Zahl »

Don't get your hopes up. This is going to take time. I am currently trying to make constants.txt compile with the ZScript compiler and running into some problems already because at the moment DECORATE cannot access the constants defined within enums. (Update: That works now, the original code wrote the symbols to a scratch symbol table that was discarded right away.)

It is very clear that so far the compiler has only been tested in a sandbox so expect problems to surface now that it is getting real-life script code that needs to work in the existing framework of things thrown at it for the first time. Right now I have no plans to work on actual code generation, the first thing to be done is to let it parse Actor's class definition so that the basic framework is there. That alone will be quite a bit of work.
HavoX
Posts: 272
Joined: Wed Apr 11, 2012 10:31 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10 Pro 21H1
Graphics Processor: nVidia with Vulkan support
Location: St. Louis, MO

Re: [SCRIPTING] SWITCH/CASE for DECORATE

Post by HavoX »

I thought I said this before:

ZScript's already taken.
Gez
 
 
Posts: 17938
Joined: Fri Jul 06, 2007 3:22 pm

Re: [SCRIPTING] SWITCH/CASE for DECORATE

Post by Gez »

Does it matter if the name is taken by a different game? Are there any real risk of confusion between Zelda Classic and ZDoom?
HavoX
Posts: 272
Joined: Wed Apr 11, 2012 10:31 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10 Pro 21H1
Graphics Processor: nVidia with Vulkan support
Location: St. Louis, MO

Re: [SCRIPTING] SWITCH/CASE for DECORATE

Post by HavoX »

Probably not. I guess it's just me... :shrug:

@Graf: Fair enough.
Last edited by HavoX on Fri Oct 07, 2016 5:39 pm, edited 1 time in total.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [SCRIPTING] SWITCH/CASE for DECORATE

Post by Graf Zahl »

Who cares? This is ZDoom, so it has every right to call its scripting ZScript.

Doomscript is a no-go, that name is saddled with too much backstory.
User avatar
Major Cooke
Posts: 8206
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: [SCRIPTING] SWITCH/CASE for DECORATE

Post by Major Cooke »

I see it now.

WFZS. Same ring and all.

Also if you need extensive testing at certain points, let us know. I'll happily jump aboard this ship.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”