Frictional Games Forum (read-only)
[SCRIPT] Script help needed - 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] Script help needed (/thread-18277.html)

Pages: 1 2 3


RE: Script help needed - Robby - 10-06-2012

Like that. Unless I am wrong, which is unlikely.


RE: Script help needed - The chaser - 10-06-2012

(10-06-2012, 08:02 PM)Steve Wrote:
(10-05-2012, 08:33 PM)The chaser Wrote: Whoa, I just can't read the script that way. Put it in code, remember. I'm practising with these, maybe I can solve your problem.
you mean like this?
Code:
const string[] oven_sticky_areas = {"OvenArea_1", "OvenArea_2", "OvenArea_3", "OvenArea_4"};
const string oven_object_name = "object";
const string oven_door_name = "extaction_oven_6";
const string oven_lever_name = "Lever_1";
void OnStart()
{
SetEntityConnectionStateChangeCallback(oven_lever_name, "CheckIngredients");
}
////////////LEVER CHECK/////////////////
void CheckIngredients(string &in asEntity, int alState)
{
if(alState == 1)
{
if (GetLocalVarInt(oven_sticky_areas[0]) == 1
&& GetLocalVarInt(oven_sticky_areas[1]) == 1
&& GetLocalVarInt(oven_sticky_areas[2]) == 1
&& GetLocalVarInt(oven_sticky_areas[3]) == 1)
{
AddDebugMessage("OvenPuzzle: Correct!", false);
AddTimer("CompleteOvenPuzzle", 1, "CompleteOvenPuzzle");
}
else
{
AddDebugMessage("OvenPuzzle: Wrong!", false);
SetMessage("Messages", "IncorrectCombination", 0);
}
}
}
void AttachObjectOven(string &in asStickyArea, string &in asBodyName)
{
if (StringContains(asBodyName, oven_object_name))
SetAllowStickyAreaAttachment(true);
else
{
SetAllowStickyAreaAttachment(false);
return;
}
AddDebugMessage(asStickyArea + " " + asBodyName, true);
asBodyName = StringSub(asBodyName, 0, oven_object_name.length() + 2);
AddDebugMessage(asBodyName, false);
if (StringContains(asStickyArea, "1") && StringContains(asBodyName, "1"))
SetLocalVarInt(asStickyArea, 1);
else if (StringContains(asStickyArea, "2") && StringContains(asBodyName, "2"))
SetLocalVarInt(asStickyArea, 1);
else if (StringContains(asStickyArea, "3") && StringContains(asBodyName, "3"))
SetLocalVarInt(asStickyArea, 1);
else if (StringContains(asStickyArea, "4") && StringContains(asBodyName, "4"))
SetLocalVarInt(asStickyArea, 1);
}
void DetachObjectOven(string &in asStickyArea, string &in asBodyName)
{
SetLocalVarInt(asStickyArea, 0);
}
void CompleteOvenPuzzle(string &in asTimer)
{
SetSwingDoorLocked(oven_door_name, false, true);
SetMessage("Messages", "correctcombinationchemicals", 0);
}
Directly from your script, please. There is a lot of missing things, and I'm very sure that isn't your real problem.
Sorry, but could you post your .hps file in [/code]? If I'm not wrong, the code function allows to copy/paste a code well, instead a normal post.

It's just that with that mess I cannot understand a single thing.

(doesn't mean you are a bad scripter Wink )


RE: Script help needed - Your Computer - 10-06-2012

The only thing that could possibly be wrong with the way Steve attempted to make it work, is either through bad entity name referencing or bad function name reference for the sticky areas.

(10-06-2012, 08:02 PM)Nemet Robert (Robby) Wrote: Like that. Unless I am wrong, which is unlikely.

What's the difference between the content found in the code box and the content found in the spoiler box? A white background.


RE: Script help needed - Robby - 10-06-2012

Answer's directly above your post.


RE: Script help needed - Steve - 10-06-2012

(10-06-2012, 08:32 PM)The chaser Wrote:
(10-06-2012, 08:02 PM)Steve Wrote:
(10-05-2012, 08:33 PM)The chaser Wrote: Whoa, I just can't read the script that way. Put it in code, remember. I'm practising with these, maybe I can solve your problem.
you mean like this?
Code:
const string[] oven_sticky_areas = {"OvenArea_1", "OvenArea_2", "OvenArea_3", "OvenArea_4"};
const string oven_object_name = "object";
const string oven_door_name = "extaction_oven_6";
const string oven_lever_name = "Lever_1";
void OnStart()
{
SetEntityConnectionStateChangeCallback(oven_lever_name, "CheckIngredients");
}
////////////LEVER CHECK/////////////////
void CheckIngredients(string &in asEntity, int alState)
{
if(alState == 1)
{
if (GetLocalVarInt(oven_sticky_areas[0]) == 1
&& GetLocalVarInt(oven_sticky_areas[1]) == 1
&& GetLocalVarInt(oven_sticky_areas[2]) == 1
&& GetLocalVarInt(oven_sticky_areas[3]) == 1)
{
AddDebugMessage("OvenPuzzle: Correct!", false);
AddTimer("CompleteOvenPuzzle", 1, "CompleteOvenPuzzle");
}
else
{
AddDebugMessage("OvenPuzzle: Wrong!", false);
SetMessage("Messages", "IncorrectCombination", 0);
}
}
}
void AttachObjectOven(string &in asStickyArea, string &in asBodyName)
{
if (StringContains(asBodyName, oven_object_name))
SetAllowStickyAreaAttachment(true);
else
{
SetAllowStickyAreaAttachment(false);
return;
}
AddDebugMessage(asStickyArea + " " + asBodyName, true);
asBodyName = StringSub(asBodyName, 0, oven_object_name.length() + 2);
AddDebugMessage(asBodyName, false);
if (StringContains(asStickyArea, "1") && StringContains(asBodyName, "1"))
SetLocalVarInt(asStickyArea, 1);
else if (StringContains(asStickyArea, "2") && StringContains(asBodyName, "2"))
SetLocalVarInt(asStickyArea, 1);
else if (StringContains(asStickyArea, "3") && StringContains(asBodyName, "3"))
SetLocalVarInt(asStickyArea, 1);
else if (StringContains(asStickyArea, "4") && StringContains(asBodyName, "4"))
SetLocalVarInt(asStickyArea, 1);
}
void DetachObjectOven(string &in asStickyArea, string &in asBodyName)
{
SetLocalVarInt(asStickyArea, 0);
}
void CompleteOvenPuzzle(string &in asTimer)
{
SetSwingDoorLocked(oven_door_name, false, true);
SetMessage("Messages", "correctcombinationchemicals", 0);
}
Directly from your script, please. There is a lot of missing things, and I'm very sure that isn't your real problem.
Sorry, but could you post your .hps file in [/code]? If I'm not wrong, the code function allows to copy/paste a code well, instead a normal post.

It's just that with that mess I cannot understand a single thing.

(doesn't mean you are a bad scripter Wink )

Well this is the entire script, I got it from YC if you go a bit back and I have it in [/code]

And also I have no idea actually what I am missing, If somebody might have an idea I could upload the map itself if you PM me because I'd rather not post it here wide and open Tongue


RE: Script help needed - Steve - 10-08-2012

still nothing...