Skip to content

Commit a1166e3

Browse files
author
Blecki
committed
Some MISP shorthands
1 parent 77c6436 commit a1166e3

23 files changed

+507
-159
lines changed

DefaultDatabase/DefaultDatabase.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
<Compile Include="Properties\AssemblyInfo.cs" />
4444
</ItemGroup>
4545
<ItemGroup>
46+
<None Include="database\demo-area\admin-ball.mud">
47+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
48+
</None>
4649
<None Include="database\lists.mud">
4750
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
4851
</None>

DefaultDatabase/MudEngine2012.dll

5 KB
Binary file not shown.

DefaultDatabase/MudServer.exe

0 Bytes
Binary file not shown.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
(prop "@base" (load "object"))
2+
(prop "short" "crystal ball")
3+
(prop "nouns" ["ball"])
4+
(prop "adjectives" ["crystal"])
5+
6+
(prop "description" *(if (is-held-by this actor)
7+
("The ball feels warm in your hands. Gazing deep into it's misty interior, you see a faint glow, and in that glow, writing.\n'This object demonstrates a few things. First, the description changes when you are holding it. Second, it grants it's holder the verb 'divine'. So long as you are holding this ball, you can use the verb 'divine something', where 'something' is the name of a database object. The name of this one happens to be demo-area/admin-ball, try that first.'")
8+
("You see nothing particurally interesting about the crystal ball.")
9+
))
10+
11+
(add-verb this "divine"
12+
(m-sequence [
13+
(m-if-exclusive (m-rest "text")
14+
(m-nop)
15+
(m-fail "What will you look at?\n")
16+
)
17+
(m-definer-held-by "actor")
18+
])
19+
20+
(lambda "ldivine" [matches actor] []
21+
(if (first matches).fail
22+
(echo actor (first matches):fail)
23+
(echo actor "Diving the location of ((first matches).text)...\n(asstring (load (first matches).text).location 2)\n")
24+
)
25+
)
26+
27+
"Divine the location of named database objects."
28+
)
29+
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
(prop "@base" (load "room"))
22
(prop "long"
3-
"A balcony.")
3+
"A small balcony on the side of the tower. Creeping vines cover the sides of the tower and twist through the wrought-iron railing. Small pink flowers dot the vines here and there. The view to the west would be astounding, except for all the fog. The tower ends abruptly a dozen feet below, swallowed whole by the swirling mist.")
4+
5+
(add-adjective-detail this "mist" ^("swirling") "The mist swirls.")
46

57
(open-link this "demo-area/start-room" ^("east" "e"))
68

DefaultDatabase/database/demo-area/start-room.mud

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,6 @@
8383
(prop "short" "quill")
8484
(prop "nouns" ^("quill"))
8585
)))
86+
87+
(add-object this "on" (load "demo-area/admin-ball"))
8688
)))

DefaultDatabase/database/go.mud

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,17 @@
2121
*(nop
2222
(add-verb from name (m-nothing)
2323
(make-link-lambda to (first names))
24-
"Move (first names)."
24+
"Move (name)."
2525
)
2626
(add-verb from "go" (m-complete (m-keyword name))
2727
(make-link-lambda to (first names))
28-
"Move (first names)."
28+
"Move (name)."
29+
)
30+
(add-verb from "look" (m-complete (m-keyword name))
31+
(lambda "llook-direction" ^("matches" "actor") ^("to" "names")
32+
*(echo actor "To the (first names) you see...\n\n((load to):description)")
33+
)
34+
"Look (name)."
2935
)
3036
)
3137
)

