Mudlet Script v011b (5/19/17)

Scripts and support for your favorite MUD client.
Nyyrazzilyss
Sojourner
Posts: 30
Joined: Tue May 19, 2015 6:30 am

Mudlet Script v011b (5/19/17)

Postby Nyyrazzilyss » Tue May 26, 2015 4:13 am

I've posted a Toril script for Mudlet 3.x.x 3.1+ recommended http://www.mudlet.org If it's a prior version of Mudlet, it won't work.

Latest stable script version posted (5/19/2017) is 011b (removed from post, old version)

Development script (7/27/2017) 011dev (removed from post, old version)

Image Image
Image Image

New installation:

Create a new toril profile (torilmud.com 9999), and connect to it. Don't log in to the mud (yet). Use the mudlet package manager icon to import the nyylib zip file you downloaded. (Don't unzip it).

Type '#help' for client related instructions.
Type 'set' for a list of settings/options.

Once installed, the script can be bypassed and anything sent direct to the mud by typing the first letter of the command as a capital letter.

Updating:

Prior to updating, use the #backup command to make a backup of your datafiles into another folder. Note: This doesn't backup any changes you might have made to the script itself.

Recommended:

Create a new profile. Install the new package to the new profile, and use the #backup command again to restore the datafiles to the new profile. Don't touch/delete the old profile.
Exit and restart mudlet.

Not recommended:

To update in the pre-existing profile, select the package manager icon inside mudlet, and uninstall the previous package installed. Import the new nyylib zip file you downloaded (Don't unzip it -
Note: Safari by default auto unzips files it downloads). Exit and restart mudlet.

** NOTE ** - The previous package will be prefixed with NyyLIB - Don't remove anything else!

Map progress is saved when updating. Type '#map update' to add new included areas to the loaded map image without losing previous progress.

Known Issues:

A major part of the script involves queuing of commands/spells. This may occasionally break. If this happens, try typing 'sit', then 'stand'.

The script won't run properly if the installation path includes a '$' or non-latin characters as part of the path.

-- 011b

-- the function 'initCustom' will be called on initialization if it exists
-- self in group display if more then 1 person uses cyan colour
-- file structure and installation updated - mudlet 3.1+ recommended
-- grouped hell hounds are named 'wolf'
-- set poisonbag - name of container containing all poisons
-- buttons refactored
-- set hideequip true/false - left equip bar shows on mouseover
-- clairvoyance will now show the room number viewed and zone name (if available)
-- spell buttons / cast script refactored
-- map window resized
-- changes to casting code
-- xp train starts fights with bodyslam (if ogre)
-- added most spells for all classes
-- pets/undead/mounts added to grouplist / displayed on screen
-- Change from necro to lich in wholist if needed
-- bugfixes
-- Map updated: full size 316 areas 44618 rooms
Last edited by Nyyrazzilyss on Sun Dec 02, 2018 5:24 am, edited 120 times in total.
Nirac
Sojourner
Posts: 1
Joined: Fri Nov 27, 2015 6:43 pm

Re: Mudlet Script v009c (11/19/15)

Postby Nirac » Fri Nov 27, 2015 6:45 pm

I just want to say thanks for posting this work. I'm a completely new player and it is a huge, huge help. Clearly a lot of work done here - thanks!
davyde84
Sojourner
Posts: 1
Joined: Tue May 24, 2016 11:24 am

Re: Mudlet Script v010e (5/8/16)

Postby davyde84 » Tue May 24, 2016 11:26 am

Hi!!
I've installed you package to study it!
i wanted to know how to map a Dikumud-like mud with no help for mapping

with this package you only show and use maps you made with Cmud right?
Or can you explain me how to map a new zone with this package?0
Nyyrazzilyss
Sojourner
Posts: 30
Joined: Tue May 19, 2015 6:30 am

Re: Mudlet Script v010e (5/8/16)

Postby Nyyrazzilyss » Tue Jun 07, 2016 7:08 pm

The mapfiles included with the package were originally built using cmud/zmud yes. The import script that I use is also included in the package itself, though no instructions provided for use / or really intended to be used by anyone but me. I do use the cmud mapper when I need to make corrections to the mapfiles.

I don't allow for creation of new maps. This is by design.

