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
Script Crashes The Game
Wapez Offline
Senior Member

Posts: 360
Threads: 37
Joined: Mar 2012
Reputation: 19
#14
RE: Script Crashes The Game

(03-14-2014, 02:59 PM)Mudbill Wrote: Do you understand what's going on here? Any ideas? Undecided

After going through it really briefly, your script looks fine to me. However, while trying it in my head, I noticed that sometimes a co-ordinate will result in containing a zero in one of it's numbers. Like this:

Spoiler below!

PHP Code: (Select All)
bool bWest, bEast, bNorth, bSouth;

void AttachSlate(string &in asArea, string &in asBodyName)
{    
    if(
StringContains(asBodyName, "west") == true) bWest = true; else bWest = false;
    if(
StringContains(asBodyName, "east") == true) bEast = true; else bEast = false;
    if(
StringContains(asBodyName, "north") == true) bNorth = true; else bNorth = false;
    if(
StringContains(asBodyName, "south") == true) bSouth = true; else bSouth = false;
    
    
//bWest == true
    //bEast == true
    //bNorth == false
    //bSouth == false
    
    
for(int x=1; x <= 5; ++x) for(int y=1; y <= 5; ++y) {
                
        
string sThisArea = "area_x"+x+"y"+y;
        
string sThisDoor = "move_";
            
        if(
bWest  == true) sThisDoor = sThisDoor +"x" + --x; else sThisDoor = sThisDoor +"x" +x;
        
//move_x0
        
if(bNorth == true) sThisDoor = sThisDoor +"y" + --y; else sThisDoor = sThisDoor +"y" +y;
        
//move_x0y1
        
if(bEast  == true) sThisDoor = sThisDoor +"_x"+ ++x; else sThisDoor = sThisDoor +"_x"+x;
        
//move_x0y1_x2
        
if(bSouth == true) sThisDoor = sThisDoor +"y" + ++y; else sThisDoor = sThisDoor +"y" +y;
        
//move_x0y1_x2y1
        
        
if(asArea == sThisArea) {
            
UpdateDoors(sThisDoor, 1);
            
//UpdateDoors("move_x0y1_x2y1", 1);

            
AddDebugMessage("Area: " + sThisArea, false);
            
AddDebugMessage("Door: " + sThisDoor, false);
        }
    }
    
    
bWest = false;
    
bEast = false;
    
bNorth = false;
    
bSouth = false;
}

void UpdateDoors(string &in asDoor, int alState)
{
    
AddDebugMessage("Updating Door: " + asDoor, false);
    
SetMoveObjectState(asDoor, alState);
    
//SetMoveObjectState("move_x0y1_x2y1, 1);
} 


This isn't what's causing your crashes, but it's a bug (unless I'm too tired and sick to be able to think straight), since I'm guessing you don't have a door named like that.

I'll keep looking for a possible cause to your problems and I'll let you know if I find something.

Founder & Legally Accountable Publisher of Red Line Games.
Environment & Gameplay Designer and Scripter.
http://moddb.com/mods/in-lucys-eyes
03-14-2014, 03:56 PM
Find


Messages In This Thread
Script Crashes The Game - by Wapez - 03-11-2014, 01:54 PM
RE: Script Crashes The Game - by PutraenusAlivius - 03-11-2014, 02:34 PM
RE: Script Crashes The Game - by Wapez - 03-11-2014, 02:39 PM
RE: Script Crashes The Game - by PutraenusAlivius - 03-11-2014, 02:43 PM
RE: Script Crashes The Game - by Wapez - 03-11-2014, 02:57 PM
RE: Script Crashes The Game - by Mudbill - 03-11-2014, 03:12 PM
RE: Script Crashes The Game - by Daemian - 03-11-2014, 03:15 PM
RE: Script Crashes The Game - by Wapez - 03-11-2014, 03:40 PM
RE: Script Crashes The Game - by Mudbill - 03-11-2014, 09:09 PM
RE: Script Crashes The Game - by Daemian - 03-12-2014, 01:22 AM
RE: Script Crashes The Game - by Mudbill - 03-13-2014, 09:27 PM
RE: Script Crashes The Game - by Wapez - 03-14-2014, 08:54 AM
RE: Script Crashes The Game - by Mudbill - 03-14-2014, 02:59 PM
RE: Script Crashes The Game - by Wapez - 03-14-2014, 03:56 PM
RE: Script Crashes The Game - by Apfel - 03-14-2014, 04:35 PM
RE: Script Crashes The Game - by Wapez - 03-14-2014, 04:42 PM
RE: Script Crashes The Game - by Apfel - 03-14-2014, 05:31 PM
RE: Script Crashes The Game - by Wapez - 03-14-2014, 05:36 PM
RE: Script Crashes The Game - by Mudbill - 03-14-2014, 05:49 PM



Users browsing this thread: 1 Guest(s)