• [MPL] Tutorials

    From fang-castro@21:1/158 to All on Tue Dec 7 19:49:35 2021

    I'm going through Black Panther's MPL tutorials and just wondering if some of this stuff is keeping people from trying to learn MPL. My guess is MPL has changed since the tutorials were written. I kind of enjoy the subtle 'bugs' I run into and don't get me wrong, I'm not knocking BP - thank you for the tutorials! Here's what I was able to figure out on this first lession.

    The USES command needs to preceed each "uses".
    The "Byte" vartype doesn't work with "Input(#,#,#,'')" I was getting type mismatch errors with the compiler. I just changed it to string for now instead of trying to figure out how "Byte" works.

    The first snippet is the original code from Tutorial 1 and the second snippet is what I changed it to so it would compile.

    I guess the point of this is to spark a little MPL discussion in the echos
    and act as a warning to everyone that I will probably be asking a lot about
    MPL in the future. =)

    ---8<-------------------------------------------------------------------------

    Uses
    User
    CFG

    Var
    Age : Byte
    Name : String[20]
    Begin
    WriteLn('What is your name?')
    Name:=Input(20,20,3,'')
    WriteLn('Hi '+Name+'! How old are you?')
    Age:=Input(2,2,10,'')
    WriteLn(Name+' are you really only '+Age+' years old?')
    End

    ---8<-------------------------------------------------------------------------

    Uses User
    Uses CFG

    Var
    Age : String[2]
    Name : String[20]
    Begin
    WriteLn('What is your name?')
    Name:=Input(20,20,3,'')
    WriteLn('Hi '+Name+'! How old are you?')
    Age:=Input(2,2,10,'')
    WriteLn(Name+' are you really only '+Age+' years old?')
    End

    ---8<-------------------------------------------------------------------------

    Thanks to: Black Panther, XQTR and Phenom Productions for all the MPL related texts/mods I've acquired to help me with my MPL edjumakayshun!

    --- Mystic BBS v1.12 A47 2021/08/10 (Linux/64)
    * Origin: thE qUAntUm wOrmhOlE, rAmsgAtE, uK. bbs.erb.pw (21:1/158)
  • From Black Panther@21:1/186 to fang-castro on Tue Dec 7 13:09:18 2021
    On 07 Dec 2021, 07:49p, fang-castro said the following...

    I'm going through Black Panther's MPL tutorials and just wondering if
    some of this stuff is keeping people from trying to learn MPL. My guess

    Thanks for taking a look at those. They have been fun to write as well. :)

    is MPL has changed since the tutorials were written. I kind of enjoy the subtle 'bugs' I run into and don't get me wrong, I'm not knocking BP - thank you for the tutorials! Here's what I was able to figure out on
    this first lession.

    These were written within the last 6 months or so. There have been some minor changes.

    The USES command needs to preceed each "uses".

    Not necessarily.

    Uses
    Cfg,
    User

    ... is just as valid as

    Uses Cfg
    Uses User

    Each of the uses must be separated by a comma.

    The "Byte" vartype doesn't work with "Input(#,#,#,'')" I was getting type mismatch errors with the compiler. I just changed it to string for now instead of trying to figure out how "Byte" works.

    Input will only take a string from the user. Once the input is obtained, it can be typecast to a different variable type. So, if you have something like:

    Var
    UserInput : String;
    UserByte : Byte;

    Begin
    UserInput:=Input(2,2,10,'');
    UserByte:=Str2Int(UserInput);
    End

    You can do something like this to change it to a byte. Be careful though if you are using Input which would accept all characters, such as input type 1. If you try to change an string to any integer type variable, and it contains non-numeric characters, it will crash. I usually put in some type of check function in the program, to determine if it contains all numeric, before attempting the Str2Int.

    The first snippet is the original code from Tutorial 1 and the second snippet is what I changed it to so it would compile.

    Did I have that in the first tutorial? I'll have to take a look at what I wrote... Oh crap... Sorry about that... Yes, the Age variable would need to be a string in that example... Another way of doing it would be:

    Uses
    User,
    CFG

    Var
    Age : Byte
    Name : String[20]
    Begin
    WriteLn('What is your name?')
    Name:=Input(20,20,3,'')
    WriteLn('Hi '+Name+'! How old are you?')
    Age:=Str2Int(Input(2,2,10,''))
    WriteLn(Name+' are you really only '+Int2Str(Age)+' years old?')
    End

    This is untested, but it should work.

    I guess I should go back and proofread what I wrote in those tutorials... ;)


    ---

    Black Panther(RCS)
    aka Dan Richter
    Castle Rock BBS
    telnet://bbs.castlerockbbs.com
    http://www.castlerockbbs.com
    http://github.com/DRPanther
    The sparrows are flying again...

    ... They say there's always one weirdo on the bus, but I couldn't find them!

    --- Mystic BBS v1.12 A47 2021/09/07 (Linux/64)
    * Origin: Castle Rock BBS - bbs.castlerockbbs.com (21:1/186)
  • From paulie420@21:2/150 to Black Panther on Tue Dec 7 14:37:45 2021
    These were written within the last 6 months or so. There have been some minor changes.

    As BP would remind me, syntax syntax syntax...
    The USES command needs to preceed each "uses".
    Not necessarily.

    Uses
    Cfg,
    User

    ... is just as valid as

    Uses Cfg
    Uses User
    Each of the uses must be separated by a comma.

    Give the code what it needs and it'll happily fire away.

    I guess I should go back and proofread what I wrote in those
    tutorials... ;)

    Oh, I think yer OK, BP... part of learning MPL, for me, was looking at many different authors code and SEEING how to do things better/smarter - I never had issue w/ your instruction, but I do remember typing:

    Uses cfg
    Uses user

    until, later, seeing the comma syntax. Its frustrating, sometimes, howe one little character can hem up yer whole project... I remember a time when one extra <CR> at the eof of an MPS screwed the whole thing up...

    Give the computer what it needs, and it'll run... yer instructions helped me much more than anything else; but don't be afraid to have the regular MPL docs pulled up, and doublecheck syntax's between the two.



    |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)