Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #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 onActionServerSideafisvar1svar2 ) {
  switch( 
afi ) {
    case 
"callTextTypeFile": {
      
temp.text_type_file.loadLinessvar1 );
      
triggerClient"gui"name"displayTextTypeFile"temp.text_type_file );
      break;
    }
    case 
"editTextTypeFile": {
      
temp.text_type_file = { svar1 };
      
temp.text_type_file.saveLinessvar2);
      break;
    }
  }
}

//#CLIENTSIDE

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

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

function 
onEditTextTypeFilesvar ) {
  
Gui stuff hereremoved 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
  #2  
Old 03-04-2011, 03:50 AM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
Try the NL concat operator to create a new line:
PHP Code:
function onActionClientSide(paramlines) {
  switch (
param) {
    case 
"displayTextTypeFile":
      for (
temp.0temp.lines.size(); temp.i++) {
        
temp.ne @= "" NL lines[temp.i];
      }
      
onEditTextTypeFile(temp.ne);
    break;
  }

__________________
Reply With Quote
  #3  
Old 03-04-2011, 03:59 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
Eek, didn't work.

This is the outcome:
This is an attempt to\nFigure out\nIf this works

Same thing
Reply With Quote
  #4  
Old 03-04-2011, 04:14 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Here's some basic examples for the savestring and savelines functions.

PHP Code:
// Declare Filename
temp.filename "path/to/file.txt";
// Save Lines
temp.lines = {
  
"Line 0: Hello",
  
"Line 1: World!"
  "Line 2: How are you?"
};
temp.lines.savelines(temp.filename0);
// Save String
temp.str "Hello World!\n";
temp.str.savestring(temp.filename0);
// Append String to File
temp.str "Yeah!\n";
temp.str.savestring(temp.filename1);
// Append Lines to File
temp.lines.savelines(temp.filename1); 
__________________
Quote:
Reply With Quote
  #5  
Old 03-04-2011, 04:32 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
Quote:
Originally Posted by fowlplay4 View Post
Here's some basic examples for the savestring and savelines functions.

PHP Code:
// Declare Filename
temp.filename "path/to/file.txt";
// Save Lines
temp.lines = {
  
"Line 0: Hello",
  
"Line 1: World!"
  "Line 2: How are you?"
};
temp.lines.savelines(temp.filename0);
// Save String
temp.str "Hello World!\n";
temp.str.savestring(temp.filename0);
// Append String to File
temp.str "Yeah!\n";
temp.str.savestring(temp.filename1);
// Append Lines to File
temp.lines.savelines(temp.filename1); 
Yeah.. That's great and all, but there's still no solution to my original problem :s
My script loads a file from the server, displays it in a GUI, allows editing, but when it's saved, the new lines only show in the GUI and are not displayed in the original textfile, which could be a problem for things like guild text files, etc. If I could use the first thing shown (creating lines manually) I would, but that would destroy the use of the script all together.

I need to overwrite, not append the text files.

Lastly, what's being sent to the serverside part of the script to save the lines is the GUIs text.
Reply With Quote
  #6  
Old 03-04-2011, 05:07 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
I'll be willing to bet your issue is that you're viewing the file on Windows, which doesn't properly display \n as linebreaks. You need to use \r\n.
Reply With Quote
  #7  
Old 03-04-2011, 05:10 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
No dice. Outcome:
I\'m currently\r\ntrying to figure out\r\nhow the hell\r\nthis thing\r\nworks\r

I was also in the process of reading up on line breaks when this was posted... What a coincidence
Reply With Quote
  #8  
Old 03-04-2011, 05:13 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Oh. If you are actually storing the control sequences as letters, then you'll need to do a conversion before/after you save/load the file. Just replace \n with an actual line break, and vice versa.
Reply With Quote
  #9  
Old 03-04-2011, 05:15 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
That's my problem; figuring out how to do that xP
Reply With Quote
  #10  
Old 03-04-2011, 05:26 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
You can use shared.replacetext(string, search, replace) from http://forums.graalonline.com/forums...ad.php?t=81277.
Reply With Quote
  #11  
Old 03-04-2011, 05:39 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
Quote:
Originally Posted by WhiteDragon View Post
You can use shared.replacetext(string, search, replace) from http://forums.graalonline.com/forums...ad.php?t=81277.
And this would work inside of the text file?

EDIT: Tested, not sure what I should be replacing the saving part with instead of \n...
Reply With Quote
  #12  
Old 03-04-2011, 05:56 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Ah, I see your actual problem now.

If you use savelines and loadlines, it automatically converts actual line breaks to the string \n. If you use savestring and loadstring it won't do that.

So basically just use savestring and loadstring like in fp4's example and your problem should go away.
Reply With Quote
  #13  
Old 03-04-2011, 06:18 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
The only problem I have when doing that is loadstring(). It doesn't actually load the file, it just displays a 0 in the GUI

Last edited by devilsknite1; 03-04-2011 at 06:36 AM..
Reply With Quote
  #14  
Old 03-04-2011, 06:36 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Are you accessing the text via object.text or object.getlines()?

Your example seems to leave out the GUI part of your problem.
__________________
Quote:
Reply With Quote
  #15  
Old 03-04-2011, 06:39 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
object.text as it doesn't return in "","" form
Reply With Quote
  #16  
Old 03-04-2011, 06:43 AM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
My guess is that you are sending a string to the server, not the lines.
Perhaps something like this will work for you:
PHP Code:
function onActionServerSide(afisvar1svar2) {
  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.saveLines(svar20);
    break;
  }
}

//#CLIENTSIDE

function sendLinesToServer() {
  
temp.lines MyGuiMultiLineTextControl.getlines();
  
triggerServer("gui"name"editTextTypeFile"temp.lines"MyFile.txt");

__________________
Reply With Quote
  #17  
Old 03-04-2011, 06:49 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
Quote:
Originally Posted by 0PiX0 View Post
My guess is that you are sending a string to the server, not the lines.
Perhaps something like this will work for you:
PHP Code:
function onActionServerSide(afisvar1svar2) {
  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.saveLines(svar20);
    break;
  }
}

//#CLIENTSIDE

function sendLinesToServer() {
  
temp.lines MyGuiMultiLineTextControl.getlines();
  
triggerServer("gui"name"editTextTypeFile"temp.lines"MyFile.txt");

Tried this already and got this as an outcome:
JUST,WORK,ALREADY

instead of what I want, which should be
JUST
WORK
ALREADY

it's getting closer, I'm just not sure what it is, exactly X.X

By the way, the outcomes are what is displayed in the text file.
PHP Code:
Tried this already and got this as an outcome:
JUST,WORK,ALREADY 
This is the only example where both the text file and the GUI displayed the same thing, but neither of them were line breaks, which is the goal instead of the commas.
Reply With Quote
  #18  
Old 03-04-2011, 06:55 AM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
Quote:
Originally Posted by devilsknite1 View Post
Tried this already and got this as an outcome:
JUST,WORK,ALREADY

instead of what I want, which should be
JUST
WORK
ALREADY
The array of lines can be displayed back on the gui multiline text control like so:
PHP Code:
temp.lines = {"JUST","WORK","ALREADY"};
MyGuiMultiLineTextControl.setlines(temp.lines); 
__________________
Reply With Quote
  #19  
Old 03-04-2011, 06:59 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
I edited the post with that in mind, but again, that was in both, the file and the GUI. I want both, the text file and the GUI, to display a line break. I know the MultiLineEdit can do that, but the goal is to display the text file exactly and the text file needs line breaks in order to do so
Reply With Quote
  #20  
Old 03-04-2011, 07:09 AM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
perhaps load and save the string rather than the lines then.
PHP Code:
// Load and save strings, not lines
function onActionServerSide(afisvar1svar2) {
  switch (
afi) {
    case 
"callTextTypeFile":
      
temp.text_type_file.loadString(svar1);
      
triggerClient("gui"name"displayTextTypeFile"temp.text_type_file);
    break;
    case 
"editTextTypeFile":
      
temp.text_type_file.saveString(svar20);
    break;
  }
}

//#CLIENTSIDE

// Receive the entire text string and display it on the multiline text control
function onActionClientside(cmdparam) {
  switch (
cmd) {
    case 
"displayTextTypeFile":
      
MyGuiMultiLineTextControl.text param;
    break;
  }
}

// Send a string rather than lines
function sendStringToServer() {
  
temp.mytext MyGuiMultiLineTextControl.text;
  
triggerServer("gui"name"editTextTypeFile"temp.mytext"MyFile.txt");

__________________
Reply With Quote
  #21  
Old 03-04-2011, 07:14 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
This works, except the GUI doesn't display line breaks lol
Reply With Quote
  #22  
Old 03-04-2011, 07:15 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
This works just fine, the file will look messed up (all on one line) in regular Windows Notepad (Terriblepad) instead use Wordpad or Notepad++

PHP Code:
function onActionServerSide() {
  
temp.filename "cartridge/test.txt";
  if (
params[0] == "load") {
    
temp.lines.loadlines(temp.filename);
    
player.triggerclient(this.name"load"temp.lines);
  }
  else if (
params[0] == "save") {
    
params[1].savelines(temp.filename0);
  }
}

//#CLIENTSIDE

function onActionClientSide() {
  if (
params[0] == "load") {
    
TestWindowML.setlines(params[1]);
  }
}

function 
onCreated() {
  new 
GuiWindowCtrl("TestWindow") {
    
100;
    
100;
    
width 300;
    
height 300;
    new 
GuiScrollCtrl("TestWindowScroll") {
      
4;
      
20;
      
width 296;
      
height 280;
      new 
GuiMLTextEditCtrl("TestWindowML") {
        
2;
        
width 280;
        
height 280;
      }
    }
  }
  
triggerserver("gui"name"load");
}

function 
ChatBar.onAction() {
  if (
ChatBar.text == "/save") {
    
temp.lines TestWindowML.getlines();
    
triggerserver("gui"this.name"save"temp.lines);
    
ChatBar.text "";
  }

Attached Files
File Type: txt test.txt (36 Bytes, 242 views)
__________________
Quote:
Reply With Quote
  #23  
Old 03-04-2011, 07:19 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
SO is there really no way to display line breaks in the GUI even though it's in the file itself?
Reply With Quote
  #24  
Old 03-04-2011, 07:23 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by devilsknite1 View Post
SO is there really no way to display line breaks in the GUI even though it's in the file itself?
Line breaks aren't supposed to be visible in character form, if that's what you're trying to do. Normal HTML rendering converts them to a space.

If you want them to you have to escape them...

PHP Code:
for (temp.linetemp.lines) {
  
temp.line @= "\\n"// Puts \n at the end of each line.
}
object.setlines(temp.lines); 
I can't possibly imagine why you would want to do that though.
__________________
Quote:
Reply With Quote
  #25  
Old 03-04-2011, 07:27 AM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
Quote:
Originally Posted by devilsknite1 View Post
SO is there really no way to display line breaks in the GUI even though it's in the file itself?
Try loading lines, since the GuiMLTextControl's lines can be set with object.setlines()

Save the string, since that worked before.

Could work...
PHP Code:
// Load lines, save strings
function onActionServerSide(afisvar1svar2) { 
  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.saveString(svar20); 
    break; 
  } 


//#CLIENTSIDE 

// Receive the lines and display on gui
function onActionClientside(cmdparam) { 
  switch (
cmd) { 
    case 
"displayTextTypeFile"
      
MyGuiMultiLineTextControl.setlines(param);  
    break; 
  } 


// Send a string rather than lines 
function sendStringToServer() { 
  
temp.mytext MyGuiMultiLineTextControl.text
  
triggerServer("gui"name"editTextTypeFile"temp.mytext"MyFile.txt"); 

__________________
Reply With Quote
  #26  
Old 03-04-2011, 07:35 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
Ah, I've figured it out.

Maybe this could clarify some?

Here is the completed code:

PHP Code:
function onActionServerSideafisvar1svar2 ) {
  switch( 
afi ) {
    case 
"receiveTextTypeFile": {
      
temp.name_of_text svar1;
      
temp.text_type_file.loadLinessvar1 );
      
triggerClient"gui"name"getTextTypeFile"temp.text_type_filetemp.name_of_text );
      break;
    }
    case 
"editTextTypeFile": {
      
svar1.saveLinessvar2);
      break;
    }
  }
}

//#CLIENTSIDE

function onActionClientSideafifilebvar ) {
  switch( 
afi ) {
    case 
"getTextTypeFile": {
      
onEditTextTypeFilebvar );
      
TFE_MultiLineEdit1.setLinesfile );
      break;
    }
  }
}