With minimal information provided by the mud to assist with mapping (not to mention a lot of teleports/loops/non grid zones/etc) the choice I made with the mapper was to premap everything myself and just keep it all hidden, then unlock rooms as they're moved through. With 3.0-delta of mudlet that was possible, though I also ran into a lot of slowdown issues when map sizes were passing about 12k rooms.

I started on my mudlet mapper script about a year ago - There's still certain things not quite working properly with it, but for the most part it's working exactly as desired.

SlySven made some recent changes to mudlet in pr308 that solved those problems for me, and i've now got 40k rooms in a single mapfile running at full speed with no problems at all. There's a windows + osx version of mudlet compiled from source posted on my github that includes those changes.
Zepharian
Sojourner
Posts: 5
Joined: Sun Aug 28, 2016 3:30 am

Re: Mudlet Script v010rc1 (6/26/16)

Postby Zepharian » Sun Aug 28, 2016 3:50 am

Some small updates - I'll Add more in a few days:

Mounted Addition:

Trigger: Remount in Combat
Trigger String: You lose your balance and are dismounted.

Code: Select all

if checkMask("summonmount") then
  send("mount")
end


Fix Autoroller - Now it only checks the first column for mighty, heroic, perfect; so the roller score will not add up the stats from the second column
Trigger Regex: (Strength|Dexterity|Agility|Constitution|Power|Intelligence|Wisdom|Charisma): +(bad|fair|average|mundane|good|mighty|heroic|perfect) +(Strength|Dexterity|Agility|Constitution|Power|Intelligence|Wisdom|Charisma): +(bad|fair|average|mundane|good|mighty|heroic|perfect)

Code fix: column 2 should be matches[5] not matches[6]

sendAssist() (in file MiscScripts) function change from a simple assist for all if there is a target set:
-- Maybe get the mob that the NyyLIB.mtank is tanking and set NyyLIB.target to that automatically if NyyLIB.target == nil

Code: Select all

      if checkMask("summonmount") and NyyLIB.target ~= nil then
         send("mc " .. NyyLIB.target)
      elseif checkMask("rogue") and NyyLIB.target ~= nil then --- maybe check if the bard is not singing too
         send("bs " .. NyyLIB.target)
      else
         expandAlias("send assist " .. xchar)
      end
Zepharian
Sojourner
Posts: 5
Joined: Sun Aug 28, 2016 3:30 am

Re: Mudlet Script v010rc1 (6/26/16)

Postby Zepharian » Thu Sep 08, 2016 7:32 am

A table of powers_alias = spellname and a trigger to decrement spellCount on cast.
initMageSpell(whoclass()) should probably be called from initFullData() ... or someplace better if there is one.

TRIGGER:
1. You start (chanting).*
2. You don't have that spell (memorized).*

Code: Select all

if whoclass() == "Ele" or whoclass() == "Enc" or whoclass() == "Ill" or whoclass() == "Inv" or whoclass() == "Nec" then
   local cursp        = spell:getCurrent()
   local spellname    = charData:get("spellAliases", false)[cursp]

   if cursp == nil then
      return
   end

   if matches[2] == "chanting" then
      echoDebug("\n<red>[ Decrementing spell count for: " .. spellname .. " ]" )
      decSpellCount(spellname)
   elseif matches[2] == "memorized" then
      echoDebug("\n<red>[ Setting spell count for: " .. spellname .. " to 0 after 'Dont have that spell memorized message'.]" )
      setSpellCount(spellname, 0)
   end
end


Code: Select all

function initMageSpell(xclass)
   if xclass == "Ill" then
      initIlluSpells()
   elseif xclass == "Inv" then
      initInvoSpells()
   elseif xclass == "Enc" then
      initEnchSpells()
   elseif xclass == "Ele" then
      initElemSpells()
   elseif xclass == "Nec" then
      initNecrSpells()
   end
end