DefaultDatabase/database/lists.mud

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
(defun "short_list_with_on" ^("list") ^()
3232
*(if
3333
(equal (length list) 1)
34-
*("is ((first list):a)(on_list (first list)).")
34+
*("is ((first list):a)(on-list (first list)).")
3535
*("(isare list) (strcat
3636
$(mapi "i" list
3737
*(if

DefaultDatabase/database/look.mud

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(add-global-verb "look"
22

33
(m-filter-failures
4-
(m-sequence ^(
4+
(m-sequence [
55
(m-optional (m-keyword "at"))
66
(m-switch ^(
77
^((m-nothing) (m-set-object-here))
@@ -27,26 +27,26 @@
2727
))
2828
(m-fail "I don't see that here.")
2929
)
30-
))
30+
])
3131
)
3232

33-
(defun "" ^("matches" "actor") ^()
34-
*(if (notequal (first matches).fail null)
35-
*(echo actor (first matches):fail)
36-
*(nop
33+
(defun "" [matches actor] []
34+
(if (notequal (first matches).fail null)
35+
(echo actor (first matches):fail)
36+
(nop
3737
(if (greaterthan (length matches) 1) *(echo actor "[Multiple possible matches. Accepting first match.]\n"))
38-
(let ^(^("match" (first matches)))
39-
*(if (match.look-preposition)
40-
*(nop
38+
(let ^([match (first matches)])
39+
(if (match.look-preposition)
40+
(nop
4141
(echo actor "[Looking (match.preposition) (match.object:the).]\n")
4242
(echo actor "^(match.preposition) (match.object:the) (short_list match.object.(match.preposition))\n")
4343
)
44-
*(if (and (notequal match.object actor.location.object) (notequal match.object.location.object actor.location.object))
45-
*(nop
44+
(if (and (notequal match.object actor.location.object) (notequal match.object.location.object actor.location.object))
45+
(nop
4646
(echo actor "[Looking at (match.object:a) from (match.object.location.list) (match.object.location.object:the).]\n")
4747
(echo actor "(match.object:description)\n")
4848
)
49-
*(nop
49+
(nop
5050
(echo actor "[Looking at (match.object:a).]\n")
5151
(echo actor "(match.object:description)\n")
5252
)

DefaultDatabase/database/matchers.mud

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
/* Matchers for building command parsers */
22

3-
(defun "m-or" ^("A" "B") ^()
4-
*(defun "" ^("matches") ^("A" "B")
3+
(defun "m-or" ["function A" "function B"] []
4+
*(defun "" ["list matches"] [A B]
55
*(cat (A matches) (B matches))))
66

7-
(defun "m-keyword" ^("word") ^()
8-
*(lambda "lkeyword" ^("matches") ^("word")
7+
(defun "m-keyword" ["string word"] []
8+
*(lambda "lkeyword" ["list matches"] [word]
99
*(map "match"
1010
(where "match" (where "match" matches *(not (equal null match.token))) *(equal word match.token.word))
1111
*(clone match ^("token" match.token.next)))))
1212

1313
(defun "m-nothing" ^() ^()
14-
*(lambda "lnone" ^("matches") ^()
14+
*(lambda "lnone" ^("list matches") ^()
1515
*(where "match" matches *(equal null match.token))))
1616

1717
(defun "m-rest" ^("into") ^()
@@ -23,14 +23,14 @@
2323
)
2424
)
2525

26-
(defun "m-sequence" ^("matcher_list") ^()
27-
*(lambda "lsequence" ^("matches") ^("matcher_list")
28-
*(for "matcher" matcher_list *(var "matches" (matcher matches)))
26+
(defun "m-sequence" ^("list matcher-list") ^()
27+
*(lambda "lsequence" ^("list matches") ^("matcher-list")
28+
*(for "matcher" matcher-list *(var "matches" (matcher matches)))
2929
)
3030
)
3131

32-
(defun "m-optional" ^("matcher") ^()
33-
*(lambda "loptional" ^("matches") ^("matcher")
32+
(defun "m-optional" ^("function matcher") ^()
33+
*(lambda "loptional" ^("list matches") ^("matcher")
3434
*(cat (matcher matches) matches)))
3535

3636
(defun "m-anyof" ^("word_list" "into") ^()
@@ -45,6 +45,17 @@
4545
)
4646
)
4747

48+
(defun "m-?-adjectives" ^("list word-list") ^()
49+
*(lambda "lm-?-adjectives" ^("list matches") ^("word-list")
50+
*(let ^(^("anyof" (m-anyof word-list "-")) ^("temp" null))
51+
*(lastarg
52+
(while *(notequal (length (var "temp" (anyof matches))) 0) *(var "matches" temp))
53+
matches
54+
)
55+
)
56+
)
57+
)
58+
4859
(defun "m-always-pass" ^() ^()
4960
*(lambda "lanything" ^("matches") ^() *(matches)))
5061

@@ -280,5 +291,16 @@
280291
"m-switch list tail: Implements a chain of m-if-exclusive. Each item in the list is the else clause of the item before it. Tail is the final else."
281292
)
282293

294+
(defun "m-definer-held-by" [relative] []
295+
(lambda "lm-definer-held-by" [matches] [relative]
296+
(where "match" matches
297+
(and
298+
(equal match.verb.defined-on.location.object match.(relative))
299+
(equal match.verb.defined-on.location.list "held")
300+
)
301+
)
302+
)
303+
"Usefull for creating objects that enable a verb only when they are held."
304+
)
283305

284306

0 commit comments

Comments
 (0)