Frictional Games Forum (read-only)

Full Version: Could I get some assistance with these if's?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
- AddCombineCallback is only usable in Inventory.hps IIRC.
- Use AddLocalVarInt instead of using SetLocalVarInt.
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