• Dumb question 2

    From John@VERT/JCBBS to All on Tue Dec 1 19:52:25 2020
    Hi Folks:ããI am starting to learn Jscript. Simple thing, how do I print something that has a CTRL A code or @LASTON@ ? I am using the userlist.js, I would ideally like to use the print or writeln command. Coming from Turbo/Free pascal, Jscript is not easy, having to unlearn the structued way. This is what I have so far:ãã// A sample user listing script for Synchronet v3.1+ãã// $Id: userlist.js,v 1.6 2019/01/11 09:37:25 rswindell Exp $ãã"use strict";ããvar str;ããrequire("sbbsdefs.js", 'USER_DELETED');ãload("sbbsdefs.js");ãload("bajalib.js");ãvar lastuser = system.lastuser;ãvar s = baja.printãvar u = new User;ããvar logons = u.logons;ããprintf("Alias Handle Address Location Connection Logons Security\n");ãs ("tes"); print ("@LASTON@");ãããThanks,ãJohnãã---ã þ Synchronet þ JCBBS what an unoriginal name:)ã
  • From Nelgin@VERT/EOTLBBS to John on Tue Dec 1 19:33:46 2020
    John wrote:ã> Hi Folks:ã> ã> I am starting to learn Jscript. Simple thing, how do I print something that has a CTRL A code or @LASTON@ ? I am using the userlist.js, I would ideally like to use the print or writeln command. Coming from Turbo/Free pascal, Jscript is not easy, having to unlearn the structued way. This is what I have so far:ã> ã> // A sample user listing script for Synchronet v3.1+ã> ã> // $Id: userlist.js,v 1.6 2019/01/11 09:37:25 rswindell Exp $ã> ã> "use strict";ã> ã> var str;ã> ã> require("sbbsdefs.js", 'USER_DELETED');ã> load("sbbsdefs.js");ã> load("bajalib.js");ã> var lastuser = system.lastuser;ã> var s = baja.printã> var u = new User;ã> ã> var logons = u.logons;ã> ã> printf("Alias Handle Address Location Connection Logons Security\n");ã> s ("tes"); print ("@LASTON@");ããããYou'd need to use console.putmsg since that's the only method that'll displayã@-Codes. http://wiki.synchro.net/custom:javascriptããHowever the proper way would probably to use javascript objects.ããI've not looked but I'm sure there's one to do what you need.ãhttps://nix.synchro.net/jsobjs.htmlãã---ã þ Synchronet þ End Of The Line BBS - endofthelinebbs.comã
  • From John@VERT/JCBBS to Nelgin on Tue Dec 1 20:58:25 2020
    Re: Re: Dumb question 2ã By: Nelgin to John on Tue Dec 01 2020 07:33 pmããHi Nelgin:ããThank you! Do you know what object I need to include to call that function?ããThanks,ãJohnãã---ã þ Synchronet þ JCBBS what an unoriginal name:)ã
  • From Digital Man@VERT to John on Tue Dec 1 19:20:16 2020
    Re: Dumb question 2ã By: John to All on Tue Dec 01 2020 07:52 pmãã > Hi Folks:ã >ã > I am starting to learn Jscript.ããI know what you mean, but it's actually JavaScript (or ECMAScript). "JScript" is Microsoft's implementation of EMCAScript and not what Synchronet uses.ãã > Simple thing, how do I print something thatã > has a CTRL A code or @LASTON@ ?ããconsole.putmsg() will expand @-codes. Most other output methods will expand Ctrl-A codes. See http://wiki.synchro.net/custom:javascript#output for a reference.ãã > s ("tes"); print ("@LASTON@");ããSo that's the @-codes will expand to the *current* user's information. Instead, you wanted to print u.statistics.laston_date. And you probably want to convert that (number) to a human-readable string with something like system.datestr(), system.timestr(), or strftime(): http://synchro.net/docs/jsobjs.htmlãsee exec/fingerservice.js or other exec/*.js files for examples.ããor even convert it to a JavaScript Date object and use all its methods of stringification:ãhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Dateã-- ã digital manããSynchronet/BBS Terminology Definition #58:ãPhreak = Telephone system hack[er]ãNorco, CA WX: 66.5øF, 23.0% humidity, 0 mph SW wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
  • From John@VERT/JCBBS to Digital Man on Tue Dec 1 22:26:26 2020
    Re: Dumb question 2ã By: Digital Man to John on Tue Dec 01 2020 07:20 pmããGreat thank you, one example is all i needed to understand getting the object and referencing it.ããThanks again!ãJohnãã---ã þ Synchronet þ JCBBS what an unoriginal name:)ã