• Multiuser chat room

    From Ice@VERT to All on Thu Jun 9 16:15:10 2011
    so i want to make a multiplayer "mud" game, and was gonna use tele-arena as myãmodel, since i rewrote it form worldgroup in C i figured i would make aãsynchronet port, that gave me 2 options, C or JS, and since i never playedãwith JS before i took on a learning project :)ããanyhow, to better aid myself i broke the project into steps, first playingãwith the ini databasing which i think i pretty much got the hang of, and nowãim working on parsing my input routines.ããhere's what i got thus far:ããwhile(1)ã{ã var cmd = console.getstr().toLowerCase();ã ã if((cmd=="exit") || (cmd=="x")) exit();ã elseã {ã console.writeln(format("You typed: %s",cmd));ã console.crlf();ã console.print(":");ã } ã}ããwhile that does work for single word commands i wanted to better learn how toãparse it for multiple character commands.ããso like if i wanted to whisper to a user like "whisper <user> <message>"ããin C i would go:ããif((argc==3) && (!stricmp(argv[0],"whisper")))ã{ã whisper(argv[1],argv[2]);ã}ããcan anyone point me in the direction for a better formula to grabãpieces of the text and break it into subparts like above?ããi tried this way:ããvar cmd = console.getstr().toLowerCase();ããconsole.writeln(format("You typed: %s",cmd));ããvar parsed = cmd.split(" ",3);ããconsole.writeln(format("I parsed it to: %s %s %s",parsed[0],ã parsed[1],ã parsed[2]));ããwhich did seem to work but just seemed like a hard way to do something easier. ãany thoughts?ã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
  • From Digital Man@VERT to Ice on Thu Jun 9 17:59:14 2011
    Re: Multiuser chat roomã By: Ice to All on Thu Jun 09 2011 04:15 pmãã > so i want to make a multiplayer "mud" game, and was gonna use tele-arena asã > my model, since i rewrote it form worldgroup in C i figured i would make aã > synchronet port, that gave me 2 options, C or JS, and since i never playedã > with JS before i took on a learning project :)ã >ã > anyhow, to better aid myself i broke the project into steps, first playingã > with the ini databasing which i think i pretty much got the hang of, andã > now im working on parsing my input routines.ã >ã > here's what i got thus far:ã >ã > while(1)ã > {ã > var cmd = console.getstr().toLowerCase();ã >ã > if((cmd=="exit") || (cmd=="x")) exit();ã > elseã > {ã > console.writeln(format("You typed: %s",cmd));ã > console.crlf();ã > console.print(":");ã > }ã > }ã >ã > while that does work for single word commands i wanted to better learn howã > to parse it for multiple character commands.ã >ã > so like if i wanted to whisper to a user like "whisper <user> <message>"ã >ã > in C i would go:ã >ã > if((argc==3) && (!stricmp(argv[0],"whisper")))ã > {ã > whisper(argv[1],argv[2]);ã > }ã >ã > can anyone point me in the direction for a better formula to grabã > pieces of the text and break it into subparts like above?ã >ã > i tried this way:ã >ã > var cmd = console.getstr().toLowerCase();ã >ã > console.writeln(format("You typed: %s",cmd));ã >ã > var parsed = cmd.split(" ",3);ã >ã > console.writeln(format("I parsed it to: %s %s %s",parsed[0],ã > parsed[1],ã > parsed[2]));ã >ã > which did seem to work but just seemed like a hard way to do somethingã > easier. any thoughts?ããThat's a pretty common method of JS string parsing. Seeãhttps://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String forãthe JS String reference. Synchronet doesn't add any new/different stringãparsing classes.ãã digital manããSynchronet "Real Fact" #18:ãThe first Synchronet BBS (Vertrauen) went live in July of 1991 (replacing WWIV).ã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
  • From Tracker1@VERT/TRN to Digital Man on Sat Jul 2 23:30:53 2011
    On 6/9/2011 5:59 PM, Digital Man wrote:ã> That's a pretty common method of JS string parsing. Seeã> https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String forã> the JS String reference. Synchronet doesn't add any new/different stringã> parsing classes.ããThere is pretty good regex support, could also do a custom buffer via inkey ãloop, which would also allow for listening for events while typing...ãã-- ãMichael J. Ryan - http://tracker1.info/ãã---ã þ Synchronet þ Roughneck BBS - telnet://roughneckbbs.com - www.roughneckbbs.comã