Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Puzzle Script Bug
Apfel Offline
Junior Member

Posts: 19
Threads: 3
Joined: Jun 2011
Reputation: 1
#2
RE: Puzzle Script Bug

Spoiler below!
PHP Code: (Select All)
void AttachSlate(string &in asAreastring &in asBodyName)
{       
    for(
int a=1<= 5; ++a) for(int b=1<= 5; ++b) {
     
        
int x a;
        
int y b;
        
        
string sThisArea "x"+a+"y"+b;
        
        if(
asArea == sThisArea) {
            
            
AddDebugMessage("asArea: " asAreafalse);
            
            if(
StringContains(asBodyName"west")) {
                
SetLocalVarString("WestDoor"sThisArea "_w");
                
SetLocalVarInt(GetLocalVarString("WestDoor"), 1);
                
AddDebugMessage("West Variable: > " GetLocalVarString("WestDoor") + " < is now: " GetLocalVarInt(GetLocalVarString("WestDoor")), false);
            }
            if(
StringContains(asBodyName"north")) {                // x=2, y=3   (first slate: put turn in x2y3)
                
SetLocalVarString("NorthDoor"sThisArea "_n");    // NorthDoor = "x2y3_n"
                
SetLocalVarInt(GetLocalVarString("NorthDoor"), 1);    // x2y3_n = 1
                
AddDebugMessage("North Variable: > " GetLocalVarString("NorthDoor") + " < is now: " GetLocalVarInt(GetLocalVarString("NorthDoor")), false);
            }
            if(
StringContains(asBodyName"east")) {                // x=2, y=3
                
SetLocalVarString("EastDoor"sThisArea "_e");    // EastDoor = "x2y3_e"
                
SetLocalVarInt(GetLocalVarString("EastDoor"), 1);    // x2y3_e = 1
                
AddDebugMessage("East Variable: > " GetLocalVarString("EastDoor") + " < is now: " GetLocalVarInt(GetLocalVarString("EastDoor")), false);
            }
            if(
StringContains(asBodyName"south")) {
                
SetLocalVarString("SouthDoor"sThisArea "_s");
                
SetLocalVarInt(GetLocalVarString("SouthDoor"), 1);
                
AddDebugMessage("South Variable: > " GetLocalVarString("SouthDoor") + " < is now: " GetLocalVarInt(GetLocalVarString("SouthDoor")), false);
            }
                                                                          
// x=2, y=2    (second slate: put horiz. in x2y2)
            
SetLocalVarString("WestReady""x" + --"y" y); ++x;    // WestReady     = "x1y2"
            
SetLocalVarString("NorthReady""x" "y" + --y); ++y;    // NorthReady     = "x2y1"
            
SetLocalVarString("EastReady""x" + ++"y" y); --x;    // EastReady    = "x3y2"
            
SetLocalVarString("SouthReady""x" "y" + ++y); --y;    // SouthReady    = "x2y3"
            
            
string sThisRoom "x"+x+"y"+y;                                // sThisRoom    = "x2y2"

            
AddDebugMessage("WestReady: " GetLocalVarString("WestReady") + "_e = " GetLocalVarInt(GetLocalVarString("WestReady")), false);
            
AddDebugMessage("NorthReady: " GetLocalVarString("NorthReady") + "_s = " GetLocalVarInt(GetLocalVarString("NorthReady")), false);
            
AddDebugMessage("EastReady: " GetLocalVarString("EastReady") + "_w = " GetLocalVarInt(GetLocalVarString("EastReady")), false);
            
AddDebugMessage("SouthReady: " GetLocalVarString("SouthReady") + "_n = " GetLocalVarInt(GetLocalVarString("SouthReady")), false);


            if(
GetBoolLocalVarInt(GetLocalVarString("WestReady")+"_e") && GetBoolLocalVarInt(GetLocalVarString("WestDoor")))
                if(
GetEntityExists("move_" GetLocalVarString("WestReady") + "_" sThisRoom) == true)
                    
UpdateDoors("move_" GetLocalVarString("WestReady") + "_" sThisRoom1);
            
            if(
GetBoolLocalVarInt(GetLocalVarString("NorthReady")+"_s") && GetBoolLocalVarInt(GetLocalVarString("NorthDoor")))
                if(
GetEntityExists("move_" GetLocalVarString("NorthReady") + "_" sThisRoom) == true)
                    
UpdateDoors("move_" GetLocalVarString("NorthReady") + "_" sThisRoom1);
            
            if(
GetBoolLocalVarInt(GetLocalVarString("EastReady")+"_w") && GetBoolLocalVarInt(GetLocalVarString("EastDoor")))
                if(
GetEntityExists("move_" sThisRoom "_" GetLocalVarString("EastReady")) == true)
                    
UpdateDoors("move_" sThisRoom "_" GetLocalVarString("EastReady"), 1);
            
            if(
GetBoolLocalVarInt(GetLocalVarString("SouthReady")+"_n") && GetBoolLocalVarInt(GetLocalVarString("SouthDoor")))   // x2y3_n = true && SouthDoor = ?
                
if(GetEntityExists("move_" sThisRoom "_" GetLocalVarString("SouthReady")) == true)
                    
UpdateDoors("move_" sThisRoom "_" GetLocalVarString("SouthReady"), 1);                               // move_x2y2_x2y3
        
}
    }




So, I looked at your script regarding your example that the door opens when it's not supposed to. And I can just guess what the problem might be.
So here are my thoughts:

First you place the turn (slate north east) in room x2y3. That sets the VarInt x2y3_n = 1.
Second you place the horizontal (slate west east) in room x2y2. That sets VarString SouthReady = "x2y3".

So in this part of the Script
Spoiler below!
PHP Code: (Select All)
if(GetBoolLocalVarInt(GetLocalVarString("SouthReady")+"_n") && GetBoolLocalVarInt(GetLocalVarString("SouthDoor")))   // x2y3_n = true && SouthDoor = ? 

returns the first part of the if statement a true. So the issue might be in the second part.

As I can see in your picture that there are slates placed which, I guess, contains the string "south", so I think that something is stored in LocalVarString("SouthDoor").

It might help resetting these Vars (example:SetLocalVarString("SouthDoor", ""))
right after: if(asArea == sThisArea) {




Well, that is all I can think of. I don't know if that helps or if that's the issue anyway.
03-23-2014, 06:16 PM
Find


Messages In This Thread
Puzzle Script Bug - by Mudbill - 03-23-2014, 02:40 AM
RE: Puzzle Script Bug - by Apfel - 03-23-2014, 06:16 PM
RE: Puzzle Script Bug - by Mudbill - 03-25-2014, 04:36 PM



Users browsing this thread: 1 Guest(s)