Synchronet v3.19b-Win32 (install) has been released (Jan-2022).

You can donate to the Synchronet project using PayPal.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
custom:javascript [2018/12/27 19:47] – Added link to JS Libraries index digital mancustom:javascript [2019/04/28 02:44] – [Output] Document which output functions perform char set translations (e.g. EX-ASCII to ASCII or PETSCII) digital man
Line 76: Line 76:
 The Synchronet JavaScript object model includes a global method: ''load()'' (a closely-related ''require()'' method was added in v3.17). The Synchronet JavaScript object model includes a global method: ''load()'' (a closely-related ''require()'' method was added in v3.17).
  
-The ''load'' method is used to compile and execute an external script from within a //parent// script. It is most often used to load numeric constants and object definitions from files in the ''[[dir:exec]]/load'' directory as these definitions (e.g. ''sbbsdefs.js'') and object libraries (e.g. ''graphic.js'') enable code re-use and sharing among modules, saving us JS programmers and lot of typing and redundancy.+The ''load'' method is used to compile and execute an external script from within a //parent// script. It is most often used to load numeric constants and object definitions from files in the ''[[dir:exec]]/[[dir:load]]'' directory as these definitions (e.g. ''sbbsdefs.js'') and object libraries (e.g. ''graphic.js'') enable code re-use and sharing among modules, saving us JS programmers and lot of typing and redundancy.
  
 There are 3 primary ways to use the ''load'' method: There are 3 primary ways to use the ''load'' method:
Line 89: Line 89:
 var queue = load(true, 'myscript.js', 1, 2, 3); var queue = load(true, 'myscript.js', 1, 2, 3);
 var value = queue.read(1000); var value = queue.read(1000);
-print(value);+writeln(value);
 </code> </code>
  
Line 110: Line 110:
 lib.do_thing(); lib.do_thing();
 if(lib.status_good == true) if(lib.status_good == true)
-    print('good');+    writeln('good');
 else else
     alert('bad');     alert('bad');
Line 120: Line 120:
 There are many different text output methods supported by the Synchronet JavaScript Object Model and knowing which method (function) to use in what situation can be confusing. The following table should help: There are many different text output methods supported by the Synchronet JavaScript Object Model and knowing which method (function) to use in what situation can be confusing. The following table should help:
  
-^ Method          ^ BBS((Terminal Server)) ^ JSexec ^ Prints newline ^ Expands/Decodes    ^ Multiple Values((as function arguments)) ^ Notes ^ +^ Method          ^ BBS((Terminal Server)) ^ JSexec ^ Newline ^ Xlat ((Character set translation)) ^ Expands/Decodes    ^ Multiple Values((as function arguments)) ^ Notes ^ 
-| ''write()''     | Yes                    | Yes    | No           | Telnet-IAC, Ctrl-A | Yes                | If user not online, same as ''log(LOG_INFO, ...)''+| ''write()''     | Yes                    | Yes    | No           | Yes | Telnet-IAC, [[custom:ctrl-a_codes|Ctrl-A]] | Yes                | If user not online, same as ''log(LOG_INFO, ...)''
-| ''write_raw()'' | Yes                    | No     | No           | Telnet-IAC         | Yes                | Value may contain NULs, no charset translation | +| ''write_raw()'' | Yes                    | No     | No           | No  | Telnet-IAC         | Yes                | Value may contain NULs, no charset translation | 
-| ''writeln()''   | Yes                    | Yes    | Yes          | Telnet-IAC, Ctrl-A | Yes                | aka ''print()''+| ''writeln()''   | Yes                    | Yes    | Yes          | Yes | Telnet-IAC, Ctrl-A | Yes                | aka ''print()''
-| ''printf()''    | Yes                    | Yes    | No           | Telnet-IAC, Ctrl-A | Yes((using C printf format syntax))  | ala C ''printf()'' +| ''printf()''    | Yes                    | Yes    | No           | Yes | Telnet-IAC, Ctrl-A | Yes((using C printf format syntax))  | ala C ''printf()'' 
-| ''alert()''     | Yes                    | Yes    | Yes          | Telnet-IAC, Ctrl-A | No                 | If user not online, same as ''log(LOG_WARNING, ...)''+| ''alert()''     | Yes                    | Yes    | Yes          | Yes | Telnet-IAC, Ctrl-A | No                 | If user not online, same as ''log(LOG_WARNING, ...)''
-| ''log()''             | Yes              | Yes    | N/A          |                    | Yes((following the log-level argument)) | Displayed/logged on the server only | +| ''log()''             | Yes              | Yes    | N/A          | N/A |                    | Yes((following the log-level argument)) | Displayed/logged on the server only | 
-| ''console.print()''   | Yes              | No     | No           | Telnet-IAC, Ctrl-A | Yes | | +| ''console.print()''   | Yes              | No     | No           | Yes | Telnet-IAC, Ctrl-A | Yes | | 
-| ''console.write()''   | Yes              | No     | No           | Telnet-IAC         | Yes | | +| ''console.write()''   | Yes              | No     | No           | PETSCII only | Telnet-IAC         | Yes | | 
-| ''console.writeln()'' | Yes              | No     | Yes          | Telnet-IAC         | Yes | | +| ''console.writeln()'' | Yes              | No     | Yes          | PETSCII only | Telnet-IAC         | Yes | | 
-| ''console.putmsg()''  | Yes              | No     | No           | Telnet-IAC, Ctrl-A, @-Codes | No        |       +| ''console.putmsg()''  | Yes              | No     | No           | Yes | Telnet-IAC, Ctrl-A, [[custom:atcodes|@-Codes]], [[custom:colors|Extra Attributes]] | No        | Typically used for displaying text/menu files 
-| ''console.center()''  | Yes              | No     | Yes          | Telnet-IAC, Ctrl-A | No | Text centered on screen | +| ''console.center()''  | Yes              | No     | Yes          | Yes | Telnet-IAC, Ctrl-A | No | Text centered on screen | 
-| ''console.mnemonics()'' | Yes            | No     | No           | Telnet-IAC, Ctrl-A, @-Codes, ~ | No | Hotkey highlights | +| ''console.mnemonics()'' | Yes            | No     | No           | Yes | Telnet-IAC, Ctrl-A, @-Codes, ~ | No | Hotkey highlights | 
-| ''console.putbyte()'' | Yes              | No     | No           | Telnet-IAC         | No | No charset translation | +| ''console.putbyte()'' | Yes              | No     | No           | No  | Telnet-IAC         | No | No charset translation | 
-| ''client.socket.send()'' | Yes           | No     | No                              | No | Avoid using |+| ''client.socket.send()'' | Yes           | No     | No           | No  |                    | No | Avoid using |
  
 ===== See Also ===== ===== See Also =====