Page 29 of 97

Re: "How do I ZScript?"

Posted: Sun Mar 05, 2017 2:50 pm
by Graf Zahl
You can't. Right now it's only a handful of types which I needed for internal definitions that are supported.

Re: "How do I ZScript?"

Posted: Sun Mar 05, 2017 2:59 pm
by kodi
Okay. Target.ACS_NamedExecuteAlways with a property changing script works until then.

Re: "How do I ZScript?"

Posted: Sun Mar 05, 2017 3:01 pm
by Nash
@kodi: Which properties are you interested in, specifically? It may already be possible to alter them directly as variables.

Re: "How do I ZScript?"

Posted: Sun Mar 05, 2017 3:04 pm
by kodi
@nash PROP_TOTALLYFROZEN

Re: "How do I ZScript?"

Posted: Sun Mar 05, 2017 3:15 pm
by Nash
An excerpt from my sidescroller game kit:

Code: Select all

            // set the player to totally frozen; we will customize the player
            // movement from scratch
            players[e.PlayerNumber].cheats |= CF_TOTALLYFROZEN;
 
The .cheats field is what you want to manipulate. The list of all CF_ flags is in constants.txt :)

Re: "How do I ZScript?"

Posted: Sun Mar 05, 2017 3:17 pm
by kodi
'preciate it!

Re: "How do I ZScript?"

Posted: Sun Mar 05, 2017 6:34 pm
by Nash
Spoiler:
:lol: :lol: :lol: :lol: :lol: :lol: I don't even know where to begin. Sigh. Maybe I'll rest a few days...

Re: "How do I ZScript?"

Posted: Sun Mar 05, 2017 6:40 pm
by Graf Zahl
You have to put a line 'version "2.4" into the first line of the main ZSCRIPT lump to get the non-actor related features, and maybe make a few other adjustments.

Re: "How do I ZScript?"

Posted: Sun Mar 05, 2017 6:53 pm
by Nash
Yeah that's what I already did (it doesn't work with quotes BTW, eg, it only works with version 2.4, not version "2.4")

I guess it would be of great help if I just broke it down into smaller sections. I'll know what to do when I know how to fix one of them.

Code: Select all

Script error, ":zscript/engine/engine_physics.zsc" line 18:
Expression must be a modifiable value
Script error, ":zscript/engine/engine_physics.zsc" line 19:
Expression must be a modifiable value
Script error, ":zscript/engine/engine_physics.zsc" line 20:
Expression must be a modifiable value

class Z_Physics
{
    static void AlignToSlope(Actor self, double dAng, double dPitch)
    {
        vector3 fNormal = self.CurSector.FloorPlane.Normal;
        vector2 fNormalP1 = (fNormal.X != 0 || fNormal.Y != 0) ? (fNormal.X, fNormal.Y).Unit() : (0, 0);
        vector2 fNormalP2 = ((fNormal.X, fNormal.Y).Length(), fNormal.Z);
        double fAng = atan2(fNormalP1.Y, fNormalP1.X); // floor angle (not pitch!)
        double fPitch = -atan2(fNormalP2.X, fNormalP2.Y); // floor pitch
        double dDiff1 = sin(fAng - (dAng + dPitch));
        double dDiff2 = cos(fAng - dAng);
        self.Pitch = fPitch * dDiff2 + dPitch; ////////////////// <-- LINE 18
        self.Roll = fPitch * dDiff1;
        self.Angle = dAng;
    }
}

Code: Select all

Script error, ":zscript/bumi/time.zsc" line 100:
Can't call play function get from data context
Script error, ":zscript/bumi/time.zsc" line 101:
Unknown identifier 'bumi'

class FWorld : Thinker
{
    static FWorld Get()
    {
        ThinkerIterator it = ThinkerIterator.Create("FWorld", STAT_STATIC);
        let p = FWorld(it.Next());
        if (p == null)
        {
            p = new("FWorld").Init();
        }
        return p;
    }
}

class Z_Time
{
    /*
     * Gets current second of minute.
     */
    static int T_GetSecond(void)
    {
        let bumi = FWorld.Get(); /////////// <-- LINE 100
        return bumi.timeSecond;
    }



Just these for now. Any advice would be appreciated.

[I edited the post to show where the "get" function is coming from. This is the global thinker solution Graf Zahl gave me a while back]

Re: "How do I ZScript?"

Posted: Sun Mar 05, 2017 8:03 pm
by Major Cooke
Try replacing 'self' with something else. Self is a reserved word last I checked. If that still doesn't resolve it, maybe try a struct? I use structs all the time for global access to functions.

Also Nash, can you kindly put your long post in spoilers please? That's a lot of scrolling...

Re: "How do I ZScript?"

Posted: Sun Mar 05, 2017 8:27 pm
by Major Cooke
So Graf, how can we access the player via menus and/or manipulate them aside cvars? I would like to put things they purchase immediately into their inventory so the menus can self-update when attempting to visit it again.

Re: "How do I ZScript?"

Posted: Mon Mar 06, 2017 2:04 am
by Nash
Major Cooke wrote:maybe try a struct? I use structs all the time for global access to functions.
Minimal example please? Thanks

Re: "How do I ZScript?"

Posted: Mon Mar 06, 2017 2:09 am
by Graf Zahl
Nash wrote:Yeah that's what I already did (it doesn't work with quotes BTW, eg, it only works with version 2.4, not version "2.4")
If that is the case the devbuild is not the latest commit and may also be the cause of other errors.

Re: "How do I ZScript?"

Posted: Mon Mar 06, 2017 2:17 am
by Nash
I have already double-checked and I am indeed on the latest commit. The version directive actually works with and without quotes. Sorry for the wrong information.

Will use quotes as per suggestion though.

However I am still getting my 187 errors. I've already posted my code fragments above. Please advise...

Re: "How do I ZScript?"

Posted: Mon Mar 06, 2017 2:51 am
by Graf Zahl
Major Cooke wrote:So Graf, how can we access the player via menus and/or manipulate them aside cvars
You can't. That's the whole point of the subsystem separation and the discussion about this had been going on for quite some time already.
If you try to manipulate the game directly from the menu the game will lose any ability to be run in multiplayer or to have demos recorded. All changes the menus make to the playsim have to be routed through the network but that won't run game tics if the menu pauses the game. So running a "give item amount" command will work but feedback may be delayed.