Question: Scripting with a (*) - Rapture - 11-27-2011
Can anyone explain in more detail with the use of a * in scripting for Amensia? My code is fine in working, except when I tried to change this one part from a 1 to a *.Code: AddPropImpulse("FloatBox_*", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
It works for the Code: SetEntityInteractionDisabled("FloatBox_*", true);
fine. But not for the AddPropImpulse?
So what's wrong with it? You can see now I'm trying to manually put in junk lines to get the boxes to work. But I'm planning to have over 200+ boxes, and I don't want to fill up the .hps with more lines if I can help it.
Code: void OnStart()
{
AddTimer("FloatTime", 0.01, "FloatObjects");
SetEntityInteractionDisabled("FloatBox_*", true);
AddEntityCollideCallback("Player", "BoxActivate_1", "BoxActivate_1_Start", true, 1);
}
void Intro()
{
}
void OnEnter()
{
}
//**********************************************************************************
void BoxActivate_1_Start(string &in asParent, string &in asChild, int alState)
{
AddTimer("FloatObjects1", 0.01, "FloatObjects1");
}
void FloatObjects1(string &in asTimer)
{
AddPropImpulse("FloatBox_*", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_2", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_3", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_4", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_5", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_6", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_7", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_8", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_10", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_12", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_13", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_14", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_15", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_16", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_17", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_18", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_19", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_20", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_21", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_22", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_23", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_24", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_25", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_26", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_27", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_28", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_29", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
// AddPropImpulse("FloatBox_30", RandFloat(-2,2), 1.1, RandFloat(-2,2), "");
AddTimer("FloatTime", 0.1, "FloatObjects1");
}
RE: Question: Scripting with a (*) - Your Computer - 11-27-2011
Not all functions support the asterisk wildcard. Better support for this wildcard will be included in HPL3, though. You may have to go with a for loop instead.
|