function initIlluSpells()
   local spellAliases = {
      pk="phantasmal_killer" ,
      fold="dimensional_fold" ,
      mi="mirror_image" ,
      ml="mislead" ,
      pheal="phantom_heal" ,
      rp="rainbow_pattern" ,
       sunshad="sun_shadow" ,
      camo="camouflage" ,
      pb="phantasmal_blades" ,
      sq="sequester" ,
      sh="shadechill" ,
      sf="shadow_flux" ,
      ds="displacement" ,
      non="nondetection" ,
      tq="tranquility" ,
      dim="dimension_door" ,
      sb="shadow_burst" ,
      shm="shadow_magic" ,
      ts="true_sight" ,
      btf="beautify" ,
      dism="dispel_magic" ,
      fs="farsee" ,
      lv="levitate" ,
      sct="scarlet_outline" ,
      sp="spook" ,
      tele="teleport" ,
      disi="dispel_invisible" ,
      massi="mass_invisibility" ,
      pa="phantom_armor" ,
      bt="blackthorns" ,
      ff="faerie_fire" ,
      invis="invisibility" ,
      di="detect_invisibility" ,
      dm="detect_magic" ,
      mf="mage_flame" ,
      bolt="shadow_bolt"
   }

   charData:set("spellAliases", spellAliases, false)
end

function initInvoSpells()
   local spellAliases = {
      bl="ball_lightning" ,
      inf="inferno" ,
      ss="sandstorm" ,
      gate="gate" ,
      met="meteorswarm" ,
      relo="relocate" ,
      sb="sandblast" ,
      ff="fell_frost" ,
      fm="force_missiles" ,
      mp="major_paralysis" ,
      tb="thunderblast" ,
      bcf="bigbys_clenched_fist" ,
      inc="incendiary_cloud" ,
      pws="power_word_stun" ,
      bb="blazing_beam" ,
      chain="chain_lightning" ,
      ma="melfs_acid_arrow" ,
      cshield="coldshield" ,
      cone="cone_of_cold" ,
      dim="dimension_door" ,
      fshield="fireshield" ,
      is="ice_storm" ,
      iv="infravision" ,
      slow="slowness" ,
      dism="dispel_magic" ,
      fs="farsee" ,
      fb="fireball" ,
      lv="levitate" ,
      minp="minor_paralysis" ,
      msw="mordenkainens_sword" ,
      ray="ray_of_enfeeblement" ,
      tele="teleport" ,
      invis="invisibility" ,
      lb="lightning_bolt" ,
      mm="minute_meteors" ,
      acb="acid_blast" ,
      sg="shocking_grasp" ,
      bh="burning_hands" ,
      ct="chill_touch" ,
      di="detect_invisibility" ,
      dm="detect_magic" ,
      mf="mage_flame" ,
      mg="magic_missile"
   }

   charData:set("spellAliases", spellAliases, false)
end

function initEnchSpells()
   local spellAliases = {
      ds="dragonscales" ,
      ts="time_stop" ,
      gate="gate" ,
      relo="relocate" ,
      griffon="aura_of_the_griffon" ,
      brc="breach" ,
      cn="constriction" ,
      airy="airy_water" ,
      bb="blacklight_burst" ,
      gi="globe_of_invulnerability" ,
      mp="major_paralysis" ,
      enl="enlarge" ,
      fly="fly" ,
      pwb="power_word_blind" ,
      ps="prismatic_spray" ,
      red="reduce" ,
      rps="repulsion" ,
      sfog="solid_fog" ,
      bl="blur" ,
      cone="cone_of_cold" ,
      env="enervate" ,
      fb="fireball" ,
      ns="needle_swarm" ,
      chp="charm_person" ,
      cshield="coldshield" ,
      dim="dimension_door" ,
      fshield="fireshield" ,
      iv="infravision" ,
      mgi="minor_globe_of_invulnerability" ,
      slow="slowness" ,
      ss="stoneskin" ,
      stm="stumble" ,
      dism="dispel_magic" ,
      fs="farsee" ,
      fmb="fumble" ,
      hs="haste" ,
      lv="levitate" ,
      lb="lightning_bolt" ,
      massi="mass_invisibility" ,
      minp="minor_paralysis" ,
      slp="sleep" ,
      tele="teleport" ,
      co="chromatic_orb" ,
      dex="dexterity" ,
      disi="dispel_invisible" ,
      ms="missile_shield" ,
      ray="ray_of_enfeeblement" ,
      str="strength" ,
      bh="burning_hands" ,
      ct="chill_touch" ,
      es="energy_shield" ,
      ff="faerie_fire" ,
      invis="invisibility" ,
      di="detect_invisibility" ,
      dm="detect_magic" ,
      mf="mage_flame" ,
      mg="magic_missile"
   }

   charData:set("spellAliases", spellAliases, false)
