scriptobjects

This is an old revision of the document!


Script Law — Objects

How to put a Beanshell SpecProc on an object prototype. Classic oedit script fields / dg object scripts are not the Neo path: create @proc item, then @item proc <name> on the item prototype you built in Creation.

Hub: Script Law. Build first: Creation Law — Objects. Shell method detail: Script Law — Items.

  • Objects (this page) — workflow: create item SpecProc → attach on @item → save → spawn-test.
  • Items (scriptitems) — what you can call on var.item (isWeapon, purge, createMobile, …) and item Var fields.

Neo still has no separate @object verb; procs are @proc item / @item proc.

The prototype only stores the name of a SpecProc. The Beanshell text lives in the SpecProc table. If you @item proc my_sword_proc before @proc item new/script my_sword_proc, you attach a dangling name and runtime looks broken. Create → write → examine/index → attach → examine → save → spawn.

  • [ ] Object prototype exists (descr + stats + item linked) — Objects
  • [ ] @proc item new <name> + @proc item script <name>
  • [ ] index proc_item / @proc item examine <name>
  • [ ] @load item <vid>@item proc <name>@examine item@save item
  • [ ] create item <vid> / load item and exercise the trigger
> @proc item new my_sword_proc
Okay.
> @proc item script my_sword_proc
(writer opens — paste Beanshell, finish)
> @proc item examine my_sword_proc
> @proc item matrix my_sword_proc 0.0
Okay.
> index proc_item sword
>

Pattern: @proc item [delete|examine|new|matrix|rename|script] <name>. Names: lowercase, alphabetic/underscore, length 3–16 (SpecProc.MIN_NAME_LEN / MAX_NAME_LEN).

Rename when the name was a draft:

> @proc item rename my_sword_proc blade_hum
Okay.
>

Then update any prototype that still says my_sword_proc (@load item@item proc blade_hum@save item).

Personal writer option:

> script item list
> script item write
>
> @load item 3100
Okay.
> @item proc my_sword_proc
Okay.
> @examine item
(confirm proc field)
> @save item
Okay.
> create item 3100
You create a tempered shortsword.
>

If @load item errors because a draft is open, @examine item then @save or @clear. After editing script text later, purge the old instance and create again (or zone reset if the zone loads it).

Until you know which STATEs your item proc receives, keep the stub loud and harmless:

if (var.STATE == var.STATE_SCRIPT) {
  if (util.chance(100)) {
    // rare pulse — replace with real logic later
  }
}
return false;

Then expand using APIs from Script items. Prefer copying from @proc item examine on a live proc over inventing calls.

Full path from nothing:

> @new item_descr 3100
… strings …
> @save item_descr
> @new item_stats 3100
> @item_stats type weapon
> @item_stats flags wear take
> @item_stats flags wear wield
> @save item_stats
> @new item 3100
> @item description 3100
> @item stats 3100
> @examine item
> @save item
> @proc item new my_sword_proc
> @proc item script my_sword_proc
(paste stub that branches on var.STATE, return false)
> @load item 3100
> @item proc my_sword_proc
> @examine item
> @save item
> create item 3100
>

@proc item matrix <name> <double> stores builder metadata. It is not combat power (combat matrix is Matrix.calculate / Mobile.matrix()). Live procs often leave 0.0.

Free-form scripts use @item proc. Hard-coded Java item specials use SpecItem on @item_stats attrs (Items, Script Law hub). Pick one model per behavior; do not assume both fire the same way.

  • Attaching before the proc row exists
  • @save forgotten after @item proc
  • Editing the script but testing an old instance
  • Renaming a proc without updating prototypes
  • Putting give-quest logic only on the item when the mobile event is what fires (Script items, Script mobiles)
  • scriptobjects.1790178414.txt.gz
  • Last modified: 2026/09/23 15:46
  • (external edit)