"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!)
-
- Lead GZDoom+Raze Developer
- Posts: 49182
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: "How do I ZScript?"
You can't. Right now it's only a handful of types which I needed for internal definitions that are supported.
-
-
- Posts: 1355
- Joined: Mon May 06, 2013 8:02 am
Re: "How do I ZScript?"
Okay. Target.ACS_NamedExecuteAlways with a property changing script works until then.
-
-
- Posts: 17465
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: "How do I ZScript?"
@kodi: Which properties are you interested in, specifically? It may already be possible to alter them directly as variables.
-
-
- Posts: 1355
- Joined: Mon May 06, 2013 8:02 am
Re: "How do I ZScript?"
@nash PROP_TOTALLYFROZEN
-
-
- Posts: 17465
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: "How do I ZScript?"
An excerpt from my sidescroller game kit:
The .cheats field is what you want to manipulate. The list of all CF_ flags is in constants.txt :)
Code: Select all
// set the player to totally frozen; we will customize the player
// movement from scratch
players[e.PlayerNumber].cheats |= CF_TOTALLYFROZEN;
-
-
- Posts: 17465
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: "How do I ZScript?"
Spoiler:I don't even know where to begin. Sigh. Maybe I'll rest a few days...
Last edited by Rachael on Sun Mar 05, 2017 8:54 pm, edited 1 time in total.
Reason: spoilered
Reason: spoilered
-
- Lead GZDoom+Raze Developer
- Posts: 49182
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: "How do I ZScript?"
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.
-
-
- Posts: 17465
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: "How do I ZScript?"
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.
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]
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]
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: "How do I ZScript?"
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...
Also Nash, can you kindly put your long post in spoilers please? That's a lot of scrolling...
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: "How do I ZScript?"
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.
-
-
- Posts: 17465
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: "How do I ZScript?"
Minimal example please? ThanksMajor Cooke wrote:maybe try a struct? I use structs all the time for global access to functions.
-
- Lead GZDoom+Raze Developer
- Posts: 49182
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: "How do I ZScript?"
If that is the case the devbuild is not the latest commit and may also be the cause of other errors.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")
-
-
- Posts: 17465
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: "How do I ZScript?"
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...
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...
-
- Lead GZDoom+Raze Developer
- Posts: 49182
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: "How do I ZScript?"
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.Major Cooke wrote:So Graf, how can we access the player via menus and/or manipulate them aside cvars
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.