Need help understanding this
I'm messing around a bit with the entities from White Night just to try them out, particularly the lamps and lamp-switches, but I'm so confused.
I've inspected the White Night map and how the lamps and switches are placed and named etc and tried doing similar myself. It looks like in White Night, using this script:
void Lamp_Switcher(string &in asEntity, int alState)
{
if( alState == -1)
SetLampLit("swithcher_1_"+StringSub(asEntity,10,11), false, true);
if( alState == 1)
SetLampLit("swithcher_1_"+StringSub(asEntity,10,11), true, true);
}
Yeah using this script it seems that this is the only thing required and as long as the switchers and lamps are named correctly this is enough script. I tried doing the same, putting a switcher, naming it switcher_7 and a lamp (exactly same entity as in the place which I'm looking at in White Night) with the name switcher_1_7 and adding the "Lamp_Switcher" in the ConnectionStateChangeCallback box for the switch, but it doesn't work. If I just do it simple, removing the +StringSub parts etc it works, but then I'll have to make that script for every lamp and switch.
I don't understand what "+StringSub(asEntity,10,11) does..Especially "asEntity,10,11"....can anyone help me understand this?
Thanks in advance.
(This post was last modified: 01-20-2012, 11:57 AM by Shadowfied.)
|