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
Xerakon
Apprentice


Joined: 10 May 2011
Posts: 111

PostPosted: Fri Jan 08, 2016 12:55 am   

Building A Variable List
 
Hey guys,

I get a list of skills in the game, and what I'm trying to do is colorize it and build a list. We can 'research <skill>' in the game. The skills start at either 0% or 20%, and they advance in 15% increments per research command. The overall idea is to be able to sit in a room and have an automated research script where I can type like "researchall" and it captures the list, determines what can be researched, and runs down the list, researching everything to maximum and then moving on to the next available topic to be researched.

Any way that you can help me out? Thanks in advance! Below is the list as displayed in the game.

Code:
------------------------------------Skills ------------------------------------
advanced electronics 100%                   aid  80%                   beg  20%
               bribe  90%                  call  80%             chemistry 100%
               climb  20%               conceal 100%          construction 100%
        crackdatapad  90%                 cyber  90%                  data 100%
        decrypt_file 100%           destruction 100%               develop  93%
            diagnose 100%                   dig  20%      disable_security  90%
                dock 100%                doctor  90%             duplicate  80%
             edibles 100%             education 100%           electronics 100%
    emergency_refuel  90%          encrypt_file 100%          enhancearmor  98%
         enhancement 100%             equipment 100%            fakesignal  90%
           first aid  90%                   fly  90%             forensics 100%
          gemcutting  90%                 gouge 100%              grenades  90%
            guidance 100%                  hack  90%             healwound  90%
    heavy spacecraft 100%                  hide  82%           hypothesize  90%
              inject  90%                  jail  90%                   jam  90%
                kick 100%      large spacecraft 100%              lifthack  90%
          locateship 100%                lookup  90%              machines 100%
           makearmor 100%           makebinders  90%             makeblade  90%
         makeblaster  90%         makebowcaster   0%            makecamera  90%
         makecanteen  90%           makecircuit  90%          makeclothing  94%
         makecomlink  92%         makecontainer  82%           makedatapad  90%
      makeflashlight  90%         makeforcepike  90%           makegoggles  90%
         makegrenade  90%           makeholster 100%           makejewelry  95%
        makelandmine  90%            makemedpac  90%            makeshield  90%
         matchvector  92%               medical 100%     medium spacecraft 100%
            minerals 100%                 mount  90%             narcotics 100%
          navigation 100%           networkhack  90%                  peek 100%
              ponder 100%       protect_account  92%            remodulate  90%
         repairarmor  90%           repairdroid  90%           repairhatch  90%
          repairhull  90%          repairweapon  90%                rescue  90%
            research 100%                revive  90%                  roll  90%
            sabotage  91%                  scan 100%                search  84%
              secure  47%              security  90%             setleader  90%
    ship maintenance  93%          ship systems 100%             shipdodge  70%
               short  90%              showclan 100%            showplanet 100%
               slice  47%                  slip  20%      small spacecraft 100%
           smalltalk  90%                 snipe  90%        space combat 1 100%
      space combat 2 100%        space combat 3 100%            spacecraft 100%
      spice refining  20%                 steal  20%                 study 100%
               swipe  90%                  tail  90%               tapdata  90%
               teach  80%              theorize  92%                 throw  80%
       tractor beams 100%        transportation 100%              tuneship  90%
        upgradedroid  90%           upgradeship  90%        weapon systems 100%
------------------------------------Weapons------------------------------------
            blasters 100%            bowcasters  90%           force pikes  90%
        vibro-blades  80% 
------------------------------------ Feats ------------------------------------
       armor crafting [ ]           communicator [ ]                evading [X]
            navigator [X]              precision [X]          quick learner [ ]
             salesman [ ]        scientific mind [ ] 
To see a shorter practice list, type PRACTICE <class name>.
Reply with quote
Llohr
Apprentice


Joined: 17 May 2005
Posts: 108

PostPosted: Wed Jan 20, 2016 1:05 pm   
 
Well, I don't know what sorts of checks you want to use to determine which classes to practice, nor what limits there may be on practicing and such.

However, if you want to know how to collect the list displayed and record it in a usable format, I can help you with that.

I won't guarantee that this is the BEST way to do it, but I will guarantee that it's the first one that popped into my head :P

Code:
<class name="Skills" id="7">
  <trigger priority="20" id="2">
    <pattern>~-~-~-~-Skills ~-~-~-~-</pattern>
    <value>All_Skills={}
#t+ Skill_Harvest</value>
  </trigger>
  <trigger name="Skill_Harvest" priority="30" enabled="false" id="3">
    <pattern>(*)</pattern>
    <value>#if (%1=~"Skills" OR %1=~"Weapons") {} {
  #if (%1=~"Feats") {
    #t- Skill_Harvest
    Skill_Sort
  } {
    $Row_Number=%max(%dbkeys(@All_Skills))
    $Row_Number=$Row_Number+1
    #addkey All_Skills {$Row_Number=%1}
  }
}</value>
  </trigger>
  <alias name="Skill_Sort" id="4">
    <value>#loopdb @All_Skills {All_Skills.%key=%replace(%val,"%","|")}
$New_List={}
$New_Key={}
$New_Val={}
#loopdb @All_Skills {
  #forall %val {
    #switch (%rightback(%i,2)=~" ") {
      $New_Key=%trim(%leftback(%i,1))
      $New_Val=%trim(%rightback(%i,1))
    } (%rightback(%i,3)=~" ") {
      $New_Key=%trim(%leftback(%i,2))
      $New_Val=%trim(%rightback(%i,2))
    } {
      $New_Key=%trim(%leftback(%i,3))
      $New_Val=%trim(%rightback(%i,3))
    }
    #addkey $New_List $New_Key $New_Val
  }
}
All_Skills=$New_List</value>
  </alias>
</class>


If you need information on how to utilize a database variable, or would like that in a format other than xml, let me know. You should be able to copy the code into notepad or some such and save it as a .xml file, then import it in your session.

As for what it does: It creates a single database variable called "All_Skills," wherein each key is the name of a skill, and the value of that key is the percent practiced.

Edit: If anybody wants to suggest improvements, please do; I'm always looking to learn new tricks.

Edit 2: Found a pair of typos that should(?) have caused that not to work. It worked, but I fixed them anyway.


Last edited by Llohr on Wed Jan 20, 2016 1:35 pm; edited 1 time in total
Reply with quote
Llohr
Apprentice


Joined: 17 May 2005
Posts: 108

PostPosted: Wed Jan 20, 2016 1:13 pm   
 
Oh, yeah, I had it include weapon skills. I wasn't sure if you wanted to or not.
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