"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!)
-
- Posts: 8197
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: "How do I ZScript?"
Did you try adding play to the end of your functions? I don't think clearscope is meant to be used like that...
And again, ZZYZX just 'broke' a lot of things with one of his recent commits so he should explain why first. You can backtrack a bit in the mean time and keep going.
And again, ZZYZX just 'broke' a lot of things with one of his recent commits so he should explain why first. You can backtrack a bit in the mean time and keep going.
-
-
- Posts: 17468
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: "How do I ZScript?"
Yes, adding play to some of the classes already helps a lot, it's now down to 46 errors instead of hundreds.
I still don't understand what I'm doing but at this point I just want to get the damn thing to even run first.
I still don't understand what I'm doing but at this point I just want to get the damn thing to even run first.
-
- Lead GZDoom+Raze Developer
- Posts: 49188
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: "How do I ZScript?"
I think your problems are a textbook case why the separation is needed. A mod that liberally mixes these things is bound to cause problems at some point in the future.
The thing is, creating menus that don't screw up the game state is very important and it is very easy and very tempting to do it wrong.
The thing is, creating menus that don't screw up the game state is very important and it is very easy and very tempting to do it wrong.
-
- Posts: 8197
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: "How do I ZScript?"
Ed the Bat:
While this will fix your boot-up problem, I can't guarantee it'll actually work itself. But at least you can start the game up again.
Allow me to explain: NetworkProcess is the place where you want to do stuff, because network compatibility matters.
Code: Select all
class MGTauntHandler : EventHandler
{
override void ConsoleProcess(ConsoleEvent ev)
{
if (ev.Name == "MGTauntHandler")
EventHandler.SendNetworkEvent("DoATaunt", 0, 0, 0);
}
override void NetworkProcess(ConsoleEvent ev)
{
if (ev.Name == "DoATaunt")
{
let plr = players[ev.Player].mo;
if (plr)
plr.A_PlaySound("*taunt",CHAN_VOICE);
}
}
}
Allow me to explain: NetworkProcess is the place where you want to do stuff, because network compatibility matters.
-
-
- Posts: 17468
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: "How do I ZScript?"
The bulk of those hundreds of errors came from trying to Get the global thinker, which was code that you gave. I just followed whatever you gave me.Graf Zahl wrote:I think your problems are a textbook case why the separation is needed
-
- Lead GZDoom+Raze Developer
- Posts: 49188
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: "How do I ZScript?"
No, those hundreds of errors came from using some very non-standard ways of doing stuff.
-
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
Re: "How do I ZScript?"
Major Cooke: Thanks, but it doesn't seem to work.
-
-
- Posts: 17468
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: "How do I ZScript?"
Code: Select all
class Z_Time play
{
/*
* Gets current second of minute.
*/
static int T_GetSecond(void)
{
let bumi = FWorld.Get();
return bumi.timeSecond;
}
}
class FLocalWorld : Thinker
{
FLocalWorld Init()
{
ChangeStatNum(STAT_INFO);
return self;
}
static clearscope FLocalWorld Get()
{
ThinkerIterator it = ThinkerIterator.Create("FLocalWorld", STAT_INFO);
let p = FLocalWorld(it.Next());
if (p == null)
{
p = new("FLocalWorld").Init();
}
return p;
}
}
-
- Lead GZDoom+Raze Developer
- Posts: 49188
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: "How do I ZScript?"
Having a class to host a single static function is pretty much non-standard, especially when all it does is calling a function from anothzer class and returning a value from that object. I would have put it into FWorld itself.
I wish there was a way to automate assignment to one of the two sides to avoid having to declare this explicitly 'play'.
I wish there was a way to automate assignment to one of the two sides to avoid having to declare this explicitly 'play'.
-
-
- Posts: 17468
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: "How do I ZScript?"
Alright, I will try putting every static method I use into that one FWorld class and report back whever it works or not later.
(No it's not just a single static function I'm using, there's actually several. I only posted one to save forum space)
(No it's not just a single static function I'm using, there's actually several. I only posted one to save forum space)
-
- Lead GZDoom+Raze Developer
- Posts: 49188
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: "How do I ZScript?"
And they still don't work after setting the classes to 'play'?
-
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
Re: "How do I ZScript?"
How did you get it to work? I still get this error trying to call any ACS_* functionskodi wrote:Okay. Target.ACS_NamedExecuteAlways with a property changing script works until then.
-
- Posts: 8197
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: "How do I ZScript?"
You have to bind a key to it and press it.Ed the Bat wrote:Major Cooke: Thanks, but it doesn't seem to work.
bind kp* "event MGTauntHandler"
Events fired from the console won't exactly work the same anymore.
-
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
Re: "How do I ZScript?"
Ah, I see. I had to change that from "netevent" to just "event". Thanks, it's working again.
-
-
- Posts: 17468
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: "How do I ZScript?"
MajorCooke was kind enough to help me fix my game, MC you da real OG.
It runs now... hopefully there won't be any bugs.
It runs now... hopefully there won't be any bugs.