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-nmm6 (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-nmm6 (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-nmm6 (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
Is there a way to get the defname of the ore that is being mined
Author Message
fabiohvp
Apprentice
*

Posts: 23
Likes Given: 11
Likes Received: 5 in 4 posts
Joined: Jul 2018
Reputation: 0



Post: #1
Is there a way to get the defname of the ore that is being mined
I'll try to explain..
I am using ON=@SkillMakeItem to create a system to upgrade the skill tool (bs - sledge hammer, bc - dagger, tailor - sewing kit, etc..). I blocked the use of other tools, each skill can use only one kind of tool.

The system is fairly simple, each time the event is triggered, I check which skill is being used with <act.SKILLMAKE.1.KEY> and depend on the skill amount needed to craft the item I increment X until my counter reach the value I want and then the tool will give +10 for that skill.

My main issue is that when mining (or lumberjacking) I can't get the type (iron, gold, silver, valorite, etc..) that was mined.

Another issue is that for skills like tailor, tinker, I don't have reference for the tool that is being used, so for now I am using findid, but if anyone knows another way, let me know.

The main part of the script is below.

Code:
ON=@SkillMakeItem
local.skillName = <act.SKILLMAKE.1.KEY>
local.skillValue = <act.SKILLMAKE.1.VAL>

if (<eval strcmp(<local.skillName>, skill_alchemy)> == 0)
    calculate_tools_bonus <findid.i_mortar_pestle.uid>, <local.skillValue>, "alchemy"
elseif (<eval strcmp(<local.skillName>, skill_blacksmith)> == 0)
    calculate_tools_bonus <src.weapon.uid>, <local.skillValue>, "blacksmithing"    
elseif (<eval strcmp(<local.skillName>, skill_bowcraft)> == 0)
    calculate_tools_bonus <src.weapon.uid>, <local.skillValue>, "bowcraft"
elseif (<eval strcmp(<local.skillName>, skill_carpentry)> == 0)
    calculate_tools_bonus <findid.i_saw.uid>, <local.skillValue>, "carpentry"
elseif (<eval strcmp(<local.skillName>, skill_inscription)> == 0)
    calculate_tools_bonus <findid.i_pen_and_ink.uid>, <local.skillValue>, "inscription"
// elseif (<eval strcmp(<local.skillName>, skill_lumberjack)> == 0)
//     calculate_tools_bonus <src.weapon.uid>, "lumberjacking"
// elseif (<eval strcmp(<local.skillName>, skill_mining)> == 0)
//     calculate_tools_bonus <src.weapon.uid>, "mining"
elseif (<eval strcmp(<local.skillName>, skill_tailoring)> == 0)
    calculate_tools_bonus <findid.i_sewing_kit.uid>, <local.skillValue>, "tailoring"
elseif (<eval strcmp(<local.skillName>, skill_tinkering)> == 0)
    calculate_tools_bonus <findid.i_tinker_tools.uid>, <local.skillValue>, "tinkering"
endif
return 0
07-20-2018 05:07 PM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #2
RE: Is there a way to get the defname of the ore that is being mined
you can use the @RegionResourceFound trigger
https://wiki.spherecommunity.net/index.p...ourceFound

Also you can improve the if statement in this way:
Code:
ON=@SkillMakeItem
local.skillName = <action>
local.skillValue = <act.SKILLMAKE.1.VAL>

if <local.skillName> == skill_alchemy>
    calculate_tools_bonus <findid.i_mortar_pestle>, <local.skillValue>, "alchemy"
elseif <local.skillName> == skill_blacksmith
    calculate_tools_bonus <src.weapon>, <local.skillValue>, "blacksmithing"    
elseif <local.skillName> == skill_bowcraft
    calculate_tools_bonus <src.weapon>, <local.skillValue>, "bowcraft"
elseif <local.skillName> == skill_carpentry
    calculate_tools_bonus <findid.i_saw>, <local.skillValue>, "carpentry"
elseif <local.skillName> == skill_inscription
    calculate_tools_bonus <findid.i_pen_and_ink>, <local.skillValue>, "inscription"
elseif <local.skillName> == skill_tailoring
    calculate_tools_bonus <findid.i_sewing_kit>, <local.skillValue>, "tailoring"
elseif <local.skillName> == skill_inscription
    calculate_tools_bonus <findid.i_tinker_tools>, <local.skillValue>, "tinkering"
endif
return 0

No need to use eval in if, they are automatically evaluated, and skill_* definition are just number so no need to string compare them, also no need to do src.weapon.uid or <findid.i_tinker_tools.uid> because <src.weapon> or <findid.i_tinker_tools> return the uid by default
(This post was last modified: 07-20-2018 07:13 PM by darksun84.)
07-20-2018 06:42 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes darksun84's post
fabiohvp
Apprentice
*

Posts: 23
Likes Given: 11
Likes Received: 5 in 4 posts
Joined: Jul 2018
Reputation: 0



Post: #3
RE: Is there a way to get the defname of the ore that is being mined
Thank you, I manage to make mining and lumber working using @RegionResourceFound
07-22-2018 03:15 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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