Simple notify

From BeebWiki
Revision as of 00:58, 29 August 2013 by WikiSysop (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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+" --- "+message$
   message$=LEFT$(message$,248)             :REM Maximum 248 characters
   PROCNet_Send(1,dest%,message$+CHR$0)     :REM Send to destination
   END

This code uses the following routines from the Net library:

   DEFPROCNet_Send(A%,D%,A$):?X%=A%:X%!1=D%:$(X%+3)=A$:A%=&13:CALL&FFF1:ENDPROC
   :
   DEFFNNet_StnNum(A$)
   A%=INSTR(A$,"."):IFA%:=256*VALLEFT$(A$,A%-1)+VALMID$(A$,A%+1) ELSE =VALA$
   :
   DEFFNNet_Info(A%,D%):?X%=A%:X%!1=D%:A%=&13:CALL&FFF1:=X%!1

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

Jgharston 15:17, 30 July 2012 (UTC)