diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4a30576 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Muddle + uses: demonnic/build-with-muddler@v1.3 + + - name: Upload MPackage + uses: actions/upload-artifact@v2 + with: + name: run-lua-code + path: build/tmp/ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bdd525f --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.vscode/ +build/ +sub-projects/ +doc/ +.output diff --git a/README.md b/README.md new file mode 100644 index 0000000..3a43d4d --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +# Echo Package + +The echo package provides a means of testing triggers via the command line with four command aliases; +`` `echo, `cecho, `decho, `hecho``. + +All act as if the given text came from the game itself and will fire any matching triggers. + +See [Triggers](https://wiki.mudlet.org/w/Manual:Introduction#Triggers) for further information on matching text. + +## `echo Alias + +Displays text on the screen and tells all matching triggers to fire. For coloring use one +of the other functions mentioned below. + +```txt +-- examples +> `echo text - displays text on the main screen and tells all matching triggers to fire +> `echo This is a sample line from the game$$And this is a new line. +``` + +See [echo](https://wiki.mudlet.org/w/Manual:Lua_Functions#echo), [feedTriggers](https://wiki.mudlet.org/w/Manual:Lua_Functions#feedTriggers), + +## `cecho Alias + +Like echo, but you can add color information using color names and ANSI values. + +```txt +-- example: color format is +> `cecho green on red reset$$<124:100>foreground of ANSI124 and background of ANSI100 +``` + +See [cecho](https://wiki.mudlet.org/w/Manual:Lua_Functions#cecho), [cfeedTriggers](https://wiki.mudlet.org/w/Manual:Lua_Functions#cfeedTriggers). + +## `decho Alias + +Like cecho, but you can add color information using format. + +```txt +-- example +> `decho <0,128,0:128,0,0>green on red reset +``` + +See [decho](https://wiki.mudlet.org/w/Manual:Lua_Functions#decho), [dfeedTriggers](https://wiki.mudlet.org/w/Manual:Lua_Functions#dfeedTriggers). + +## `hecho Alias + +Like cecho, but you can add color information using hex #RRGGBB format. + +```txt +-- example +> `hecho #008000,800000green on red#r reset +``` + +See [hecho](https://wiki.mudlet.org/w/Manual:Lua_Functions#hecho), [hfeedTriggers](https://wiki.mudlet.org/w/Manual:Lua_Functions#hfeedTriggers). \ No newline at end of file diff --git a/mfile b/mfile new file mode 100644 index 0000000..e4836be --- /dev/null +++ b/mfile @@ -0,0 +1,6 @@ +{ + "package": "echo", + "version": "1.0", + "author": "Mudlet", + "title": "A set of aliases to test triggers on the command line." +} diff --git a/src/aliases/`cecho.lua b/src/aliases/`cecho.lua new file mode 100644 index 0000000..9f75801 --- /dev/null +++ b/src/aliases/`cecho.lua @@ -0,0 +1,5 @@ +local s = matches[2] + +s = string.gsub(s, "%$", "\n") +cfeedTriggers("\n" .. s .. "\n") +echo("\n") \ No newline at end of file diff --git a/src/aliases/`decho.lua b/src/aliases/`decho.lua new file mode 100644 index 0000000..8431cd9 --- /dev/null +++ b/src/aliases/`decho.lua @@ -0,0 +1,5 @@ +local s = matches[2] + +s = string.gsub(s, "%$", "\n") +dfeedTriggers("\n" .. s .. "\n") +echo("\n") \ No newline at end of file diff --git a/src/aliases/`echo.lua b/src/aliases/`echo.lua new file mode 100644 index 0000000..e1a8fac --- /dev/null +++ b/src/aliases/`echo.lua @@ -0,0 +1,5 @@ +local s = matches[2] + +s = string.gsub(s, "%$", "\n") +feedTriggers("\n" .. s .. "\n") +echo("\n") \ No newline at end of file diff --git a/src/aliases/`hecho.lua b/src/aliases/`hecho.lua new file mode 100644 index 0000000..53fed08 --- /dev/null +++ b/src/aliases/`hecho.lua @@ -0,0 +1,5 @@ +local s = matches[2] + +s = string.gsub(s, "%$", "\n") +hfeedTriggers("\n" .. s .. "\n") +echo("\n") \ No newline at end of file diff --git a/src/aliases/aliases.json b/src/aliases/aliases.json new file mode 100644 index 0000000..18943a6 --- /dev/null +++ b/src/aliases/aliases.json @@ -0,0 +1,18 @@ +[ + { + "name": "`echo", + "regex": "`echo (.+)" + }, + { + "name": "`cecho", + "regex": "`cecho (.+)" + }, + { + "name": "`decho", + "regex": "`decho (.+)" + }, + { + "name": "`hecho", + "regex": "`hecho (.+)" + } +] \ No newline at end of file