View Single Post
  #1  
Old 03-04-2011, 03:24 AM
devilsknite1 devilsknite1 is offline
C:
devilsknite1's Avatar
Join Date: Jul 2006
Location: Florida, USA
Posts: 269
devilsknite1 has a spectacular aura about
Send a message via AIM to devilsknite1 Send a message via MSN to devilsknite1 Send a message via Yahoo to devilsknite1
savelines() new line in file?

PHP Code:
function onActionServerSide( afi, svar1, svar2 ) {
  switch( 
afi ) {
    case 
"callTextTypeFile": {
      
temp.text_type_file.loadLines( svar1 );
      
triggerClient( "gui", name, "displayTextTypeFile", temp.text_type_file );
      break;
    }
    case 
"editTextTypeFile": {
      
temp.text_type_file = { svar1 };
      
temp.text_type_file.saveLines( svar2, 0 );
      break;
    }
  }
}

//#CLIENTSIDE

function onActionClientSide( afi, file ) {
  switch( 
afi ) {
    case 
"displayTextTypeFile": {
      for ( 
temp.i : file ) {
        
temp.ne @= temp.i @ "\n"; <-- This is the problem
      
}
      
onEditTextTypeFile( temp.ne );
      break;
    }
  }
}

function 
onPlayerChats() {
  
temp.tokens = player.chat.tokenize();
  if ( 
player.chat.starts( "/lf " ) ) {
    
this.file_selected = temp.tokens[ 1 ];
    
triggerServer( "gui", name, "callTextTypeFile", temp.tokens[ 1 ] );
  }
}

function 
onEditTextTypeFile( svar ) {
  
Gui stuff here, removed for space reasons
} 
The problem is not in the GUI or loading the text file, it's the text file itself. \n obviously won't make a new line in the text file, but it will the GUI. How would I go about making a new line, in both, the text file and the GUI?
Reply With Quote