a way for a script to check if another script has happened?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

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!)
Post Reply
KeaganH
Posts: 33
Joined: Fri Sep 25, 2020 4:54 pm

a way for a script to check if another script has happened?

Post by KeaganH »

So what's supposed to happen is that in my map: a sound is suppose to play after you cross over a linedef, but only if another script has happened or else it just tells you to go find the place that executes the required script. I want to know if there is a way to check if another script has happened before executing, I've tried this:

Code: Select all

script 10 (void) 
{
	If (ACS_Execute(11,0,0,0,0))
	AmbientSound("exeitor/laugh",127);
	else
	Setfont("TBIGFONT");
	PrintBold(s:"\c-I need to get the file on Eggman");
} 
and

Code: Select all

script 10 (void) 
{
	If (ScriptWait(11))
	AmbientSound("exeitor/laugh",127);
	else
	Setfont("TBIGFONT");
	PrintBold(s:"\c-I need to get the file on Eggman");
}
Thanks,

Keagan H.
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: a way for a script to check if another script has happen

Post by Jarewill »

Use map variables for that.
For example:

Code: Select all

bool event1;

script 10 (void)
{
   If (event1)
   AmbientSound("exeitor/laugh",127);
   else
   { //Put this in brackets, otherwise the PrintBold will always execute
   Setfont("TBIGFONT");
   PrintBold(s:"\c-I need to get the file on Eggman");
   }
}
And in the other script put this:

Code: Select all

event1 = 1;
Post Reply

Return to “Scripting”