Reading the optional fields in MPL
From
Kim Ahmad@3:770/3 to
All on Tuesday, July 26, 2022 11:25:36
I'm attempting to read the optional user fields from an MPL script, but while I have it "working", the way I'm doing it is exceedingly kludgey and there are still issues. It was suggested on Reddit that I might be running into 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 cut 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 the entire second optional field but with a bunch of garbage ahead of it, and that was my kludgey way of working around that.
The continuing issues, though: If someone edits their entry for the optional field to something shorter, the data past the end remains. So if that field 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 out the offending characters it fixes it, but this is clearly not how I'm supposed to be doing any of this. :)
Is there another way I should be indexing into the UserOpts array? Or is there a bug in how the script is retrieving the data? Any ideas?
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)