Script Law — Rooms
Hand-holding for room SpecProcs. Classic Diku room triggers / dg_scripts are not how Neo works — you create a named Beanshell room proc with @proc room, then attach that name on a room prototype with @room proc.
Hub: Script Law. Build the room first: Creation Law — Rooms.
Order of operations (do not skip)
- [ ] Room prototype exists and is
@saved (Rooms) - [ ]
@proc room new <name>then@proc room script <name>with Beanshell - [ ]
index proc_room/@proc room examine <name>to verify - [ ]
@load room <vid>→@room proc <name>→@examine room→@save room - [ ] Walk into the room / wait for UPDATE to test
Attaching a proc name that does not exist yet is the usual first failure — create, then attach.
Create and edit a room proc
> @proc room new quiet_enter Okay. > @proc room script quiet_enter (writer opens — paste Beanshell, finish writer) > @proc room examine quiet_enter …script text… > @proc room matrix quiet_enter 0.0 Okay. > index proc_room quiet >
Help pattern: @proc room [delete|examine|new|matrix|rename|script] <name>. Names are lowercased, alphabetic/underscore, length 3–16.
Rename / delete when you outgrow a name:
> @proc room rename quiet_enter alley_enter Okay. > @proc room delete alley_enter Okay. >
Detach rooms that still name a proc before you delete it if you want clean references.
Personal ''script room'' writer
> script room list > script room write (writer opens for the SpecProc named like your player) >
Usage: script (mobile|item|room) (list|write) [player]. Implementors may pass another player name.
Attach to a room prototype
> @load room 1200 Okay. > @room proc quiet_enter Okay. > @examine room (confirm proc name) > @save room Okay. > goto 1200 >
If @load room complains about an open draft, @examine room then @save or @clear.
Triggers rooms care about
Branch on var.STATE (see hub table). For rooms you will use most:
STATE_ENTER(-4) — someone enteredSTATE_UPDATE(-6) — periodic room updateSTATE_SCRIPT(0) — script pulse / roomact-style- Interpreter / post-interpreter when commands involve the room context
Return true only when you intend to block the triggering command; otherwise return false;.
Room shell APIs (illustrative)
Prefer methods that already appear in live procs / RoomShell. Examples used in world data and shell surface:
var.room.echo(…)/ related echo helpers- Door helpers such as
lockNorth,unlockEast, … - Weather-related helpers on the room shell where present
Also: var fields (STATE, mobile, item, command, args, scratch aliases) and util.roll / util.chance. Do not invent method names — @proc room examine an existing proc or read shell code when unsure.
Minimal ENTER example (teaching stub)
Paste into @proc room script … only after you understand it blocks nothing:
if (var.STATE == var.STATE_ENTER) {
if (util.chance(50)) {
var.room.echo("The air shifts as someone arrives.");
}
}
return false;
Attach, goto the room from next door, and confirm you see the echo sometimes. If nothing happens: confirm @examine room shows the proc name, you @saved, and your script actually branches on ENTER (not only SCRIPT).
Hard-coded room specials
Some rooms use compiled SpecRoom via @room attrs rather than a free-form script name (e.g. patterns like RoomSkullDoor). That is Creation-side attribute work, not @proc room — see Rooms and the Script Law hub note on Java specials.
Common mistakes
@room procbefore@proc room new/script- Forgetting
@save roomafter attach - Branching only on
STATE_SCRIPTwhen you meant ENTER - Returning
trueby accident and blocking movement/commands - Deleting a proc still named on live rooms
Related
- Script Law — hub
- Creation rooms — build / dig / doors
- Script zones — zones do not hold room scripts