Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
sav
Wanderer


Joined: 09 Jan 2006
Posts: 86

PostPosted: Thu Oct 06, 2011 8:59 am   

How to train cheapest skill
 
i have a list of 15 skills in this format:

Crit : 115/130(33750)
Dodge : 130/130(-)
Block : 115/130(33750)

the numbers from left to right are current level, max level, cost for level.

i have already captured all the numbers into variables.

What i want to do is make a trigger to auto-train the skill that is the cheapest to train. and i want to be able to customize it such that i can pick which skills to compare to train the cheapest. No idea how to go about doing this. If someone could point me in the right direction, would very much appreciate it.

Thanks!
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Fri Oct 07, 2011 1:13 am   
 
Though I'm certain there are other, possibly more efficient ways, I like to do such things with string lists. This will do what you want, and nothing more... easy to expand, though.
Code:
#TR {^(%w) : %d/%d~((%d)~)$} {
  #IF (!%ismember(%1,@SkillList)) {#ADDITEM SkillList %1}
  skillCost.%ismember(%1,@SkillList)=%2
  }
#ALIAS TrainLowest {#SEND train @SkillList.%ismember(%min(@skillCost),@skillCost)}
_________________
.geniusclown
Reply with quote
sav
Wanderer


Joined: 09 Jan 2006
Posts: 86

PostPosted: Fri Oct 07, 2011 3:10 am   
 
cool, thanks. but how do i customize it? like i don't want to compare all my skills for the lowest costs. i only want to compare say crit and block out of all my 15 skills.

also, if the skill is maxed out like the dodge skill in the above example, skill cost is "-" which seems to be recognized as the smallest amount.
Reply with quote
Stowslee
Wanderer


Joined: 20 Apr 2008
Posts: 69
Location: Watervliet, NY

PostPosted: Fri Oct 07, 2011 1:08 pm   
 
This trigger will catch the name of the skill as well as its cost, as long as it is one of the skills you want to train. To set which skills you want to train you need to set the variable @TrainThis. Add whichever skills you decide you want, Crit, Block, etc. You can use #ADDITEM to do this from the command line. Also this trigger will exclude all skills with "-" as their cost.

Code:
<trigger priority="10" id="1">
  <pattern>^(%w) : %d/%d~((*)~)$</pattern>
  <value>#if (%2 != "-" and %ismember(%1, @TrainThis)) {#ADDKEY SkillCost %1 %2}</value>
</trigger>


Then this alias will compare each of the skills cost and output which is the lowest. You can change the #ECHO to whatever command you want sent. If your command to train is learn. The output should be LEARN %key.

Code:
<alias name="LowCostSkill" id="9">
  <value>#LOOPDB @SkillCost
{#if (%val = %min(@Skillcost)) {#ECHO %key has the lowest cost to train.}}</value>
</alias>


Let me know if you have any questions, I know this might be a little confusing.
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Fri Oct 07, 2011 2:53 pm   
 
I think db commands is probably the way to go as Stowslee suggested, but my understanding is still fuzzy partly because there are some limitations to db's that would make some of my scripts much more complex... a couple extra variables isn't too big of a deal imo.

Anyway, if you want to do the same, but compare just a specific list, then you could tweak my script as such:
Code:
#VAR skillList {Crit|Block|3rd Skill|4th Skill}
#VAR skillCost ""
#TR {^(%w) : %d/%d~((%d)~)$} {skillCost.%ismember(%1,@skillList)=%2}
#ALIAS TrainLowest {#SEND train @SkillList.%ismember(%min(@skillCost),@skillCost)}

So, you customize the list in @skillList to be exactly the skills you want to compare. If you do this manually, then you'll leave out the maxed skills anyway so %min reporting a "-" as minimum won't be an issue. You can define the skill list from the command line with
var={value1|value2|value3}. If you redefine how many skills to compare and the new list is shorter, it will be necessary to clear @skillCost (typing skillcost="" from the command line will do the trick) so that it doesn't keep old values in with the new.

As for "customizing" it, that's too vague to respond to. This concept is how I track experience in my game, where there are well over 50 skills, and they increase by themselves over time for doing actions. My script keeps track of the skills and shows how active each skill is using a gauge, which will report how much they've increase by each time they do increase. Of course, such a customization won't do you any good because your game and purpose are drastically different from mine. So, what else do you want to do with this information?
_________________
.geniusclown
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net