error in "for" ? - 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: error in "for" ? (/thread-18655.html) |
error in "for" ? - Lizard - 10-06-2012 Hi guys Its first time im using "for" scripts, but so fare i can see nothing is wrong, but the games keep saying that my "for" needs 2 ; but i cant see it. //////////////////// //When entering map void OnEnter() { //Slime If(HasItem("glass_container_mix_done")) for(int i=1;i<=22;i++) { SetEntityActive("Slime_"+i, true); PlaySoundAtEntity("", "guardian_activated1.ogg", "Player", 0, false); StartScreenShake(0.1, 8, 2, 2); SetEntityActive("SlimeDamageArea_1", true); SetEntityActive("SlimeDamageArea_2", true); SetEntityActive("SlimeDamageArea_3", true); SetEntityActive("SlimeDamageArea_4", true); } //Keys AddUseItemCallback("", "CellerKey", "level_celler_1", "UsedKeyOnDoor", true); //Quests AddEntityCollideCallback("Player", "QuestArea", "SlimeQuest", true, 1); AddUseItemCallback("" "glass_container_mix_done", "web_1", "SlimeQuestEnd", true); } Hope you guys will help RE: error in "for" ? - Kreekakon - 10-06-2012 Try putting brackets around what goes in the if, like so If(HasItem("glass_container_mix_done")) { for(int i=1;i<=22;i++) { SetEntityActive("Slime_"+i, true); PlaySoundAtEntity("", "guardian_activated1.ogg", "Player", 0, false); StartScreenShake(0.1, 8, 2, 2); SetEntityActive("SlimeDamageArea_1", true); SetEntityActive("SlimeDamageArea_2", true); SetEntityActive("SlimeDamageArea_3", true); SetEntityActive("SlimeDamageArea_4", true); } } Also, from what I see so far, SetEntityActive("Slime_"+i, true); is the only script that really has any business being in the for. RE: error in "for" ? - Ongka - 10-06-2012 the If(HasItem("glass_container_mix_done")) has to be if(HasItem("glass_container_mix_done")) with a lowercase i. Remember, C++ is case-sensitive. RE: error in "for" ? - The chaser - 10-06-2012 //////////////////// //When entering map void OnEnter() { Spoiler below!
There was an unecessary "=". RE: error in "for" ? - Ongka - 10-06-2012 (10-06-2012, 03:44 PM)The chaser Wrote: There was an unecessary "=".Nah not really, <= x is the same as ≤x which means smaller than or equal as x. i<=22 is not the same as i<22 The first one repeats 22 times and the second one only 21 times. RE: error in "for" ? - Lizard - 10-06-2012 THanks guys Now my only problem is that there is no mathcing signatures to AddUseItemCallback("glass_container_mix_done", "web_1", "SlimeQuestEnd", true); void OnEnter() { AddUseItemCallback("glass_container_mix_done", "web_1", "SlimeQuestEnd", true); } void SlimeQuestEnd(string &in asItem, string &in asEntity) { CompleteQuest("slimeblockquest", "SlimeBlockQuest"); GiveSanityBoostSmall(); PlaySoundAtEntity("", "puzzle_acid.ogg", "web_1", 0, false); SetPropActiveAndFade("web_1", false, 4); } RE: error in "for" ? - The chaser - 10-06-2012 (10-06-2012, 03:49 PM)ZereboO Wrote: THanks guysIt should be: Spoiler below!
RE: error in "for" ? - Lizard - 10-06-2012 Its working now Thanks guys |