Author Topic: Check Tool Sub  (Read 1780 times)

0 Members and 1 Guest are viewing this topic.

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 2998
  • Activity:
    3.4%
  • Reputation Power: 41
  • Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.
  • Gender: Male
  • Scripting well enough to break things!
  • Respect: +205
  • Referrals: 2
    • View Profile
Check Tool Sub
« on: July 22, 2014, 03:11:14 PM »
0
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

Code: [Select]
%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?

Offline Pearls

  • Hero Member
  • *
  • Posts: 557
  • Activity:
    0%
  • Reputation Power: 13
  • Pearls barely matters.Pearls barely matters.
  • Respect: +65
  • Referrals: 1
    • View Profile
Re: Check Tool Sub
« Reply #1 on: July 22, 2014, 04:14:03 PM »
0
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.

Code: [Select]
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
« Last Edit: July 22, 2014, 04:21:25 PM by Pearls »
XII : "My happiness as a married man is directly related to the amount of sex I have which, in turn, requires that I pretend I like these movies every now and then and that it really doesn't bother me when she tells me about her problems but doesn't want me to give her a solution ;) "

Offline Pearls

  • Hero Member
  • *
  • Posts: 557
  • Activity:
    0%
  • Reputation Power: 13
  • Pearls barely matters.Pearls barely matters.
  • Respect: +65
  • Referrals: 1
    • View Profile
Re: Check Tool Sub
« Reply #2 on: July 24, 2014, 04:05:51 AM »
0
To have it check for all tools at once you could also do something like this:

Code: [Select]
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?
XII : "My happiness as a married man is directly related to the amount of sex I have which, in turn, requires that I pretend I like these movies every now and then and that it really doesn't bother me when she tells me about her problems but doesn't want me to give her a solution ;) "

Tags: