These are chat archives for cmdPP/core

22nd
Mar 2016
Jett C
@jettcrowson
Mar 22 2016 22:25
Hi
V0.3 was just released.
Russell Hueske
@ninja4826
Mar 22 2016 22:25
I just saw that a couple of minutes ago.
I was thinking the other day, and since CMD++ emulates a terminal, it could also run as a program on a CLI.
Jett C
@jettcrowson
Mar 22 2016 22:26
Could you post a link for people to join the gitter on the subreddit?
Flu?
Russell Hueske
@ninja4826
Mar 22 2016 22:27
Yeah
Jett C
@jettcrowson
Mar 22 2016 22:27
Cli*?
Russell Hueske
@ninja4826
Mar 22 2016 22:27
Bash, Command Line
Jett C
@jettcrowson
Mar 22 2016 22:27
Would it be possible to run it there?
Russell Hueske
@ninja4826
Mar 22 2016 22:27
If Node.JS is installed, yeah.
Jett C
@jettcrowson
Mar 22 2016 22:28
Interesting idea. I'm not quite familiar with node.js but if you want to give it a shot, that would be amazing!
Russell Hueske
@ninja4826
Mar 22 2016 22:29
Cool! To make it easier to play the game in different environments, a core module could be created to separate the game logic from DOM
That's what this repository is for.
If you don't think that's a good idea, I can just remove the organization, and something else could be developed to handle it
Jett C
@jettcrowson
Mar 22 2016 22:30
Could you walk me through what this means?
Russell Hueske
@ninja4826
Mar 22 2016 22:31
With normal javascript in HTML, you access libraries using script tags. In Node.JS, libraries (or modules, rather) are accessed using either require('module-name') or for ES6, import module from 'module-name'.
With a central module hosting the game logic, the website could either use script tags or use a tool like browserify to include the game logic. If logic changes in the core repository, then the website and CLI applications would receive the same changes.
Jett C
@jettcrowson
Mar 22 2016 22:34
How would localstorage work?
Russell Hueske
@ninja4826
Mar 22 2016 22:36
for the web implementation, this would be the basic workflow:
  1. Include core script file
  2. Instantiate CMD object, providing functions for respond, save, and update
  3. Add event handlers for typing
By passing the CMD constructor a function for saving, the CMD object would have access to localstorage.
I'll draw up an example in just a second.
Russell Hueske
@ninja4826
Mar 22 2016 22:47
Here's a JSFiddle representation without using HTML: Here
Jett C
@jettcrowson
Mar 22 2016 22:53
And the html would still work in a CLI environment?
Russell Hueske
@ninja4826
Mar 22 2016 22:56
Hold on. I'll update the JSFiddle to show you how that would work.
Jett C
@jettcrowson
Mar 22 2016 22:58
Gottit
Russell Hueske
@ninja4826
Mar 22 2016 23:00
I'm not sure that JQuery is working on JSFiddle, but do you see what I mean?
In the CLI environment, the respond function passed to the CMD constructor would be different. In fact, it would probably just be a normal console.log(text).
Jett C
@jettcrowson
Mar 22 2016 23:52
Sorry, I think this sounds great, but I really don't understand Node.js or how to do this, and I'm not comfortable working with things I don't understand. If you want to do this yourself, you could fork the project. I would love to see this done. Thanks
Russell Hueske
@ninja4826
Mar 22 2016 23:57
I'm actually almost done rewritting the commands. I understand if you're a bit uncomfortable with the system.
Jett C
@jettcrowson
Mar 22 2016 23:57
upload it and I'll check it out though, but I am planning on learning node soon
Russell Hueske
@ninja4826
Mar 22 2016 23:59
The only difference between node and normal javascript is the require(module-name) function. Node.JS was a fork from Google Chrome's javascript engine.