| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| custom:javascript [2020/05/02 15:48] – [Input] Add notes and console.inkey() method digital man | custom:javascript [2026/02/19 02:21] (current) – [See Also] update the comment on the nix.synchro.net/jsobjs.html digital man |
|---|
| |
| You can learn about the core JavaScript language and object model from the following documents: | You can learn about the core JavaScript language and object model from the following documents: |
| * [[http://developer.mozilla.org/en/JavaScript/Guide|Core JavaScript Guide]] ([[http://developer.mozilla.org/docs/Core_JavaScript_1.5_Guide|Historic: 1.5]]) | * [[https://developer.mozilla.org/en-US/docs/Web/JavaScript|Core JavaScript Guide]] ([[http://developer.mozilla.org/docs/Core_JavaScript_1.5_Guide|Historic: 1.5]]) |
| * [[http://developer.mozilla.org/en/JavaScript/Reference|Core JavaScript Reference]] ([[http://developer.mozilla.org/docs/Core_JavaScript_1.5_Reference|Historic: 1.5]]) | * [[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference|Core JavaScript Reference]] ([[http://developer.mozilla.org/docs/Core_JavaScript_1.5_Reference|Historic: 1.5]]) |
| |
| JavaScript is an established, mature scripting language syntactically similar to C++ and Java. | JavaScript is an established, mature scripting language syntactically similar to C++ and Java. |
| [[https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/JavaScript_Overview#JavaScript_and_Java|JavaScript is not Java]]. | [[https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/JavaScript_Overview#JavaScript_and_Java|JavaScript is not Java]]. |
| |
| The ECMA and ISO standards organizations have standardized the core JavaScript language in [[http://developer.netscape.com/docs/javascript/e262-pdf.pdf|ECMA-262]] (ECMAScript) and ISO-16262. | The ECMA and ISO standards organizations have standardized the core JavaScript language in [[https://ecma-international.org/wp-content/uploads/ECMA-262_5.1_edition_june_2011.pdf|ECMA-262]] (ECMAScript) and ISO-16262. |
| |
| ===== Baja and JavaScript ===== | ===== Baja and JavaScript ===== |
| | ''alert()'' | Yes | 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 | 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 | Yes | Telnet-IAC, Ctrl-A | Yes | | | | ''console.print()'' | Yes | No | No | Yes | Telnet-IAC, Ctrl-A, [[custom:atcodes|@-Codes]] when ''P_ATCODES'' mode flag used| Yes | | |
| | ''console.write()'' | Yes | No | No | Yes | Telnet-IAC | Yes | No line-counting/auto-pause | | | ''console.write()'' | Yes | No | No | Yes | Telnet-IAC | Yes | No line-counting/auto-pause | |
| | ''console.writeln()'' | Yes | No | Yes | Yes | Telnet-IAC | Yes | No line-counting/auto-pause | | | ''console.writeln()'' | Yes | No | Yes | Yes | Telnet-IAC | Yes | No line-counting/auto-pause | |
| |
| === Carriage Returns === | === Carriage Returns === |
| If you wish to send a traditional "carriage return" character to the client terminal (i.e. move the cursor to the far left column without advancing to the next line) it is recommended that you use an output method/function that supports [[custom:Ctrl-A codes]] and you send the Ctrl-A ''['' sequences //instead of// an ASCII 13 (''\r'') character. This is required for PETSCII terminal compatibility, where an ASCII 13 character performs a complete "newline" sequence (the equivalent of ''\r\n'') on the client terminal. | If you wish to send a traditional "carriage return" character to the client terminal (i.e. move the cursor to the far left column without advancing to the next line) it is recommended that you use the ''console.creturn()'' method or an output method/function that supports [[custom:Ctrl-A codes]] and you send the Ctrl-A ''['' sequences //instead of// an ASCII 13 (''\r'') character. This is required for PETSCII terminal compatibility, where an ASCII 13 character performs a complete "newline" sequence (the equivalent of ''\r\n'') on the client terminal. |
| |
| ==== Input ==== | ==== Input ==== |
| | ''console.getstr()'' | Yes | No | Get a string of characters from user | | | ''console.getstr()'' | Yes | No | Get a string of characters from user | |
| | ''console.getkey()'' | Yes | No | Get a single key-press | | | ''console.getkey()'' | Yes | No | Get a single key-press | |
| | ''console.getbyte()'' | Yes | No | Get a unprocessed input byte from remote terminal | | | ''console.getbyte()'' | Yes | No | Get an unprocessed input byte from remote terminal as a number | |
| | ''console.getnum()'' | Yes | No | Get a number (between 1 and maxnum) from user | | | ''console.getnum()'' | Yes | No | Get a number (between 1 and maxnum) from user | |
| | ''console.getkeys()'' | Yes | No | Get a key from a list of valid keys, or a number | | | ''console.getkeys()'' | Yes | No | Get a key from a list of valid keys, or a number | |
| ===== See Also ===== | ===== See Also ===== |
| * [[http://synchro.net/docs/jsobjs.html|Synchronet JavaScript Object Model]] | * [[http://synchro.net/docs/jsobjs.html|Synchronet JavaScript Object Model]] |
| * [[http://nix.synchro.net/jsobjs.html|Synchronet JavaScript Object Model (preliminary for v3.17a)]] | * [[http://nix.synchro.net/jsobjs.html|Synchronet JavaScript Object Model (preliminary for next release)]] |
| * [[:util:JSexec]] | * [[:util:JSexec]] |
| * [[:util:Baja]] | * [[:util:Baja]] |