The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Suggestion] @Dye improvement
Author Message
Feeh
Sphere Developer
*****

Posts: 156
Likes Given: 6
Likes Received: 40 in 29 posts
Joined: Sep 2012
Reputation: 4



Post: #3
RE: [Suggestion] @Dye improvement
@dye is intended to call on the item, so you can change the behavior of this item when someone dyes it. You don't have to track the item id on the dye tub for every dyed item with specific behavior
eg: You don't want this specific item to be dyed when some X property is set or during an event

You can use something like this to change the dye tub behavior

[typedef t_dye_vat]
ON=@Targon_Item
Serv.b <src.name> used a dye tub on a <argo.name> !

The call order is:
@TargOn_Item on t_dye_vat(global) or on itemdef(specific tubs) (return 1 prevents @Dye to be called)
@Dye on the itemdef

If you want @Dye to be called on every item to...for example update your sql database, just do what Xun said


Quote:The idea is improve it, making it fire some trigger on the dye tub too (SRC=dye tub, ARGO=targ item/char). With this single trigger we can control everything or even create custom dye tubs to dye only certain items (furniture dye tub, runebook dye tub, etc)

On RunUO, C# (C++ and others too) provides a way to create new classes based on a base class (derived/inherited classes)
eg: Every sword in the game is based on the BaseSword class, which is based on BaseWeapon class, which is based on Item class. Every visible object inside the game is either Item or Mobile. The same goes for mobiles (eg: Vendor<-BaseVendor<-BaseCreature<-Mobile)

On Sphere we could have something like this, inherit types from a base type

[typedef t_furniture_dyetub t_dye_vat]
ON=@TargOn_Item
if (!<Argo Is forniture>)
message You can only dye furnitures!
return 1
endif

t_furniture_dyetub is based on t_dye_vat. It will behave exactly like a t_dye_vat unless when some script modify its functions

With the actual scripting you can create the furniture dye tub and override its functions with triggers on the itemdef. inherited item types would just be a shortcut or a clever way to separate items based on its functions (type) and not by itemdef.
Even that it sounds redundant to have derived types, I'd vote for it. When talking about dye tubs it has no big reason to used derived types, but if you want to have practice weapons, you could create a t_practice_weap based on the t_weapon; no needs to define same triggers on every practice weapon. Just imagine this with spawners..or everything else
Changing the new typedef would change the behavior of every item with this type quickly

Feeh/Epila - Nightly releases / SphereWiki / Github Issues / Sphere's GitHub
(This post was last modified: 05-16-2014 04:37 AM by Feeh.)
05-16-2014 03:28 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
[Suggestion] @Dye improvement - Coruja - 05-15-2014, 09:56 PM
RE: [Suggestion] @Dye improvement - XuN - 05-15-2014, 10:26 PM
RE: [Suggestion] @Dye improvement - Feeh - 05-16-2014 03:28 AM
RE: [Suggestion] @Dye improvement - Coruja - 05-18-2014, 12:55 PM
RE: [Suggestion] @Dye improvement - Feeh - 05-19-2014, 12:38 AM
RE: [Suggestion] @Dye improvement - XuN - 05-18-2014, 06:00 PM
RE: [Suggestion] @Dye improvement - Coruja - 05-19-2014, 02:58 AM
RE: [Suggestion] @Dye improvement - Ben - 05-20-2014, 09:13 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)