Frictional Games Forum (read-only)
Cannot get my script to work properly - 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: Cannot get my script to work properly (/thread-23584.html)



Cannot get my script to work properly - Neelke - 10-13-2013

I've made a script where a phonograph plays a voice. However, I get Unexpected end of file when I enter. There's probably some small thing that I've missed but I cannot see it at the time. Please give me a hand Smile

void MariusWelcome(string &in asEntity, int alState)
{
PlayPhono(31, 1, 7, asEntity);
}

void PlayPhono(int iLevel, int iVoicePart, int iPart, string &in asEntity)
{
SetEntityInteractionDisabled(asEntity, true); //No more interact with phono as it does not do anything
PlaySoundAtEntity("phono_scrape", "ptest_phono_loop", asEntity, 1.0f, false);

for(int i = 1;i<=iPart;i++)
AddEffectVoice("marius_rec_lvl"+iLevel+"_0"+iPart+"_0"+iVoicePart+".ogg,
"",
"Voices", "CH05L"+iLevel+"_MariusWelcome0"+i,
true, asEntity, 4, 16
);

SetEffectVoiceOverCallback("VoiceOverPhono");
}

void VoiceOverPhono()
{
StopSound("phono_scrape", 2.0f);

//Allow the player to proceed
SetEntityActive("AreaLooseBricks", true);
}

Not too long I hope, as some people are just complaining about everything.


RE: Cannot get my script to work properly - The chaser - 10-13-2013

(10-13-2013, 06:28 PM)Neelke Wrote: I've made a script where a phonograph plays a voice. However, I get Unexpected end of file when I enter. There's probably some small thing that I've missed but I cannot see it at the time. Please give me a hand Smile

void MariusWelcome(string &in asEntity, int alState)
{
PlayPhono(31, 1, 7, asEntity);
}

void PlayPhono(int iLevel, int iVoicePart, int iPart, string &in asEntity)
{
SetEntityInteractionDisabled(asEntity, true); //No more interact with phono as it does not do anything
PlaySoundAtEntity("phono_scrape", "ptest_phono_loop", asEntity, 1.0f, false);

for(int i = 1;i<=iPart;i++)
{
AddEffectVoice("marius_rec_lvl"+iLevel+"_0"+iPart+"_0"+iVoicePart+".ogg,
"",
"Voices", "CH05L"+iLevel+"_MariusWelcome0"+i,
true, asEntity, 4, 16
);

SetEffectVoiceOverCallback("VoiceOverPhono");
}
}

void VoiceOverPhono()
{
StopSound("phono_scrape", 2.0f);

//Allow the player to proceed
SetEntityActive("AreaLooseBricks", true);
}

Not too long I hope, as some people are just complaining about everything.

I have edited your script.

Here's a useful link:

http://wiki.frictionalgames.com/hpl2/tutorials/script/problem


RE: Cannot get my script to work properly - Neelke - 10-13-2013

Probably one of the issues, it's the same problem now too (Unexpected end of file). There's some more things that has to be fixed.


RE: Cannot get my script to work properly - WALP - 10-13-2013

This cant be your entire script can it? I am not much of a scripter but I am pretty sure a OnStart() or OnEnter() is needed to at the very least set the callbacks


RE: Cannot get my script to work properly - Neelke - 10-13-2013

Yes, of course I have those. But I only showed the script I knew was the problem.


RE: Cannot get my script to work properly - Apjjm - 10-14-2013

From a glance
AddEffectVoice("marius_rec_lvl"+iLevel+"_0"+iPart+"_0"+iVoicePart+".ogg
looks to be a problem line (missing a close quote on the .ogg).