Frictional Games Forum (read-only)
[SCRIPT] I'm blind to my own errors - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] I'm blind to my own errors (/thread-20575.html)



I'm blind to my own errors - CarnivorousJelly - 03-01-2013

Warning: this is probably a "nublette" question, any help at all is much appreciated.

I have several lights (which are connected to billboards) set with a radius of 0 so that the billboards are also off. I want these to "turn on" at a set time, so I used a timer and light value script-thingies (which I don't know the proper name for).

Thought I had it right, but when I loaded the script in game, there was an error: expected '(' for (82,20) (83,20) (84,20) (85,20), which are the "FadeLightTo(string& as_____); lines.

The "AddTimer" is part of a larger script, which is why it's indented. If you need more of this huge script to actually help me, I can add the rest of the script.

My script:
Code:
    AddTimer("Ghosts_On", 2.5f, "ghosts_visible");
}

void ghosts_visible(string &in strTimer)
{
    FadeLightTo(string& asPiano, 1.000f, 0.517f, 0.225f, 0.000f, 0.75f, 0.5f);
    FadeLightTo(string& asViolin 0.552f, 0.793f, 1.000f, 0.000f, 0.75f, 1.0f);
    FadeLightTo(string& asCelloI, 1.000f, 0.567f, 0.413f, 0.000f, 0.75f, 1.5f);
    FadeLightTo(string& asCelloII, 1.000f, 0.655f, 0.749f, 0.000f, 0.75f, 2.0f);
}

What I was trying to use:
Code:
void FadeLightTo(string& asLightName, float afR, float afG, float afB, float afA, float afRadius, float afTime);

asLightName - internal name
afR - red value
afG - green value
afB - blue value
afA - alpha value
afRadius - radius of the light. -1 means keeping the radius
afTime - time in seconds until change is done

Thanks in advance for the help!


RE: Editing Lights - NaxEla - 03-01-2013

Instead of writing string& asPiano, string& asViolin, etc., write "Piano", "Violin". Strings always go in double quotes ("").


RE: Editing Lights - Rapture - 03-01-2013

Seems like you took the wiki a bit to serious in some parts. Look at other people's work to next time if your having trouble before asking... Also, list out the full .hps file also, the debugger isn't always accurate when it tells you what lines it thinks the problem is on.

void ghosts_visible(string &in strTimer) --> Should be "(string &in asTimer)"
{
FadeLightTo(string& asPiano, 1.000f, 0.517f, 0.225f, 0.000f, 0.75f, 0.5f);
FadeLightTo(string& asViolin 0.552f, 0.793f, 1.000f, 0.000f, 0.75f, 1.0f);
FadeLightTo(string& asCelloI, 1.000f, 0.567f, 0.413f, 0.000f, 0.75f, 1.5f);
FadeLightTo(string& asCelloII, 1.000f, 0.655f, 0.749f, 0.000f, 0.75f, 2.0f);
}

What I highlighted in green above, you don't need the "string& as" part, just the stuff after it. You also need quotation marks around the words ("")


Also on the 2nd line (string& asViolin), you forgot a comma.


void ghosts_visible(string &in strTimer)
{
FadeLightTo("Piano", 1.000f, 0.517f, 0.225f, 0.000f, 0.75f, 0.5f);
FadeLightTo("Violin", 0.552f, 0.793f, 1.000f, 0.000f, 0.75f, 1.0f);
FadeLightTo("CelloI", 1.000f, 0.567f, 0.413f, 0.000f, 0.75f, 1.5f);
FadeLightTo("CelloII", 1.000f, 0.655f, 0.749f, 0.000f, 0.75f, 2.0f);
}



In case your actually writing the scripts down by hand. Copy/paste code as templates from your own code or others to save time and cut down on spelling errors.


RE: Editing Lights - NaxEla - 03-01-2013

(03-01-2013, 09:20 PM)Rapture Wrote: void ghosts_visible(string &in strTimer) --> Should be "(string &in asTimer)"

It actually doesn't matter what asTimer is called. It's just the variable that the name of the timer (AddTimer(string& asName, float afTime, string& asFunction) is stored in.


RE: Editing Lights - CarnivorousJelly - 03-01-2013

I think I have it right this time... or I thought I did.
Code:
void timer_fade(string &in strTimer)
{
    if(GetLocalVarInt("IsPlayerInArea") == 1)
    {
        FadeOut(0.5);
        AddTimer("Teleport_1", 0.5f, "teleport_timer");
        AddTimer("Ghosts_On", 3.5f, "ghosts_visible");
        SetLocalVarInt("VisionTriggered", 1);
    }
}

void teleport_timer(string &in strTimer)
{
    TeleportPlayer("Vision_Start");
    FadeIn(2);
}

void ghosts_visible(string &in asTimer)
{
    FadeLightTo("Piano", 1.000f, 0.517f, 0.225f, 0.000f, 0.75f, 0.5f);
    FadeLightTo("Violin", 0.552f, 0.793f, 1.000f, 0.000f, 0.75f, 1.0f);
    FadeLightTo("CelloI", 1.000f, 0.567f, 0.413f, 0.000f, 0.75f, 1.5f);
    FadeLightTo("CelloII, 1.000f, 0.655f, 0.749f, 0.000f, 0.75f, 2.0f);
}

Ran the script in-game (pre-loaded so I could get the error messages) and it said "main (107,2) : ERR : Unexpected end of file". The end of the script file looks like this:

Code:
void teleport_timer02(string &in strTimer)
{
    TeleportPlayer("Vision_End");
    FadeIn(2.5);
}

void OnLeave()
{

}//<~ (107,2) right here (ignoring the stuff inside the "//", which I just added) //

The only change I made was to add the "ghost_visible" timer.

I feel like I'm playing a game of "spot the errors"... I'm sure there must be a million I've made.