end

function initElemSpells()
   local spellAliases = {
      eee="elemental_earth_embodiment" ,
      gate="gate" ,
      relo="relocate" ,
      ew="elemental_ward" ,
      lb="lava_burst" ,
      eb="earthblood" ,
      efog="earth_fog" ,
      eae="elemental_air_embodiment" ,
      ffog="fire_fog" ,
      fw="firewave" ,
      iw="icewave" ,
      pwb="power_word_blind" ,
      pws="power_word_stun" ,
      ww="whirlwind" ,
      dim="dimension_door" ,
      ewe="elemental_water_embodiment" ,
      hs="haste" ,
      il="ice_layer" ,
      it="ice_tongue" ,
      bs="blizzard_sphere" ,
      cone="cone_of_cold" ,
      es="earth_stones" ,
      ss="stoneskin" ,
      cshield="coldshield" ,
      fshield="fireshield" ,
      iv="infravision" ,
      tele="teleport" ,
      tl="thunder_lance" ,
      fb="fireball" ,
      lv="levitate" ,
      ray="ray_of_enfeeblement" ,
      slp="sleep" ,
      ab="air_blast" ,
      dism="dispel_magic" ,
      dm="detect_magic" ,
      is="ice_spear" ,
      invis="invisibility" ,
      di="detect_invisibility" ,
      ed="earth_darts" ,
      mf="mage_flame"
   }

   charData:set("spellAliases", spellAliases, false)
end

function initNecrSpells()
   local spellAliases = {
      bw="banshee_wail" ,
      bs="boneshatter" ,
      rb="rain_of_blood" ,
      abi="abi_dalzims_horrid_wilting" ,
      eu="eradicate_undead" ,
      gi="globe_of_invulnerability" ,
      bm="blackmantle" ,
      ctg="contagion" ,
      dun="destroy_undead" ,
      ssh="soul_shackles" ,
      bbb="beltyns_burning_blood" ,
      dim="dimension_door" ,
      hs="haste" ,
      pu="protect_undead" ,
      age="age" ,
      mgi="minor_globe_of_invulnerability" ,
      nd="nerve_dance" ,
      rejuv="rejuvenate_major" ,
      vt="vampiric_touch" ,
      wu="ward_undead" ,
      cshield="coldshield" ,
      cone="cone_of_cold" ,
      ed="energy_drain" ,
      fb="feeblemind" ,
      hu="heal_undead" ,
      is="ice_storm" ,
      iv="infravision" ,
      lv="levitate" ,
      ray="ray_of_enfeeblement" ,
      snp="snapping_teeth" ,
      tele="teleport" ,
      dism="dispel_magic" ,
      slp="sleep" ,
      sh="spectral_hand" ,
      str="strength" ,
      wt="wither" ,
      pt="pain_touch" ,
      rejuvm="rejuvenate_minor" ,
      sb="soul_bind" ,
      ct="chill_touch" ,
      invis="invisibility" ,
      pfc="protection_from_cold" ,
      pfu="protection_from_undead" ,
      di="detect_invisibility" ,
      dm="detect_magic" ,
      mf="mage_flame" ,
      mg="magic_missile"
   }

   charData:set("spellAliases", spellAliases, false)
end
Nyyrazzilyss
Sojourner
Posts: 30
Joined: Tue May 19, 2015 6:30 am

Re: Mudlet Script v010rc1 (6/26/16)

Postby Nyyrazzilyss » Thu Sep 08, 2016 12:37 pm

Thanks, i'll get those imported into the dev script. Feel free to make powers spell lists for the priest/lich/spell casting warriors also :)

It's something i'd thought of in the past, but had never got around to doing. Updating spellcounts on successful completion needed individual triggers for each spell, not to mention would lose accuracy on aborted spellcasts. A single trigger using a table of spells works so much better.

I will make some adjustments to the trigger for edge cases, however i'll mention something that stands out - The trigger likely won't error nicely if spell:getCurrent() returns a non-powers value, or a combination of a powers value + target.

Another quick change I made in the initialization. I changed it to use a mask instead of a long if statement, and renamed the functions to use the mud 3 letter class short names.

Code: Select all

powerTable = { "Ill", "Inv", "Enc", "Ele", "Nec"}


Call in initNyyLib:

Code: Select all

if checkMask("powerTable") then
   initPowerTable()
end


instead of the initMageSpell function:

Code: Select all

function initPowerTable()
   local fname="init" .. whoclass() .. "Spells"

   if _G[fname] ~= nil then
      _G[fname]()
   else
      echoDebug("\n<red>[Function " .. fname .. " does not exist]\n")
   end
end


Something else I expect I will change is i'll remove the initializing functions/take the table out of charData, and replace it with a single 3 dimensional table of format { Class= { power=spellname } }. I have imported/made some changes to the trigger itself, mostly just need to test.

(edit)

Changed how the table is stored in place of the init functions, it needs more classes still

Code: Select all

powerAliases= powerAliases or {}


powerAliases["Ill"] =
                  { pk="phantasmal_killer", fold="dimensional_fold", mi="mirror_image", ml="mislead",
                       pheal="phantom_heal", rp="rainbow_pattern", sunshad="sun_shadow", camo="camouflage",
                    pb="phantasmal_blades", sq="sequester", sh="shadechill", sf="shadow_flux",
                    ds="displacement", non="nondetection", tq="tranquility", dim="dimension_door",
                    sb="shadow_burst", shm="shadow_magic", ts="true_sight", btf="beautify",
                    dism="dispel_magic", fs="farsee", lv="levitate", sct="scarlet_outline",
                    sp="spook", tele="teleport", disi="dispel_invisible", massi="mass_invisibility",
                    pa="phantom_armor", bt="blackthorns", ff="faerie_fire", invis="invisibility",
                    di="detect_invisibility", dm="detect_magic", mf="mage_flame", bolt="shadow_bolt"}
powerAliases["Inv"] =
                  { bl="ball_lightning", inf="inferno", ss="sandstorm", gate="gate",
                    met="meteorswarm", relo="relocate", sb="sandblast", ff="fell_frost",
                    fm="force_missiles", mp="major_paralysis", tb="thunderblast", bcf="bigbys_clenched_fist",
                    inc="incendiary_cloud", pws="power_word_stun", bb="blazing_beam", chain="chain_lightning",
                    ma="melfs_acid_arrow", cshield="coldshield", cone="cone_of_cold", dim="dimension_door",
                    fshield="fireshield", is="ice_storm", iv="infravision", slow="slowness",
                    dism="dispel_magic", fs="farsee", fb="fireball", lv="levitate",
                    minp="minor_paralysis", msw="mordenkainens_sword", ray="ray_of_enfeeblement", tele="teleport",
                    invis="invisibility", lb="lightning_bolt", mm="minute_meteors", acb="acid_blast",
                    sg="shocking_grasp", bh="burning_hands", ct="chill_touch", di="detect_invisibility",
                    dm="detect_magic", mf="mage_flame", mg="magic_missile"}
powerAliases["Enc"] =
                  { ds="dragonscales", ts="time_stop", gate="gate", relo="relocate",
                    griffon="aura_of_the_griffon", brc="breach", cn="constriction", airy="airy_water",
                    bb="blacklight_burst", gi="globe_of_invulnerability", mp="major_paralysis", enl="enlarge",
                    fly="fly", pwb="power_word_blind", ps="prismatic_spray", red="reduce",
                    rps="repulsion", sfog="solid_fog", bl="blur", cone="cone_of_cold",
                    env="enervate", fb="fireball", ns="needle_swarm", chp="charm_person",
                    cshield="coldshield", dim="dimension_door", fshield="fireshield", iv="infravision",
                    mgi="minor_globe_of_invulnerability", slow="slowness", ss="stoneskin", stm="stumble",
                    dism="dispel_magic", fs="farsee", fmb="fumble", hs="haste", lv="levitate",
                    lb="lightning_bolt", massi="mass_invisibility", minp="minor_paralysis", slp="sleep",
                    tele="teleport", co="chromatic_orb", dex="dexterity", disi="dispel_invisible",
                    ms="missile_shield", ray="ray_of_enfeeblement", str="strength", bh="burning_hands",
                    ct="chill_touch", es="energy_shield", ff="faerie_fire", invis="invisibility",
                    di="detect_invisibility", dm="detect_magic", mf="mage_flame", mg="magic_missile"}
