Metropoli BBS
VIEWER: sw-ulist.pps MODE: TEXT (CP437)
;-----------------------------------------------------------PowerPPL v2.22---
; File           : PR-ULIST.PPS
; Original by    : SLEEPWALKER PSYCHIC on 07/27/1997 at 16:20:18
; Last update by : SLEEPWALKER PSYCHIC on 07/28/1997 at  3:38:13
;----------------------------------------------------------------------------
;a simple user-lister
;sleepwalker.pr 1997, for pplt #2
;----------------------------------------------------------------------------
; this ppe just prints some data about each user in the user record, a lot
; of things should be improved, a cfg-file, better graphics and so on...
; a routine to scroll the screen up and down would also be cool. :)
; but this is just an example, hope you learn something from it!
;
; if you want to use this source for something, please contact me, or at
; least greet me! :)
;
;  - sleepwalker.pr slwalker@applausenett.no
;    pr - pr.home.ml.org
;----------------------------------------------------------------------------

 ;declare some variables...
integer users,nr_of_users
string name,city

 ;and a procedure
declare procedure printout()
;%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%
begin
  cls
  startdisp nc  ;"nc" makes the ppe stop after each page
  
    ;print the header
   println "@X08┌─────────────────────────────────────────────────────────────────────────────┐"
   print "@POS:1@@X08│@X07"
   print "@POS:4@", "@X0F#"
   print "@POS:8@" + "@X0Fname"
   print "@POS:26@" + "@X0Fcity"
   print "@POS:48@", "@X0Fuploaded"
   print "@POS:61@", "@X0Flogons"
   print "@POS:69@", "@X0Fsec"
   println "@POS:79@@X08│"
   print "@X08├─────────────────────────────────────────────────────────────────────────────┤"
   newline

   ;find out how many users there are. We do this by checking the filesize
   ;of the users file (in pcboard.dat, line 29), and dividing the filesize
   ;with 400. We divide by 400 because each user record is 400 bytes long,
   ;so a user-file with 4 users would take 1600 bytes of space.
  let nr_of_users = fileinf(readline(pcbdat(), 29), 4) / 400

   ;now the loop that does the real work here...
 for users = 1 to nr_of_users  ;allusers now contain all numbers from 1 to max
   getaltuser users  ;get the userinfo from each record, which is increased by the loop
   printout()  ;print the data you want to the screen
 next  ;process the next record
 
   ;print the footer
  println "@X08├─────────────────────────────────────────────────────────────────────────────┤"
  println "@X08│@X0F    User lister o.1b @X07by SleepWalker.pr   Written as an example for PPLT #2   @X08│"
  println "@X08└─────────────────────────────────────────────────────────────────────────────┘"
 wait  ;makes the ppe wait until the user presses enter
end
;%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%
procedure printout()  ;prints the data we want to screen
;%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%
   ;cut down some data to make the formatting on screen fit
  let name = left(u_name(), 17)  ;cut the name down to 17 chars
  let city = left(u_city, 20)    ;cut the city down to 20 chars

    ;we use the pcbmacro @POS:x@" to move the cursor where we want to print
   print "@POS:1@@X08│@X07"
   print "@POS:4@", users
   print "@POS:8@" + mixed(name)
   print "@POS:26@" + mixed(city)
   print "@POS:48@", u_bul()
   print "@POS:61@", u_logons()
   print "@POS:69@", u_sec()
   print "@POS:79@@X08│"
  newline
endproc
;%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%/%
[ RETURN TO DIRECTORY ]