doc: Expand on programming examples document

This commit is contained in:
rbiv 2025-09-09 01:27:16 +00:00
parent 2795eae97a
commit ec3754e88f

View File

@ -1,4 +1,98 @@
George, who can be awakened. # Creation
This document can be considered a "cheat sheet" to be read in conjuction with
the [ToastStunt Programmer's Manual](https://github.com/lisdude/toaststunt-documentation/).
## Quickstart: Creating your First Object
```
@create $thing named "Bowl of Spaghetti"
@describe bowl as "Yummy yummy sketti"
@add-alias "sketti" to bowl
give sketti to vilmibm
```
Then, once you're sick of it...
```
@recycle bowl
```
## Quickstart: Creating Rooms
Check `help @dig`. The in-game documentation does a better job at explaining
this than I can.
Note that any registered account can create rooms that hang out in the void of
nothingness. In order to link your room to an existing room, you need to
either:
- Obtain permission from the other room's owner
- Convince them to run `@add-exit` and `@add-entrance` to your
entrances/exits
- Link to a publicly linkable room (Such as the Grassy Plains).
To make your room publicly linkable, you can change the permissions on the
`entrances`/`exits` properties:
```
;set_property_info(#DATABASE_ID, "entrances", {#131, "rwc"})
;set_property_info(#DATABASE_ID, "exits", {#131, "rwc"})
```
## Quickstart: Integrating with tilde.town
Typically, the use of `exec` and `curl` is restricted to wizard accounts. But
we all love each other here!
Check `help $tilde_utils`.
exec's "executables" directory is `/home/moo/executables`. Ask in #moo if you'd
like something added there.
## How to Reverse Engineer Objects
A great way to learn is to look at other objects around the MOO.
- `@show` can print out an object in detail, including properties (Provided you
have permission.)
- `@find` can find objects, properties, verbs.
- `@list` can print out verbs.
Eg, to print out the source code for the `who` command, you can use:
```
> @find :who
The verb :who is on rbiv(#131)--ANSI PC(#100)
> @list #100:who
```
## Example Objects
### The Orb of Seeing
Demonstrates how to get information about the players that interact with
objects.
```
@create $thing named "Orb of Seeing"
@verb orb:description tnt
@program orb:description
return {
"The "+this.name+" sees many things!",
"Viewer name: "+player.name,
"Item owner: "+this.owner.name
};
.
```
### George
Everyone's favorite sleepy lad.
Shows some more advanced concepts.
Defines a custom verb, "awaken", such that one may "awaken george".
``` ```
@create $thing named "George" @create $thing named "George"
@ -25,19 +119,3 @@ else
endif endif
. .
``` ```
The Orb of Seeing, which demonstrates how to get information about the players
that interact with objects.
```
@create $thing named "Orb of Seeing"
@verb orb:description tnt
@program orb:description
return {
"The "+this.name+" sees many things!",
"Viewer name: "+player.name,
"Item owner: "+this.owner.name
};
.
```