Kurask
Junior Member
Posts: 5
Threads: 1
Joined: Sep 2011
Reputation:
0
|
RE: Quick Question
Can someone show me how to reduce the LightOff functions into a few lines rather than 60 lines? Here is what I made so far, and it works perfectly fine, I just think it should take less lines to do.
void TestActive(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("castle_1", true, true);
for (int i=8; i < 23; i++)
{
AddTimer("", i-7, "LightOff"+i);
}
}
void LightOff8(string &in asTimer)
{
SetLampLit("torch_static01_8", false, true);
}
void LightOff9(string &in asTimer)
{
SetLampLit("torch_static01_9", false, true);
}
void LightOff10(string &in asTimer)
{
SetLampLit("torch_static01_10", false, true);
}
void LightOff11(string &in asTimer)
{
SetLampLit("torch_static01_11", false, true);
}
void LightOff12(string &in asTimer)
{
SetLampLit("torch_static01_12", false, true);
}
void LightOff13(string &in asTimer)
{
SetLampLit("torch_static01_13", false, true);
}
void LightOff14(string &in asTimer)
{
SetLampLit("torch_static01_14", false, true);
}
void LightOff15(string &in asTimer)
{
SetLampLit("torch_static01_15", false, true);
}
void LightOff16(string &in asTimer)
{
SetLampLit("torch_static01_16", false, true);
}
void LightOff17(string &in asTimer)
{
SetLampLit("torch_static01_17", false, true);
}
void LightOff18(string &in asTimer)
{
SetLampLit("torch_static01_18", false, true);
}
void LightOff19(string &in asTimer)
{
SetLampLit("torch_static01_19", false, true);
}
void LightOff20(string &in asTimer)
{
SetLampLit("torch_static01_20", false, true);
}
void LightOff21(string &in asTimer)
{
SetLampLit("torch_static01_21", false, true);
}
void LightOff22(string &in asTimer)
{
SetLampLit("chandelier_large_1", true, true);
}
(This post was last modified: 09-29-2011, 12:07 AM by Kurask.)
|
|
09-29-2011, 12:04 AM |
|
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
|
RE: Quick Question
void TestActive(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("castle_1", true, true);
for (int i=8; i < 23; i++)
{
AddTimer("LightOff"+i, i-7, "LightOff");
}
}
void LightOff( string &in asTimer)
{
SetLampLit("torch_static01_"+StringSub(asTimer,8,9), false, true);
}
|
|
09-29-2011, 12:19 AM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Quick Question
(09-29-2011, 12:19 AM)Tanshaydar Wrote: void TestActive(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("castle_1", true, true);
for (int i=8; i < 23; i++)
{
AddTimer("LightOff"+i, i-7, "LightOff");
}
}
void LightOff(string &in asTimer)
{
SetLampLit("torch_static01_"+StringSub(asTimer,8,9), false, true);
}
It'd be more efficient if you pass the name of the entity into the timer name.
void TestActive(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("castle_1", true, true);
for (int i=8; i < 23; ++i)
{
AddTimer("torch_static01_"+i, i-7, "LightOff");
}
}
void LightOff( string &in asTimer)
{
SetLampLit(asTimer, false, true);
}
(This post was last modified: 09-29-2011, 02:13 AM by Your Computer.)
|
|
09-29-2011, 02:11 AM |
|
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
|
RE: Quick Question
Well, that's all you can get from a quick answer
|
|
09-29-2011, 02:21 AM |
|
|