Prevent script from activating if a different script hasn't?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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
DoomBoy1999
Posts: 32
Joined: Mon Dec 14, 2020 9:51 am

Prevent script from activating if a different script hasn't?

Post by DoomBoy1999 »

script 5(void) {
Radius_Quake2(0,3,50,0,10,0);
SpawnSpot("Explosion",123);
Floor_MoveToValue(142,2000,888,0);
Floor_MoveToValue(143,2000,1040,0);
Floor_MoveToValue(144,2000,992,0);
}

script 6(void) {
FloorAndCeiling_RaiseByValue(146,10,204);
FloorAndCeiling_RaiseByValue(147,10,204);
Floor_RaiseByValue(148,10,204);
Floor_RaiseByValue(117,10,204);
}

If i wanted to prevent people from activating script 5 before script 6 and flashing a helpful bit of text on the screen, how would i do that? Both are activated via switch.
User avatar
ramon.dexter
Posts: 1562
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Prevent script from activating if a different script has

Post by ramon.dexter »

Create a variable and use if else statement.
User avatar
Logan MTM
Posts: 678
Joined: Mon Jan 16, 2006 8:53 pm
Location: Rio de Janeiro - Brazil

Re: Prevent script from activating if a different script has

Post by Logan MTM »

Code: Select all

Bool Script6Ok = False;

script 5(void) {

If(!Script6Ok) { Terminate; }

Radius_Quake2(0,3,50,0,10,0);
SpawnSpot("Explosion",123);
Floor_MoveToValue(142,2000,888,0);
Floor_MoveToValue(143,2000,1040,0);
Floor_MoveToValue(144,2000,992,0);
}

script 6(void) {
FloorAndCeiling_RaiseByValue(146,10,204);
FloorAndCeiling_RaiseByValue(147,10,204);
Floor_RaiseByValue(148,10,204);
Floor_RaiseByValue(117,10,204);

Script6Ok = True;
}
DoomBoy1999
Posts: 32
Joined: Mon Dec 14, 2020 9:51 am

Re: Prevent script from activating if a different script has

Post by DoomBoy1999 »

Thanks Logan, but is it possible to squeeze a print function in there? I've tried and im clueless :P
User avatar
Logan MTM
Posts: 678
Joined: Mon Jan 16, 2006 8:53 pm
Location: Rio de Janeiro - Brazil

Re: Prevent script from activating if a different script has

Post by Logan MTM »

Yes...!?
Post what you've done. :roll:
DoomBoy1999
Posts: 32
Joined: Mon Dec 14, 2020 9:51 am

Re: Prevent script from activating if a different script has

Post by DoomBoy1999 »

script 5(void) {

If(!Script6Ok) { Terminate; Print(S:"message"); }

Radius_Quake2(0,3,50,0,10,0);
SpawnSpot("Explosion",123);
Floor_MoveToValue(142,2000,888,0);
Floor_MoveToValue(143,2000,1040,0);
Floor_MoveToValue(144,2000,992,0);
}

script 6(void) {
FloorAndCeiling_RaiseByValue(146,10,204);
FloorAndCeiling_RaiseByValue(147,10,204);
Floor_RaiseByValue(148,10,204);
Floor_RaiseByValue(117,10,204);

Script6Ok = True;
User avatar
SanyaWaffles
Posts: 884
Joined: Thu Apr 25, 2013 12:21 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
Graphics Processor: nVidia with Vulkan support
Location: The Corn Fields
Contact:

Re: Prevent script from activating if a different script has

Post by SanyaWaffles »

Put the Print message before the Terminate.
User avatar
Logan MTM
Posts: 678
Joined: Mon Jan 16, 2006 8:53 pm
Location: Rio de Janeiro - Brazil

Re: Prevent script from activating if a different script has

Post by Logan MTM »

lol Dude!
Seriouslly didn't you realize that by your self?
It happens with me all time. :mrgreen:
DoomBoy1999
Posts: 32
Joined: Mon Dec 14, 2020 9:51 am

Re: Prevent script from activating if a different script has

Post by DoomBoy1999 »

:oops:
Post Reply

Return to “Scripting”