powerAliases["Ele"] =
                  { eee="elemental_earth_embodiment", gate="gate", relo="relocate", ew="elemental_ward",
                    lb="lava_burst", eb="earthblood", efog="earth_fog", eae="elemental_air_embodiment",
                    ffog="fire_fog", fw="firewave", iw="icewave", pwb="power_word_blind",
                    pws="power_word_stun", ww="whirlwind", dim="dimension_door", ewe="elemental_water_embodiment",
                    hs="haste", il="ice_layer", it="ice_tongue", bs="blizzard_sphere",
                    cone="cone_of_cold", es="earth_stones", ss="stoneskin", cshield="coldshield",
                    fshield="fireshield", iv="infravision", tele="teleport", tl="thunder_lance",
                    fb="fireball", lv="levitate", ray="ray_of_enfeeblement", slp="sleep",
                    ab="air_blast", dism="dispel_magic", dm="detect_magic", is="ice_spear",
                    invis="invisibility", di="detect_invisibility", ed="earth_darts", mf="mage_flame"
                  }
powerAliases["Nec"] =
                  { bw="banshee_wail", bs="boneshatter", rb="rain_of_blood", abi="abi_dalzims_horrid_wilting",
                     eu="eradicate_undead", gi="globe_of_invulnerability", bm="blackmantle", ctg="contagion",
                    dun="destroy_undead", ssh="soul_shackles", bbb="beltyns_burning_blood", dim="dimension_door",
                    hs="haste", pu="protect_undead", age="age", mgi="minor_globe_of_invulnerability",
                    nd="nerve_dance", rejuv="rejuvenate_major", vt="vampiric_touch", wu="ward_undead",
                    cshield="coldshield", cone="cone_of_cold", ed="energy_drain", fb="feeblemind",
                    hu="heal_undead", is="ice_storm", iv="infravision", lv="levitate",
                    ray="ray_of_enfeeblement", snp="snapping_teeth", tele="teleport", dism="dispel_magic",
                    slp="sleep", sh="spectral_hand", str="strength", wt="wither" ,
                    pt="pain_touch", rejuvm="rejuvenate_minor", sb="soul_bind", ct="chill_touch",
                    invis="invisibility", pfc="protection_from_cold", pfu="protection_from_undead", di="detect_invisibility",
                    dm="detect_magic", mf="mage_flame", mg="magic_missile"
                  }   
Zepharian
Sojourner
Posts: 5
Joined: Sun Aug 28, 2016 3:30 am

Re: Mudlet Script v010rc1 (6/26/16)

Postby Zepharian » Fri Sep 09, 2016 2:22 am

A handy function to tell OSType if ever needed for anything:

Code: Select all

local function getOS()
   local raw_os_name, raw_arch_name = '', ''

   -- LuaJIT shortcut
   if jit and jit.os and jit.arch then
      raw_os_name = jit.os
      raw_arch_name = jit.arch
   else
      -- is popen supported?
      local popen_status, popen_result = pcall(io.popen, "")
      if popen_status then
         popen_result:close()
         -- Unix-based OS
         raw_os_name = io.popen('uname -s','r'):read('*l')
         raw_arch_name = io.popen('uname -m','r'):read('*l')
      else
         -- Windows
         local env_OS = os.getenv('OS')
         local env_ARCH = os.getenv('PROCESSOR_ARCHITECTURE')
         if env_OS and env_ARCH then
            raw_os_name, raw_arch_name = env_OS, env_ARCH
         end
      end
   end

   raw_os_name = (raw_os_name):lower()
   raw_arch_name = (raw_arch_name):lower()

   local os_patterns = {
      ['windows'] = 'Windows',
      ['linux'] = 'Linux',
      ['mac'] = 'Mac',
      ['darwin'] = 'Mac',
      ['^mingw'] = 'Windows',
      ['^cygwin'] = 'Windows',
      ['bsd$'] = 'BSD',
      ['SunOS'] = 'Solaris',
   }
   
   local arch_patterns = {
      ['^x86$'] = 'x86',
      ['i[%d]86'] = 'x86',
      ['amd64'] = 'x86_64',
      ['x86_64'] = 'x86_64',
      ['Power Macintosh'] = 'powerpc',
      ['^arm'] = 'arm',
      ['^mips'] = 'mips',
   }

   local os_name, arch_name = 'unknown', 'unknown'

   for pattern, name in pairs(os_patterns) do
      if raw_os_name:match(pattern) then
         os_name = name
         break
      end
   end
   for pattern, name in pairs(arch_patterns) do
      if raw_arch_name:match(pattern) then
         arch_name = name
         break
      end
   end
   return os_name, arch_name
