View Single Post
# 1 06-03-2010 , 03:19 PM
Registered User
Join Date: Feb 2010
Posts: 4

Scope scope scope

Ok, so I'm being a complete newbie and getting stuck with scope. How should I be doing this?

PHP Code:
$fileLoc "C:/output.txt";
global 
$file=`fopen $fileLoc "r"`;

global 
int $readcount 0;
global 
string $curval "";
global 
int $curframe 0;

global 
matrix $frame[18][38];

main();

global 
proc main(){

    
$curval = `fgetword $file`;
    
$readcount++;

    while ( 
size$curval ) > ) {

        if(
$readcount == 686){
            
$readcount 1
            drawmatrix
();
        }

        if(
$readcount == 1){
            
$curframe $readcount;
            print ( 
$curval "\n" );
        }else{
            
addmatrix();
        }

        
$curval = `fgetword $file`;
        
$readcount++;
    }

    
fclose $file;
}

global 
proc addmatrix(){

    
int $count $readcount 1;
    
    
int $y 0;
    
    while(
$count 38){
        
$count -= 38;
        
$y++;
    }    
    
    
int $x $count;

    
$frame[$y][$x-1] = $curval;


I get loads of errors about things not being defined so I'm certain it's a scope issue.