View Single Post
05/24/23, 04:31 PM   #8
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 247
Originally Posted by Baertram View Post
You should not use the fixed numbers 0 ,1 and 2 etc. but the constants the game provides.
The constants type used for any API function or event are provided at the API documentation txt file:

Code:
* EVENT_CRAFTING_STATION_INTERACT (*[TradeskillType|#TradeskillType]* _craftSkill_, *bool* _sameStation_, *[CraftingInteractionMode|#CraftingInteractionMode]* _craftMode_)
Search for TradeskillType in the same txt filet o get the possible constants:
Code:
h5. TradeskillType
* CRAFTING_TYPE_ALCHEMY
* CRAFTING_TYPE_BLACKSMITHING
* CRAFTING_TYPE_CLOTHIER
* CRAFTING_TYPE_ENCHANTING
* CRAFTING_TYPE_INVALID
* CRAFTING_TYPE_JEWELRYCRAFTING
* CRAFTING_TYPE_PROVISIONING
* CRAFTING_TYPE_WOODWORKING

You will find those constants and their values via merTorchbug ingame too, using /tb and then click on the constants tab (search is top left).
e.g. enter CRAFTING_ and it should list all + their values.

Better use those as the numbers MIGHT (did) change in the future and 0 will stay 0 but CRAFTING_TYPE_INVALID might change to soemthing like -1 or similar and break your code then!

This applies to all API functions and events and callbacks.





Yes, only make sure to change the unique eventName "MyAddon" you specify to really be unique or you just overwrite your event callback!


Code:
EVENT_MANAGER:RegisterForEvent("MyAddon" .. tostring(craftingType), ...
btw: "MyAddon" (if you really use that in your addon RidinDirty as the unique event name) is not unique enough!
You might break other addons using the same.
!!!Please change that at ALL events in your addons to use a really unique name, like YOUR addon's real name, and not a generic "My Addon" or similar !!!
e.g. use RidinDirty.name if this exists
ty I always forget that.. ill get that updated soon.. And no I dont ever use MyAddon anywhere. I do that here for posts so as to keep my RidinDirty secret sauce a secret =p
  Reply With Quote