GithubHelp home page GithubHelp logo

mrnebbi / jquery-cli Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 220 KB

A command line interface written in HTML, CSS and Javascript. Includes a few basic functions. Connect it to a server, or add local functions.

License: MIT License

CSS 7.13% JavaScript 90.82% HTML 2.05%

jquery-cli's Introduction

jQuery CLI / MUD

This is a command line or MUD interface originally built for a game being developed by @billythekid and I.

This code was sitting somewhat dormant in a project folder, so if you'd like to make use of it feel free to.

I’ve stripped out any game specific things, but I have left in placeholder functions for connecting to a server; this can be used to extend commands, and provide tamper proof online functionality.

Demo

Screenshots

The interface

The easter egg

Available commands

  • time (displays the current time as a unix timestamp)
  • print/echo (will print the text that follows on screen)
  • about [license] (displays information about this project [displays the MIT license for this project])
  • clear/cls (clears the screen)
  • history (displays command history. Can be navigated through with up and down arrows)
  • h4x0r/1337 (this easter egg command, makes the terminal area look "hackery"... HACK THE PLANET)
  • help (displays help, showing all avaliable commands)

Future

The javascript code is currently very dependant on the HTML. At some point, I'll make this behave more like a plugin, allowing it to be dropped into an existing interface with greater ease.

Quirks

As I said this code was thrown together to get us off the ground with a game project. There are a few quirks and sloppy bits of coding.

E.g. $(terminal).scrollTop(900000); yes I know I'll fix this later ;)

Feel free to use this in your project, but please follow the license.

License

The MIT License (MIT)

Copyright (c) 2016 Ian Isted

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

jquery-cli's People

Contributors

gavbarnett avatar mrnebbi avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

gavbarnett

jquery-cli's Issues

CLI Menu: Switch vs Object Literal

Consider looking at this to clean up the CLI menu selection. I think this would make it easier to add new functions and add layers to the menu system.
I think this also opens up options for tab-complete implementation.

Switch vs Object Literals

Some reading to do but my understanding would be something like:

  1. init program
  2. pull in BasicFunctions menu
  3. wait for user input
  4. if user input introduces new menus (say we start playing a game with north, south, east, west options) then add these to menu options.
  5. equally menu items can be removed if required.

In summary you have a menu as an array.

Game Map Function

Add a Function to display the map to the player
Suggest a simple 11x11 character map
symbols should be coloured

suggested key, but will need to see what it looks like:

@(yellow) = current location (should be centred on map)
^(grey - colour could be tied to height (i.e green base, tree line, white peaks)) = mountain
#(green) = trees
&(blue - colour could be tied to depth (darker = deeper)) = water
| - (lightgrey) = path
H() = houses
P() = pub
+() = church
:
:

Css text size

When viewing in phone css text size its initially too small.
Think its absolute and should be relative.

Help double output

help current gives "help: help will help you if you need help." output twice.
Example below

input help
echo help: help will help you if you need help.
echo 
Available commands:
about: Display information about this program.
clear: Clears the current log view.
connect: Attempt to connect to a server.
echo: Echo a string to the terminal.
hacker: Enables hacker mode.
help: help will help you if you need help.
time: Displays the current time.

Game Themes

We could use a variant of "hacker" to give the CLI a theme during game play.

Some example ideas:

  • In a danger situation the shadow could be Red.
  • As danger approaches the "shake" (or colour oscillation between 2 red shades) could become more frequent.
  • When there is a Victory or a trophy is awarded the shadow could splash Golden from a short time. Or a rainbow fanfair.
  • Could be used to reflect the weather
  • - (A storm could look really cool like this; with blue rain and then flashes of yellow lightening with a following thunder shake - with some smart coding the time between lightening and thunder could reflect distance from the eye of the storm)
  • - And on a mountain top the wind could shake the screen
  • During a battle each hit could be a shake (shake size reflecting power)

I guess this is more of a game engine idea than for the game itself.

Enter tab complete

On phones the tab Button is not easily avaliable. So incorporate tab into enter.
When enter is pressed run via tabcomplete so "n"[enter] resolves to north for example.

Help making jam

entering Help [variable] where the variable does not match a known function in the help directory does nothing. i.e Help making jam
stdout = "" and so Echo does not run, hence logger is not invoked.

This should return an error such as.
ERROR: This function is not in the help directory, I'm sorry I cannot help you.

Missing functions

Since the recent removal of the CLI menu switch a couple of functions are no longer accessible. This is because i hadn't moved then across to BasicFunctions.js yet.

These will need re-enabled:

  • History (up/down still works just not the list)
  • Send (doesn't do much yet anyway)

Add SET Function

Implement SET function similar to CMD on windows.
This allows long strings or values to be reduced to simple variables.
Add SET and an associated memory space (array)
Add functionality to ECHO to decode variables

SET a=6
SET b=3
SET c=cat
ECHO %a%
6
ECHO %b%
3
ECHO a
a
Echo Thats a nice %c% that lives at %b% queens street.
Thats a nice cat that lives at 3 queens street.
SET  //prints all variables
a=6
b=3
c=cat

Later consider extending with math & array functions

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.