function 
onCreated() {
  if ( 
TFE_Window1.visible ) {
    
TFE_Window1.destroy();
  }
  
this.file_selected NULL;
}

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

function 
onEditTextTypeFilesvar ) {
  new 
GuiWindowCtrl"TFE_Window1" ) {
    
profile GuiBlueWindowProfile;
    
clientRelative true;
    
clientExtent "581,416";
    
canClose false;
    
canMaximize false;
    
canMove true;
    
canResize false;
    
closeQuery false;
    
destroyOnHide false;
    
text "Loaded file: '" svar "'. Editing in progress.";
    
screenwidth - ( width );
    
screenheight - ( height );

    new 
GuiScrollCtrl"TFE_MultiLineEdit1_Scroll" ) {
      
profile GuiBlueScrollProfile;
      
height 369;
      
hScrollBar "dynamic";
      
vScrollBar "dynamic";
      
width 581;

      new 
GuiMLTextEditCtrl"TFE_MultiLineEdit1" ) {
        
profile GuiBlueMLTextEditProfile;
        
height 16;
        
horizSizing "width";
        
wordWrap false;
        
width 556;
      }
    }
    
    new 
GuiButtonCtrl"TFE_Button1" ) {
      
profile GuiBlueButtonProfile;
      
height 45;
      
text "Save";
      
width 67;
      
371;
    }
    
    new 
