Simple notify

From BeebWiki
Jump to: navigation, search
   REM Simple notify code
   DIM ctrl% 255:X%=ctrl%:Y%=X%DIV256
   mystation%=FNNet_Info(8,0)               :REM Read my station number
   INPUT "Input station to notify "dest$
   dest%=FNNet_StnNum(dest$)                :REM Convert station to number
   INPUT LINE "Enter message: "message$
   message$=CHR$7+"--- "+STR$mystation+" --- "+LEFT$(message$,235)
                                            :REM Maximum 248 characters
   PROCNet_Send(1,dest%,message$+CHR$0)     :REM Send to destination

This code uses the following routines from the Net library:

   A%=INSTR(A$,"."):IFA%:=256*VALLEFT$(A$,A%-1)+VALMID$(A$,A%+1) ELSE =VALA$

Using the FNNet_Addr() function in the NetUtil library (which requires the NetFS library) the destination can be a station number or a user name:

   dest%=FNNet_Addr(dest$)                :REM Convert station/user to number

If running on a second processor, the maximum length string sendable is 120 characters.

Jgharston 15:17, 30 July 2012 (UTC)