![]() |
Discussion on ID vs DISPID (OOP) - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: General Discussion (/Forum-General-Discussion) +--- Forum: UO/Sphere Discussion (/Forum-UO-Sphere-Discussion) +--- Thread: Discussion on ID vs DISPID (OOP) (/Thread-Discussion-on-ID-vs-DISPID-OOP) |
Discussion on ID vs DISPID (OOP) - Capes - 04-14-2018 10:54 PM Alright I'd like to discuss the differences in ID and DISPID. There seems to be a lot of confusion in the forums of the properties and their use. Now this discussion will have meaning if the reader has a programming background else it will probably only confuse you. It's my observation that DISPID has no OOP (object oriented programming) functionality. It only effects the appearance of the object. Example- make a shovel -> .add i_shovel change it's appearance -> .set DISPID i_barrel update to show change -> .update Now the shovel appears as a barrel, but any and all queries on the object will display i_shovel properties. So the shovel looks like a barrel but remains to be a shovel. So queries on the shovel return shovel properties (though it looks like a barrel) and it sill behaves like a shovel. Now ID seems to use basic inheritance (a shallow, single level is-a OOP principle). Meaning that by assigning an ID to an object, the object will now behave like the new ID. Meaning old object is-a new object. But seems to be restricted to a single level of heritance not multiple inheritance. Also it does not retain it's base class (as in normal OOP). So it's no longer the old object. Example- make a shovel -> .add i_shovel change it's id -> .set ID i_dagger update to show change -> .update The shovel is in fact a dagger now with all the dagger properties. That's because shovel is-a dagger now with everything relating to a dagger. All things shovel are gone. Hope that helps! Feel free to correct me here or add to this discussion! Thanks Capes RE: Discussion on ID vs DISPID (OOP) - Capes - 04-15-2018 01:01 AM Id also like to add that in a item definition (0.56d) sphere won't let you use both ID & DISPID together you have to add DISPID in the on=@create. DUPEITEM seems to be a combination of ID & DISPID except allowing the new Object to keep all behaviors of old object. So DUPEITEM does not remove the base behaviors of the original object it retains them. Basically DUPEITEM is the same as defining an object using both ID & DISPID where ID is the old objects behaviors/properties and DISPID is the new appearance. Summary DISPID -> changes only the appearance of the object (all old behavior's remain) ID -> change all aspects of old object to new object DUPEITEM -> acts like an object with ID & DISPID set to separate objects, where ID defines behaviors and DISPID is the appearance. DUPEITEM example- [ITEMDEF 01041] DEFNAME=i_pie_baked TYPE=t_food //bla bla bla [ITEMDEF 0dc0] //fishing pole DEFNAME=fishing_pole_acts_like_baked_pie DUPEITEM=i_pie_baked Same example using ID & DISPID [ITEMDEF fishing_pole_acts_like_baked_pie] ID=i_pie_baked ON=@Create DISPID=i_fishing_pole The reason for me posting this is because I spent literally days trying to debug why certain things didn't work. Only to find out that I didn't really understand how ID, DISPID & DUPEITEM worked. Thanks Capes |