Page 1 of 1

[Sloved] How to cancel an ACS_ExecuteAlways?

Posted: Sun Nov 29, 2015 1:13 pm
by Samuzero15tlh
Hmm I want to cancel a script what is called for ACS_ExecuteAlways. I know that it don't stop with terminate, so i want to knew how to stop that.

EDIT: Finally sloved.

Code: Select all

Bool Force_End = False;
Bool InUse = False;

Script 718 (Int Time) // Time Display
{
If(Inuse == False)
{
Inuse = True;
For(int t; Time !=0 && Force_End == False; Time--)
{
   HudMessage(d:Time;HUDMSG_Plain,30,CR_Blue,0.5,0.255,3.0,0.1);
   Delay(35);
}
HudMessage(s:"0";HUDMSG_Plain,30,CR_Red,0.5,0.255,3.0,0.1);
Inuse = False;
Force_End = False;
}
Else
{
Force_End = True;
Delay(1);
Restart;
}
}

RE: How to cancel an ACS_ExecuteAlways?

Posted: Sun Nov 29, 2015 1:30 pm
by Sean
Perhaps have a boolean variable somewhere, and somewhere in your script, do a check of that variable and if it's true, terminate; the script?

RE: How to cancel an ACS_ExecuteAlways?

Posted: Sun Nov 29, 2015 1:34 pm
by Ænima
Sean wrote: Perhaps have a boolean variable somewhere, and somewhere in your script, do a check of that variable and if it's true, terminate; the script?
Yep do this, this is how I would do it.

RE: How to cancel an ACS_ExecuteAlways?

Posted: Sun Nov 29, 2015 4:13 pm
by Samuzero15tlh

Code: Select all

Script 718 (Int EffectType,Int Time) // Time Display
{
Bool Inuse = False;
If(EffectType == 1)
{
If(Inuse == False)
 {
 Inuse = True;
  For(int t; Time !=0; Time--)
  {
  HudMessage(s:"\ccHaste ",d:Time;HUDMSG_Plain,30,CR_Blue,0.5,0.255,3.0,0.1);
  Delay(35);
  }
  HudMessage(s:"Haste 0";HUDMSG_Plain,30,CR_Red,0.5,0.255,3.0,0.1);
 }
 Else
 {
 // The part where it reset the timer.
 }
}
When its activated, the time displays, but when is activated again, the timer resets, so it "Terminates" the past timer and starts the new timer.
Thats what im trying to do.

RE: How to cancel an ACS_ExecuteAlways?

Posted: Sun Nov 29, 2015 5:27 pm
by Sean
[spoiler]
Sean wrote: Perhaps have a boolean variable somewhere, and somewhere in your script, do a check of that variable and if it's true, terminate; the script?
[/spoiler]

I'm sure you'll find a way to add this in somewhere.

RE: How to cancel an ACS_ExecuteAlways?

Posted: Sun Nov 29, 2015 7:23 pm
by ibm5155
break and terminate can do the job, it's just a matter of logic use.
or even some bool logic into the for loop like For(int t; Time !=0 && Force_End == false; Time--)

RE: How to cancel an ACS_ExecuteAlways?

Posted: Sun Nov 29, 2015 7:49 pm
by Samuzero15tlh
It was super effective!!

Code: Select all

Bool Force_End = False;
Bool InUse = False;

Script 718 (Int Time) // Time Display
{
If(Inuse == False)
{
Inuse = True;
For(int t; Time !=0 && Force_End == False; Time--)
{
   HudMessage(d:Time;HUDMSG_Plain,30,CR_Blue,0.5,0.255,3.0,0.1);
   Delay(35);
}
HudMessage(s:"0";HUDMSG_Plain,30,CR_Red,0.5,0.255,3.0,0.1);
Inuse = False;
Force_End = False;
}
Else
{
Force_End = True;
Delay(1);
Restart;
}
}
This worked so good! Thank you guys!