• a huge favor [MPL]

    From fang-castro@21:3/112 to All on Wed Oct 27 09:03:51 2021
    would someone give me a MPL line that simply writes a line of text to a .txt file? i.e. 'fang-castro is so lazy' > welcome.txt

    will it need a

    Uses
    ANYTHING;

    ?

    |08__ _ _ ____ |02_ _ |10___ _ _ |02____ |08_ _ _ ___
    |08| \| | |__\ |02|--| |10 | \/ |02|--| |08|__| |___ |

    --- Mystic BBS v1.12 A46 2020/08/26 (Linux/64)
    * Origin: ._.-. nightvault.fsxnet.nz port 2323 .-._. (21:3/112)
  • From paulie420@21:2/150 to fang-castro on Wed Oct 27 15:35:00 2021
    would someone give me a MPL line that simply writes a line of text to a .txt file? i.e. 'fang-castro is so lazy' > welcome.txt

    I suggest you grab Black Panthers MPL lessons; they are available on 2o in the RCS Mystic Mods File Area...

    If I remember correctly, file handling starts as Lesson 9 and is covered in the next 3 Lessons after that. He explains how to write to filename.txt first, and then goes on to show both reading, writing and handling text and binary files.

    If I remember correctly, you have to OPEN, WRITE and CLOSE a file using:

    fAssign
    fWrite
    fClose

    There is a format in paranthesis after the commands, and while you're just asking to write ONE thing to a text, you can use variables so a user can give input, or you can pull data to write from... anywhere.

    If you want to really understand file handling, I really suggest those 3 Lessons by BP.



    |07p|15AULIE|1142|07o
    |08.........

    --- Mystic BBS v1.12 A47 2021/08/29 (Raspberry Pi/32)
    * Origin: 2o fOr beeRS bbs>>>20ForBeers.com:1337 (21:2/150)
  • From fang-castro@21:3/112 to paulie420 on Wed Oct 27 16:54:45 2021
    On 27 Oct 2021, paulie420 said the following...
    would someone give me a MPL line that simply writes a line of text to .txt file? i.e. 'fang-castro is so lazy' > welcome.txt
    I suggest you grab Black Panthers MPL lessons; they are available on 2o
    in the RCS Mystic Mods File Area...
    If I remember correctly, file handling starts as Lesson 9 and is covered in the next 3 Lessons after that. He explains how to write to
    filename.txt first, and then goes on to show both reading, writing and handling text and binary files.

    perfect! i UL'd the 20 for Beers color ascii while I was there...

    |08__ _ _ ____ |02_ _ |10___ _ _ |02____ |08_ _ _ ___
    |08| \| | |__\ |02|--| |10 | \/ |02|--| |08|__| |___ |

    --- Mystic BBS v1.12 A46 2020/08/26 (Linux/64)
    * Origin: ._.-. nightvault.fsxnet.nz port 2323 .-._. (21:3/112)
  • From Black Panther@21:1/186 to fang-castro on Wed Oct 27 18:44:36 2021
    Hello fang-castro!

    27 Oct 21 09:03, you wrote to All:

    would someone give me a MPL line that simply writes a line of text to
    a .txt file? i.e. 'fang-castro is so lazy' > welcome.txt

    will it need a

    Uses
    ANYTHING;

    Var
    fptr : File
    Begin
    fAssign(fptr,'welcome.txt)
    fReWrite(fptr) //will recreate the file each time it's run
    WriteLn(fptr,'fang-castro is so lazy')
    fClose(fptr)
    End

    If you have an existing file you'd like to edit, you could use reset(fptr) which will just open that file. You could also use append(fptr), which would append the line to the end of the current file.

    Hope this helps. :)


    Black Panther

    ... "Hey! Like I said! Privacy!" - Ivanova
    --- GoldED+/LNX 1.1.5-b20180707
    * Origin: Exploring other frontiers! (21:1/186)
  • From Black Panther@21:1/186 to paulie420 on Wed Oct 27 18:49:14 2021
    Hello paulie420!

    27 Oct 21 15:35, you wrote to fang-castro:

    would someone give me a MPL line that simply writes a line of
    text to a .txt file? i.e. 'fang-castro is so lazy' > welcome.txt

    I suggest you grab Black Panthers MPL lessons; they are available on
    2o in the RCS Mystic Mods File Area...

    I should probably rewrite those, so they don't sound like they are just taking jabs at you. ;) I know how much you loved trying to work with files. :)

    If I remember correctly, you have to OPEN, WRITE and CLOSE a file
    using:

    fAssign
    This will assign the filename to the pointer variable. After this, you need to actually open the file using fReWrite, fReset, Append, etc.
    fWrite
    This writes the information to the file. You can also just use WriteLn or Write, with the file pointer variable. ie WriteLn(fptr,'This is some text')
    fClose
    Always want to close the file when your done with it. :)


    Black Panther

    ... Super-dooper party pooper trooper!
    --- GoldED+/LNX 1.1.5-b20180707
    * Origin: Exploring other frontiers! (21:1/186)
  • From fang-castro@21:3/112 to Black Panther on Thu Oct 28 09:05:53 2021
    fAssign(fptr,'welcome.txt)

    OOoooooooooooOooo! ;)

    thanks a million!!

    |08__ _ _ ____ |02_ _ |10___ _ _ |02____ |08_ _ _ ___
    |08| \| | |__\ |02|--| |10 | \/ |02|--| |08|__| |___ |

    --- Mystic BBS v1.12 A46 2020/08/26 (Linux/64)
    * Origin: ._.-. nightvault.fsxnet.nz port 2323 .-._. (21:3/112)
  • From MeaTLoTioN@21:1/158 to fang-castro on Thu Oct 28 16:21:26 2021
    On 27 Oct 2021, fang-castro said the following...

    would someone give me a MPL line that simply writes a line of text to a .txt file? i.e. 'fang-castro is so lazy' > welcome.txt

    You don't need MPL for that, just do a menu option like

    Command | (DD) External application
    Data | echo "fang-castro is so lazy" > welcome.txt

    Job done.

    ---
    |14Best regards,
    |11Ch|03rist|11ia|15n |11a|03ka |11Me|03aTLoT|11io|15N

    |07── |08[|10eml|08] |15ml@erb.pw |07── |08[|10web|08] |15www.erb.pw |07───┐ |07── |08[|09fsx|08] |1521:1/158 |07── |08[|11tqw|08] |151337:1/101 |07┬──┘ |07── |08[|12rtn|08] |1580:774/81 |07─┬ |08[|14fdn|08] |152:250/5 |07───┘
    |07── |08[|10ark|08] |1510:104/2 |07─┘

    ... A Meteor is an example of a rock star.

    --- Mystic BBS v1.12 A47 2021/08/10 (Linux/64)
    * Origin: thE qUAntUm wOrmhOlE, rAmsgAtE, uK. bbs.erb.pw (21:1/158)
  • From fang-castro@21:3/112 to MeaTLoTioN on Thu Oct 28 09:55:53 2021
    On 28 Oct 2021, MeaTLoTioN said the following...
    On 27 Oct 2021, fang-castro said the following...
    would someone give me a MPL line that simply writes a line of text to .txt file? i.e. 'fang-castro is so lazy' > welcome.txt
    You don't need MPL for that, just do a menu option like
    Command | (DD) External application
    Data | echo "fang-castro is so lazy" > welcome.txt
    Job done.

    This is true! I could even make a shell script to delete the old welcome.txt before writing a new one. Or insert another (DD) command. Part of the fun is all the different ways to do stuff! My goal is to learn/practice MPL and I imagine there will be a lot of file touching =) Thanks for the advice tho!

    |08__ _ _ ____ |02_ _ |10___ _ _ |02____ |08_ _ _ ___
    |08| \| | |__\ |02|--| |10 | \/ |02|--| |08|__| |___ |

    --- Mystic BBS v1.12 A46 2020/08/26 (Linux/64)
    * Origin: ._.-. nightvault.fsxnet.nz port 2323 .-._. (21:3/112)
  • From paulie420@21:2/150 to fang-castro on Thu Oct 28 09:41:00 2021
    perfect! i UL'd the 20 for Beers color ascii while I was there...

    Thank you, again. I've started using your ASCII as an advert on socials. I totally dig it!



    |07p|15AULIE|1142|07o
    |08.........

    --- Mystic BBS v1.12 A47 2021/08/29 (Raspberry Pi/32)
    * Origin: 2o fOr beeRS bbs>>>20ForBeers.com:1337 (21:2/150)
  • From paulie420@21:2/150 to Black Panther on Thu Oct 28 09:44:44 2021
    If I remember correctly, you have to OPEN, WRITE and CLOSE a file using:

    fAssign
    This will assign the filename to the pointer variable. After this, you need to actually open the file using fReWrite, fReset, Append, etc.
    fWrite
    This writes the information to the file. You can also just use WriteLn or Write, with the file pointer variable. ie WriteLn(fptr,'This is some
    fClose
    text') Always want to close the file when your done with it. :)

    Black Panther

    Ahhh, master - I missed fReset - or ReWrite/Append... :P

    I'll have you know that I *am* writing simple text to files these days... and don't mind the [small,fun] jabs that are in your lessons... they REALLY gave me a better understanding of MPL and writing real-w0rld mods for my system.

    Since, [and while we were still at it, even] I've had a lot of success using actual Pascal documentation - for larger questions, I can usually get from point A to point B with a little bit of wiggling around by using FP docs.



    |07p|15AULIE|1142|07o
    |08.........

    --- Mystic BBS v1.12 A47 2021/08/29 (Raspberry Pi/32)
    * Origin: 2o fOr beeRS bbs>>>20ForBeers.com:1337 (21:2/150)
  • From xqtr@21:1/111 to fang-castro on Thu Oct 28 18:12:41 2021
    would someone give me a MPL line that simply writes a line of text to a .t file? i.e. 'fang-castro is so lazy' > welcome.txt

    There is also a read to use command in MPL, called AppendText(). ;)

    AppendText (FileName, Text: String)
    This procedure will append a single line of text onto a text file. If the
    file does not exist, it will be created. Example:
    AppendText("c:\test.txt', 'This is a line of text added to test.txt!')

    .
    :: XQTR :: Another Droid BBS :: andr01d.zapto.org:9999 :: xqtr@gmx.com

    --- Mystic BBS v1.12 A47 2020/11/23 (Raspberry Pi/32)
    * Origin: Another Droid BBS # andr01d.zapto.org:9999 (21:1/111)
  • From MeaTLoTioN@21:1/158 to fang-castro on Thu Oct 28 17:25:30 2021
    This is true! I could even make a shell script to delete the old welcome.txt before writing a new one. Or insert another (DD) command.

    You wouldn't need to delete the old file, as the redirection `>` is to replace, not append, so by definition you'll be creating a new file each time.

    ---
    |14Best regards,
    |11Ch|03rist|11ia|15n |11a|03ka |11Me|03aTLoT|11io|15N

    |07── |08[|10eml|08] |15ml@erb.pw |07── |08[|10web|08] |15www.erb.pw |07───┐ |07── |08[|09fsx|08] |1521:1/158 |07── |08[|11tqw|08] |151337:1/101 |07┬──┘ |07── |08[|12rtn|08] |1580:774/81 |07─┬ |08[|14fdn|08] |152:250/5 |07───┘
    |07── |08[|10ark|08] |1510:104/2 |07─┘

    ... Message encrypted: Press ALT-F4 to read encoded message

    --- Mystic BBS v1.12 A47 2021/08/10 (Linux/64)
    * Origin: thE qUAntUm wOrmhOlE, rAmsgAtE, uK. bbs.erb.pw (21:1/158)
  • From MeaTLoTioN@21:1/158 to fang-castro on Thu Oct 28 17:26:29 2021
    On 28 Oct 2021, MeaTLoTioN said the following...

    This is true! I could even make a shell script to delete the old welcome.txt before writing a new one. Or insert another (DD) command.

    You wouldn't need to delete the old file, as the redirection `>` is to replace, not append, so by definition you'll be creating a new file each time.

    I forgot to add that if you use the redirection `>>` (double >) then that is what makes it append.

    ---
    |14Best regards,
    |11Ch|03rist|11ia|15n |11a|03ka |11Me|03aTLoT|11io|15N

    |07── |08[|10eml|08] |15ml@erb.pw |07── |08[|10web|08] |15www.erb.pw |07───┐ |07── |08[|09fsx|08] |1521:1/158 |07── |08[|11tqw|08] |151337:1/101 |07┬──┘ |07── |08[|12rtn|08] |1580:774/81 |07─┬ |08[|14fdn|08] |152:250/5 |07───┘
    |07── |08[|10ark|08] |1510:104/2 |07─┘

    ... I know a good tagline when I steal one!

    --- Mystic BBS v1.12 A47 2021/08/10 (Linux/64)
    * Origin: thE qUAntUm wOrmhOlE, rAmsgAtE, uK. bbs.erb.pw (21:1/158)
  • From fang-castro@21:3/112 to xqtr on Thu Oct 28 13:29:03 2021
    On 28 Oct 2021, xqtr said the following...
    There is also a read to use command in MPL, called AppendText(). ;)

    Thanks! Everyone has been extremely helpful!

    |08__ _ _ ____ |02_ _ |10___ _ _ |02____ |08_ _ _ ___
    |08| \| | |__\ |02|--| |10 | \/ |02|--| |08|__| |___ |

    --- Mystic BBS v1.12 A46 2020/08/26 (Linux/64)
    * Origin: ._.-. nightvault.fsxnet.nz port 2323 .-._. (21:3/112)
  • From fang-castro@21:3/112 to MeaTLoTioN on Thu Oct 28 13:30:11 2021
    On 28 Oct 2021, MeaTLoTioN said the following...

    This is true! I could even make a shell script to delete the old welcome.txt before writing a new one. Or insert another (DD) command.

    You wouldn't need to delete the old file, as the redirection `>` is to replace,

    sometimes i smoke too much weed |02_\|/_ |7 thanks!

    |08__ _ _ ____ |02_ _ |10___ _ _ |02____ |08_ _ _ ___
    |08| \| | |__\ |02|--| |10 | \/ |02|--| |08|__| |___ |

    --- Mystic BBS v1.12 A46 2020/08/26 (Linux/64)
    * Origin: ._.-. nightvault.fsxnet.nz port 2323 .-._. (21:3/112)
  • From paulie420@21:2/150 to MeaTLoTioN on Thu Oct 28 12:29:24 2021
    You wouldn't need to delete the old file, as the redirection `>` is to replace, not append, so by definition you'll be creating a new file each time.


    Or, one could use ">>" to append; if I remember correctly.



    |07p|15AULIE|1142|07o
    |08.........

    --- Mystic BBS v1.12 A47 2021/10/25 (Raspberry Pi/32)
    * Origin: 2o fOr beeRS bbs>>>20ForBeers.com:1337 (21:2/150)
  • From fang-castro@21:3/112 to Black Panther on Fri Oct 29 13:37:26 2021
    Var
    fptr : File
    Begin
    fAssign(fptr,'welcome.txt)
    fReWrite(fptr) //will recreate the file each time it's run
    WriteLn(fptr,'fang-castro is so lazy')
    fClose(fptr)
    End

    I had to modify above to below for it work... Keeping me on my toes.

    Var
    fptr : File
    Begin
    fAssign(fptr,'welcome.txt',66)
    fReWrite(fptr) //will recreate the file each time it's run
    fWriteLn(fptr,'fang-castro is so lazy')
    fClose(fptr)
    End

    // If you have an existing file you'd like to edit, you could use reset(fptr) // which will just open that file. You could also use append(fptr), which would // append the line to the end of the current file.

    |08__ _ _ ____ |02_ _ |10___ _ _ |02____ |08_ _ _ ___
    |08| \| | |__\ |02|--| |10 | \/ |02|--| |08|__| |___ |

    --- Mystic BBS v1.12 A46 2020/08/26 (Linux/64)
    * Origin: ._.-. nightvault.fsxnet.nz port 2323 .-._. (21:3/112)
  • From Black Panther@21:1/186 to fang-castro on Fri Oct 29 15:04:28 2021
    Hello fang-castro!

    29 Oct 21 13:37, you wrote to me:

    Var
    fptr : File
    Begin
    fAssign(fptr,'welcome.txt)
    fReWrite(fptr) //will recreate the file each time
    it's run
    WriteLn(fptr,'fang-castro is so lazy')
    fClose(fptr)
    End

    I had to modify above to below for it work... Keeping me on my toes.

    Var
    fptr : File
    Begin
    fAssign(fptr,'welcome.txt',66)
    fReWrite(fptr) //will recreate the file each time it's run
    fWriteLn(fptr,'fang-castro is so lazy')
    fClose(fptr)
    End

    Ah, sorry about that. I've been spending time working in FreePascal lately. ;)


    Black Panther

    ... Forrest Gump: Stupid am as stoopid doo
    --- GoldED+/LNX 1.1.5-b20180707
    * Origin: Exploring other frontiers! (21:1/186)
  • From fang-castro@21:3/112 to Black Panther on Fri Oct 29 19:31:20 2021
    On 29 Oct 2021, Black Panther said the following...

    I had to modify above to below for it work... Keeping me on my toes.

    Ah, sorry about that. I've been spending time working in FreePascal lately. ;)

    I literally thought it was a test. ;)

    |08__ _ _ ____ |02_ _ |10___ _ _ |02____ |08_ _ _ ___
    |08| \| | |__\ |02|--| |10 | \/ |02|--| |08|__| |___ |

    --- Mystic BBS v1.12 A46 2020/08/26 (Linux/64)
    * Origin: ._.-. nightvault.fsxnet.nz port 2323 .-._. (21:3/112)