Frictional Games Forum (read-only)
Could I get some assistance with these if's? - 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: Could I get some assistance with these if's? (/thread-23476.html)



Could I get some assistance with these if's? - Romulator - 10-02-2013

Okay, I have declared some stuff up top.
PHP Code:
AddEntityCollideCallback("Player""CanBuild""PlaceLadder"false0);
AddCombineCallback("""Half_Ladder_1""Half_Ladder_2""BuildLadder"true);
SetLocalVarInt("CanBuildLadder"0); 

Then I have worked the functions down the bottom. I have used Local Vars because I cannot check.. well, I don't think I can do what I wanted in a simpler method. Basically I want to be able to combine two ladder parts together (Justine items) to make one larger ladder item, but that ladder can only be put together within a certain script area, because it would technically be too big to hold in the inventory Tongue

In order to check if the player is in the Script Area, I change the Local Var to 1, and if the player is not in the area, it becomes 0.

PHP Code:
void PlaceLadder(string &in asParentstring &in asChildint alState)
{
    if(
alState == 1)
        {
        
SetLocalVarInt("CanBuildLadder"1);
        }
        else
        {
        
SetLocalVarInt("CanBuildLadder"0);
        }
}
        
void BuildLadder(string &in asItemAstring &in asItemB)
{
    if (
GetLocalVarInt("CanBuildLadder") == 1)
        {
        
SetEntityActive("LadderArea_1"true);
        
SetEntityActive("ladder_static_1"true);
        }


The errors returned are:
(210, 2) Expected "," or ";"
(214, 3) Unexpected Token else
(220, 2) Expected "," or ";"

Line 210 is if(alState == 1)

If needed, I can and will post the whole code Smile


RE: Could I get some assistance with these if's? - PutraenusAlivius - 10-02-2013

- AddCombineCallback is only usable in Inventory.hps IIRC.
- Use AddLocalVarInt instead of using SetLocalVarInt.


RE: Could I get some assistance with these if's? - Romulator - 10-02-2013

Gave it a go and
Gave up Tongue

So instead, I'll just make it so you can place the ladders in the appropriate spot in order to make a larger ladder.

Marked as solved Smile