ZDCode II: The language that compiles to compatible DECORATE!

Looking for Resources for your mod/project? Want to share some of your creations so others can use them? Post them here!
Post Reply
User avatar
Gustavo6046
 
Posts: 53
Joined: Thu Nov 19, 2015 7:36 pm

ZDCode II: The language that compiles to compatible DECORATE!

#1

Post by Gustavo6046 » Sat Oct 20, 2018 12:45 am

ZDCode II: The language that compiles to compatible DECORATE!

ZDCode is a compiled language that will be converted into DECORATE. It is compatible with most versions of DECORATE, depending on however you use it (but won't use DECORATE anonymous functions).

Either way, it's a powerful language, where you can use if and while statements, X-blocks (which repeat a statement or block thereof N times), and you can fold multiple actions into a single frame. You can also call functions, so you don't need to worry about where you called it, what jumps to do; keeping track of those annoying things sucks, doesn't it?

Alright, enough nonsense! Take this example:

Code: Select all

class RunZombie inherits ZombieMan replaces ZombieMan #2055
{
    set Gravity to 0.4; // high up...
    set Speed to 0;
    is NOBLOCKMONST;
    set Speed to 0;

    label See
    {
        POSS AB 5 A_Recoil(-0.7);
        TNT1 A 0 A_Chase;
        POSS A 0 A_FaceTarget();
        POSS AB 4 A_Recoil(-0.7);
        TNT1 A 0 A_Chase;
        POSS A 0 A_FaceTarget();
        POSS ABCD 3 A_Recoil(-0.7);
        TNT1 A 0 A_Chase;
        POSS A 0 A_FaceTarget();
        goto RunLoop;
    };

    function Jump
    {
        while ( z == floorz )
        {
            POSS A 5 [Bright];
            POSS A 11 ThrustThingZ(0, 30, 0, 1);
        };
        POSS AB 2 A_Chase;
    };

    label RunLoop
    {
        x3
        {
            POSS ABCD 2 A_Recoil(-0.7);
            TNT1 A 0 A_Chase;
            POSS A 0 A_FaceTarget();
        };

        if ( health > 5 )
            call Jump;

        loop;
    };
}
As you can see, throwing it into ZDCode will output a bunch of obnoxious and barely indented DECORATE, but hey, it works perfectly! You're not meant to touch the output, after all!

Image

You can get the latest compiler binaries over at GitHub.
Last edited by Gustavo6046 on Sun Oct 21, 2018 2:50 pm, edited 1 time in total.

User avatar
Ru5tK1ng
Posts a lot
Posts: 761
Joined: Fri Jun 01, 2012 9:04 pm

Re: ZDCode II: The language that compiles to compatible DECORATE!

#2

Post by Ru5tK1ng » Sat Oct 20, 2018 5:10 am

Very interesting. How does it handle online?

User avatar
Ivan
Addicted to Zandronum
Posts: 2189
Joined: Mon Jun 04, 2012 5:38 pm
Location: Omnipresent

Re: ZDCode II: The language that compiles to compatible DECORATE!

#3

Post by Ivan » Sat Oct 20, 2018 8:13 am

I can't check your github, it seems to be down for me. Also there's no sample output.
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===

User avatar
Ænima
Addicted to Zandronum
Posts: 3441
Joined: Tue Jun 05, 2012 6:12 pm
Location: Shpongleland

Re: ZDCode II: The language that compiles to compatible DECORATE!

#4

Post by Ænima » Sat Oct 20, 2018 2:20 pm

Interesting. Kinda defeats the point of learning DECORATE proficiency, but i guess it makes things easier with complex logic loops!

Good idea.
Image ­ ­
­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­
Doom64: Unabsolved: Doom64 and Diablo2 had a baby


ZandroSkins
: a pack made by our community
Squad Radio: a WASD-powered chat menu, add your own sounds
AeniPuffs: neat blood and puff effects

User avatar
Gustavo6046
 
Posts: 53
Joined: Thu Nov 19, 2015 7:36 pm

Re: ZDCode II: The language that compiles to compatible DECORATE!

#5

Post by Gustavo6046 » Sun Oct 21, 2018 2:50 pm

OH, the GitHub link has a small typo. Fixed.

If you check the source tree, you can see the sample output in the Examples folder, with the .dec extension. Let me just upload the new structure...

EDIT: If one has Python 3, they can also perform

Code: Select all

pip install -U zdcode
python -m zdcode MyStuff.zc2 MyStuff.dec

User avatar
Gustavo6046
 
Posts: 53
Joined: Thu Nov 19, 2015 7:36 pm

Re: ZDCode II: The language that compiles to compatible DECORATE!

#6

Post by Gustavo6046 » Tue Oct 23, 2018 10:23 pm

Got syntax highlighting?
Image
Visual Studio Code has! You just have to install an extension!

Post Reply