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 vs items (script side)
- 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 itemVarfields.
Neo still has no separate @object verb; procs are @proc item / @item proc.
Why this order
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.
Order of operations
- [ ] 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 itemand exercise the trigger
Create an item SpecProc
> @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 >
Attach on the prototype
> @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).
Cautious first stub
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.
Object-proc workflow with Creation
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 >
Matrix note
@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.
Compiled vs Beanshell
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.
Common mistakes
- Attaching before the proc row exists
@saveforgotten 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)
Related
- Script items — APIs and patterns
- Creation objects — three-layer build
- Script mobiles — often paired (give/wield reactions)
- Script Law — hub