+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: How to change line when making Files with Expression2

  1. #1
    Wire Noob Gascan's Avatar
    Join Date
    Nov 2009
    Location
    Denmark
    Posts
    27

    Question How to change line when making Files with Expression2

    Hi there I've been trying out the file functions in expression 2 and i wanted to know how to change lines. right now I've been using fileAppend(S,S) but that just made it write all the information in one line. I've been looking on the site, but i couldn't find anything :S Please help.
    Thank you
    Last edited by Gascan; 02-05-2010 at 04:23 PM.
    Rated G for Gascan.

    Lady Luck brings added income today. Lady friend takes it away tonight.

  2. #2
    Spucatum Tauri Bull's Avatar
    Join Date
    Jun 2008
    Location
    Finland
    Posts
    6,010

    Default Re: How to change line when making Files with Expression2

    I don't know if these all work, newline should work at least.

    \a bell
    \b back space
    \f form feed
    \n newline
    \r carriage return
    \t horizontal tab
    \v vertical tab
    \\ backslash
    \" double quote
    \' single quote
    \[ left square bracket
    \] right square bracket

    Edit to be clear:
    "HP\nSauce" makes

    HP
    Sauce
    My signature has a point.
    Quote Originally Posted by Squeakyneb View Post
    when l3ulletje says do it, do it.
    That

    Quote Originally Posted by Anticept View Post
    By the way, Bull is in charge.

  3. #3
    Wire Noob Gascan's Avatar
    Join Date
    Nov 2009
    Location
    Denmark
    Posts
    27

    Default Re: How to change line when making Files with Expression2

    I'll go ahead and try them out, Thanks a bunch.

    EDIT: Just tried them and they work =D thanks again
    Rated G for Gascan.

    Lady Luck brings added income today. Lady friend takes it away tonight.

  4. #4
    Wirererer Timomo's Avatar
    Join Date
    Jul 2009
    Location
    toCity( owner():pos() )
    Posts
    107

    Default Re: How to change line when making Files with Expression2

    ah cool i didnt known that

    there is now just one question how can i read a specific line from the .txt file??

  5. #5
    billywitchdoctor.com Schilcote's Avatar
    Join Date
    Jan 2009
    Location
    There.
    Posts
    2,006

    Default Re: How to change line when making Files with Expression2

    Quote Originally Posted by Timomo View Post
    there is now just one question how can i read a specific line from the .txt file??
    You use an index. Say you wrote this to your file:

    Code:
    1|Pie /n
    2|Cake /n
    3|Hamburgers /n
    and you wanted "Cake", you would simply read until you hit "2|", read until you hit toChar("13").


    [19:16:47]Client "rcdraco" spawned in server
    [19:17:10]rcdraco: hamburgertime
    [19:18:04]rcdraco was killed by worldspawn
    [19:21:50]Dropped "rcdraco" from server

  6. #6
    Mario, hard at work Filipe's Avatar
    Join Date
    Jun 2007
    Location
    Portugal - Lisbon
    Posts
    401
    Blog Entries
    1

    Default Re: How to change line when making Files with Expression2

    I never actually tried it, but if you use newline, you should be able to use Lines = fileRead(File):explode(toChar(13)).
    beep boop

  7. #7
    Wirererer Timomo's Avatar
    Join Date
    Jul 2009
    Location
    toCity( owner():pos() )
    Posts
    107

    Default Re: How to change line when making Files with Expression2

    err...i dont understand exactly what you telling me.. i know it uses a index (line1,line2,line3,.....)

    my code should look like this:

    Code:
    String = fileRead("testfile.txt") # only want to read line 2 of the testfile.txt

  8. #8
    Wirererer Timomo's Avatar
    Join Date
    Jul 2009
    Location
    toCity( owner():pos() )
    Posts
    107

    Default Re: How to change line when making Files with Expression2

    ok... i think for this we need a new function.. like

    Code:
    StringLine = fileRead(filename, line)

  9. #9
    billywitchdoctor.com Whosdr's Avatar
    Join Date
    Dec 2008
    Posts
    2,300

    Default Re: How to change line when making Files with Expression2

    Nah.
    I think you can read a file, and use File:explode("\n").
    First line would be File:explode("\n")[1,string]
    .siht daer ot gniyrt emit detsaw ev'uoY

  10. #10
    Wirererer Timomo's Avatar
    Join Date
    Jul 2009
    Location
    toCity( owner():pos() )
    Posts
    107

    Default Re: How to change line when making Files with Expression2

    ah ok it works thanks alot!

    there you got your

+ Reply to Thread
Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots