ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Crisis on July 22, 2014, 03:11:14 PM
-
I am working on a munitions script and want to make a check tool sub that would check for different tools instead of a separate one for each tool. I would then hope to be able to do the same thing to create the different tools.
I would think it would be something like
%set_tool_to_make_1 JTL_GTL_KTL ;tinker tool
%set_tool_to_make_2 RQF ;alchemy tool
%set_tool_to_make_3 OBG ;blacksmith tool
I am not sure how to put that into a check or tool crafting and how to make it differentiate between which I need at that time.
Is this possible?
-
Check out my sub Pearls_setup_tool in my submitted script Pearls' Crafting Assistant for an example. I'm pretty proud of it.
You could make an array with all the information.
Gosub setup_vars
gosub setup_tool tinkering
sub setup_vars
set %tools_tinkering_types jtl_gtl_ktl
set %tools_tinkering_minimum 2
set %tools_tinkering_maximum 3
set %tools_alchemy_types rfq
etc ...
Return
sub setup_tool
Namespace push
namespace local setup_tool
set !name %1
Set !tmp tools_ , !name , _types
Set !types % . !tmp
if !types <> N/A
{
Finditem !types C_ , #backpackid
Etc
}
namespace clear
namespace pop
return
typing all this from an ipad is a PITA
-
To have it check for all tools at once you could also do something like this:
Gosub setup_vars
gosub setup_tools
sub setup_vars
set %tools_1_types jtl_gtl_ktl ; tinkering
set %tools_1_minimum 2
set %tools_1_maximum 3
set %tools_2_types rfq ; alchemy
etc ...
Return
sub setup_tools
Namespace push
namespace local setup_tools
set !finished false
set !counter 0
repeat
set !counter !counter + 1
set !tmp tools_ , !counter , _types
set !types % . !tmp
if !types <> N/A
{
; check if lower then minimum tools in backpack, if true craft them untill we reach max
}
else ; it doesn't exist so we reached the end of our array
{
set !finished true
}
until !finished = true
namespace clear
namespace pop
return
Did that answer your question Crisis?