Sun Oct 31, 2021 8:41 am
int FloorSwitch210;
int FloorSwitch211;
int FloorSwitch212;
int FloorSwitch213;
int FloorSwitch214;
int FloorSwitch215;
int FloorSwitch216;
int FloorSwitch217;
int FloorSwitch218;
script 210 (int SwitchNumber, int SwitchDoor, int SwitchTid)
{
SetLineSpecial(SwitchNumber,0,0,0,0,0,0); //Deactivate the other lines on this switch
Floor_LowerByValue (SwitchNumber, 64, 4); //Depress the switch
Door_Open (SwitchDoor, 64); //Let the monster come in
ThingSound(SwitchTid, "switches/exitbutn", 127); //Make switch click
if (SwitchNumber == 210)
{
FloorSwitch210++;
}
if (SwitchNumber == 211)
{
FloorSwitch211++;
}
if (SwitchNumber == 212)
{
FloorSwitch212++;
}
if (SwitchNumber == 213)
{
FloorSwitch213++;
}
if (SwitchNumber == 214)
{
FloorSwitch214++;
}
if (SwitchNumber == 215)
{
FloorSwitch215++;
}
if (SwitchNumber == 216)
{
FloorSwitch216++;
}
if (SwitchNumber == 217)
{
FloorSwitch217++;
}
if (SwitchNumber == 218)
{
FloorSwitch218++;
}
}
ACS_NamedExecuteAlways("ActivateAllSwitches", 0, 0, 0, 0);
" Script "ActivateAllSwitches" (void)
{
if (FloorSwitch210 <1)
{
ACS_ExecuteAlways(210, 0, 210, 47, 22);
}
if (FloorSwitch211 <1)
{
ACS_ExecuteAlways(210, 0, 211, 49, 23);
}
if (FloorSwitch212 <1)
{
ACS_ExecuteAlways(210, 0, 212, 51, 24);
}
if (FloorSwitch213 <1)
{
ACS_ExecuteAlways(210, 0, 213, 53, 25);
}
if (FloorSwitch214 <1)
{
ACS_ExecuteAlways(210, 0, 214, 55, 26);
}
if (FloorSwitch215 <1)
{
ACS_ExecuteAlways(210, 0, 215, 57, 27);
}
if (FloorSwitch216 <1)
{
ACS_ExecuteAlways(210, 0, 216, 59, 28);
}
if (FloorSwitch217 <1)
{
ACS_ExecuteAlways(210, 0, 217, 61, 29);
}
if (FloorSwitch218 <1)
{
ACS_ExecuteAlways(210, 0, 218, 63, 30);
}
}
Sun Oct 31, 2021 9:28 am
Int FloorSwitch[9];
script 210 (int SwitchNumber, int SwitchDoor, int SwitchTid)
{
SetLineSpecial(SwitchNumber,0,0,0,0,0,0);
Floor_LowerByValue (SwitchNumber, 64, 4);
Door_Open (SwitchDoor, 64);
ThingSound(SwitchTid, "switches/exitbutn", 127);
FloorSwitch[SwitchNumber - 210]++;
}
Script "ActivateAllSwitches" (void)
{
For (Int I = 0; I < 9; I++)
{
If (FloorSwitch[I] < 1)
{
ACS_ExecuteAlways(210, 0, 210 + I, 47 + (I * 2), 22 + I);
}
Delay(1); //Haven't mapped in awhile so I haven't used ACS in some time, therefore I don't know if this delay is necessary to prevent a runaway script
}
}
Sun Oct 31, 2021 11:10 am
Sun Oct 31, 2021 12:39 pm
Enjay wrote:By the look of it, if I add any extra switches that can't fit within the 210, 211... number sequence (because tags 219 and above have already been used elsewhere) I will have to specify them separately though, right?
int my_array[] = { 210, 211, 218, 613, 1472, 36, 101, 0 }
for (int i = 0; my_array[i] != 0; ++i)
{
do_something(i);
}
Sun Oct 31, 2021 1:32 pm