• Reading the optional fields in MPL

    From Kim Ahmad@1:396/4 to All on Monday, July 25, 2022 22:25:36
    From: Kim Ahmad <irfon.ahmad@gmail.com>

    I'm attempting to read the optional user fields from an MPL script, but whi=
    le I have it "working", the way I'm doing it is exceedingly kludgey and the=
    re are still issues. It was suggested on Reddit that I might be running int=
    o a bug. I wonder if someone can enlighten me.

    So, paring the script down to just the relevant bit, I expected to be able =
    to use something like this:

    Uses User
    While GetUser(CurrentUser) Do Begin
    Writeln(UserOpts[1])
    CurrentUser:
    CurrentUser+1
    End

    In order to display a list of the 2nd optional field for all users. However=
    , no matter what index I put into UserOpts[1], I get fairly muddled results=
    .. UserOpts[7] gives me the 2nd user field with the first five characters cu=
    t off. Eventually I wound up using this:

    Writeln(copy(striplow(UserOpts[0]),2,length(striplow(UserOpts[0]))-1))

    The reason I went with that is that polling UserOpts[0] reliably included t=
    he entire second optional field but with a bunch of garbage ahead of it, an=
    d that was my kludgey way of working around that.

    The continuing issues, though: If someone edits their entry for the optiona=
    l field to something shorter, the data past the end remains. So if that fie=
    ld contained abcdef and I changed it to xyz, then ran the script, for that = user it would become xyzdef. If I open users.dat in a hex editor and zero o=
    ut the offending characters it fixes it, but this is clearly not how I'm su= pposed to be doing any of this. :)

    Is there another way I should be indexing into the UserOpts array? Or is th= ere a bug in how the script is retrieving the data? Any ideas?
    --- NewsGate v1.0 gamma 2
    * Origin: News Gate @ Net396 -Huntsville, AL - USA (1:396/4)