GuiButtonCtrl"TFE_Button2" ) {
      
profile GuiBlueButtonProfile;
      
height 45;
      
text "Clear all";
      
width 67;
      
257;
      
371;
    }
    
    new 
GuiButtonCtrl"TFE_Button3" ) {
      
profile GuiBlueButtonProfile;
      
height 45;
      
text "Cancel";
      
width 67;
      
514;
      
371;
    }
  }
}

function 
TFE_Button1.onAction() {
  if ( 
this.file_selected != NULL ) {
    
triggerServer"gui"name"editTextTypeFile"TFE_MultiLineEdit1.getLines(), this.file_selected );
    
TFE_Window1.destroy();
    
player.chat "Saved!";
  } else {
    
player.chat "Error with this.file_selected";
  }
}

function 
TFE_Button2.onAction() {
  
player.chat "Clearing...";
  
TFE_MultiLineEdit1.text "";
}

function 
TFE_Button3.onAction() {
  
TFE_Window1.destroy();


Last edited by devilsknite1; 03-04-2011 at 11:04 PM..
Reply With Quote
  #27  
Old 03-04-2011, 07:40 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
You're using getlines and setlines properly throughout and keeping it in it's line form.

Try using:

PHP Code:
svar1.saveLinessvar2); 
Instead of duplicating your array temporarily.
__________________
Quote:
Reply With Quote
  #28  
Old 03-04-2011, 07:46 AM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
Quote:
Originally Posted by devilsknite1 View Post
temp.text_type_file @= svar1;
You are appending a NULL variable with an array of strings?
What is the purpose of this line of code?
__________________
Reply With Quote
  #29  
Old 03-04-2011, 03:58 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Using lines is probably the best in v5.
In v6 we have added a new attribute GuiMLTextCtrl.plaintext which will give you the plain text without escapes.
Reply With Quote
  #30  
Old 03-04-2011, 10:59 PM
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
Quote:
Originally Posted by Stefan View Post
Using lines is probably the best in v5.
In v6 we have added a new attribute GuiMLTextCtrl.plaintext which will give you the plain text without escapes.
About time lol

And for Pix and fowlplay, I accidentally left that in there from previous attempts on bsing my way through savestring() and savelines()... I've edited it and used fowlplay's way as there's no reason for a temporary save there.
Thank you all for your help
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:01 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.