Difference between revisions of "Simple notify"

From BeebWiki
Jump to: navigation, search
m (1 revision)
m (.)
 
Line 8: Line 8:
 
     dest%=FNNet_StnNum(dest$)                :REM Convert station to number
 
     dest%=FNNet_StnNum(dest$)                :REM Convert station to number
 
     INPUT LINE "Enter message: "message$
 
     INPUT LINE "Enter message: "message$
     message$=CHR$7+"--- "+STR$mystation+" --- "+message$
+
     message$=CHR$7+"--- "+STR$mystation+" --- "+LEFT$(message$,235)
    message$=LEFT$(message$,248)             :REM Maximum 248 characters
+
                                            :REM Maximum 248 characters
 
     PROCNet_Send(1,dest%,message$+CHR$0)    :REM Send to destination
 
     PROCNet_Send(1,dest%,message$+CHR$0)    :REM Send to destination
 
     END
 
     END
Line 16: Line 16:
  
 
     DEFPROCNet_Send(A%,D%,A$):?X%=A%:X%!1=D%:$(X%+3)=A$:A%=&13:CALL&FFF1:ENDPROC
 
     DEFPROCNet_Send(A%,D%,A$):?X%=A%:X%!1=D%:$(X%+3)=A$:A%=&13:CALL&FFF1:ENDPROC
    :
 
 
     DEFFNNet_StnNum(A$)
 
     DEFFNNet_StnNum(A$)
 
     A%=INSTR(A$,"."):IFA%:=256*VALLEFT$(A$,A%-1)+VALMID$(A$,A%+1) ELSE =VALA$
 
     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
 
     DEFFNNet_Info(A%,D%):?X%=A%:X%!1=D%:A%=&13:CALL&FFF1:=X%!1
  
Line 27: Line 25:
  
 
     dest%=FNNet_Addr(dest$)                :REM Convert station/user to number
 
     dest%=FNNet_Addr(dest$)                :REM Convert station/user to number
 +
 +
If running on a second processor, the maximum length string sendable is 120 characters.
  
 
[[User:Jgharston|Jgharston]] 15:17, 30 July 2012 (UTC)
 
[[User:Jgharston|Jgharston]] 15:17, 30 July 2012 (UTC)

Latest revision as of 21:05, 8 March 2015

   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
   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

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

Jgharston 15:17, 30 July 2012 (UTC)