end
Zepharian
Sojourner
Posts: 5
Joined: Sun Aug 28, 2016 3:30 am

Re: Mudlet Script v010rc1 (6/26/16)

Postby Zepharian » Fri Sep 09, 2016 9:40 am

Here is an updated trigger to decrement spellcounts. This should manage if there is a target or not, as well as if the spell is cast with an alias or old school c[ast] 'xxx' yy.

Code: Select all

if powerAliases[whoclass()] then
   local cursp = spell:getCurrent()
   local decspell = ""

   -- If there is no current spell or the current spell is a non-powers cast
   if cursp == nil then
     return
   elseif string.match(cursp, "c[ast]* +'") ~= nil then
    local _, _, spellname = string.find(cursp, "c[ast]* +' *(.*) *'.*")
    castspell = spellname:gsub("%s+", "_")

    echoDebug("\n<red>[ Parsed Cast Spell: " .. castspell .. " ]" )

     for spellname, count in pairs(charData:get("spells"))
     do
      if string.match(spellname:trim(), castspell .. ".*") ~= nil then
         echoDebug("\n<red>[ Found memed spell match: " .. spellname:trim() .. " ]" )
              decspell = spellname:trim()
      end
     end
   else
     -- Remove any target info and keep just the alias name
     cursp = string.split(cursp, " ")[1]
     decspell = powerAliases[whoclass()][cursp]
   end

   if matches[2] == "chanting" then
      echoDebug("\n<red>[ Decrementing spell count for: " .. decspell .. " ]" )
      decSpellCount(decspell)
   elseif matches[2] == "memorized" then
      echoDebug("\n<red>[ Setting spell count for: " .. decspell .. " to 0 after 'Dont have that spell memorized message'.]" )
      setSpellCount(decspell, 0)
   end
end
Zepharian
Sojourner
Posts: 5
Joined: Sun Aug 28, 2016 3:30 am

Re: Mudlet Script v010rc1 (6/26/16)

Postby Zepharian » Sat Sep 10, 2016 1:27 am

Cleric spells:

Note divine power and divine purify are both dp. Kept power.
Bless and blind are both bl. Kept Blind
Detect and Dispel Evil are both de. Kept dispel.

powerAliases["Cle"] =
{ resu="resurrect" , pshift="plane_shift" ,
ha="healing_aura" ,
dp="divine_power" ,
realm="greater_realm_of_protection" ,
eu="eradicate_undead" ,
fhm="full_harm" ,
fh="full_heal" ,
gvig="group_vigorize" ,
hw="holy_word" ,
uw="unholy_word" ,
wb="water_breathing" ,
cnl="continual_light" ,
cr="curse" ,
dkn="darkness" ,
dun="destroy_undead" ,
fe="fear" ,
hm="harm" ,
sp="silence_person" ,
dism="dispel_magic" ,
hl="heal" ,
rd="raise_dead" ,
vc="vigorize_critic" ,
vt="vitality" ,
vit="vitality" ,
bl="blindness" ,
fs="flame_strike" ,
pfa="protection_from_acid" ,
pfc="protection_from_cold" ,
pfe="protection_from_evil" ,
pff="protection_from_fire" ,
pfg="protection_from_gas" ,
pfd="protection_from_good" ,
pfl="protection_from_lightning" ,
rp="remove_poison" ,
sum="summon" ,
wu="ward_undead" ,
cauc="cause_critical" ,
cb="cure_blind" ,
ccr="cure_critic" ,
de="dispel_evil" ,
dispg="dispel_good" ,
eaq="earthquake" ,
sen="sense_life" ,
vs="vigorize_serious" ,
causs="cause_serious" ,
cs="cure_serious" ,
slp="slow_poison" ,
vl="vigorize_light" ,
word="word_of_recall" ,
am="armor" ,
caul="cause_light" ,
curel="cure_light" ,
dg="detect_good" ,
dm="detect_magic" }

Return to “MUD Client Help”

Who is online

Users browsing this forum: No registered users and 11 guests